E
- The type of triangle stored in this list.public final class TriangleList<E extends GeomTriangle> extends AbstractGeomList<TriangleList,E>
GeomTriangle
objects. This list is similar
to a GeomList, but has methods specifically designed for working with large
sets of triangles. All the triangles in a list must have the same physical dimensions.
WARNING: This list allows geometry to be stored in different units. If consistent units are required, then the user must specifically convert the list items.
Modified by: Joseph A. Huwaldt
RESOURCES
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
E value)
Inserts the specified
GeomTriangle at the specified position in this list. |
boolean |
addAll(int index,
java.util.Collection<? extends E> c)
Inserts all of the
GeomTriangle objects in the specified collection into
this list at the specified position. |
TriangleList<E> |
copy()
Returns a copy of this
TriangleList instance
allocated by the calling
thread (possibly on the stack). |
TriangleList<Triangle> |
copyToReal()
Return a copy of this object with any transformations or subranges
removed (applied).
|
Parameter<Area> |
getArea()
Return the total surface area of this list of triangles.
|
int |
getPhyDimension()
Returns the number of physical dimensions of this geometry element.
|
TriangleList<E> |
getRange(int first,
int last)
Returns the range of elements in this list from the specified start and
ending indexes.
|
TriangleList<TriangleTrans> |
getTransformed(GTransform transform)
Returns transformed version of this element.
|
static TriangleList |
newInstance()
Returns a new, empty, preallocated or recycled
TriangleList
instance (on the stack when executing in a StackContext )
that can store a list of GeomTriangle objects. |
static TriangleList |
newInstance(java.lang.String name)
Returns a new, empty, preallocated or recycled
TriangleList
instance (on the stack when executing in a StackContext )
with the specified name, that can store a list of GeomTriangle
objects. |
static void |
recycle(TriangleList instance)
Recycles a TriangleList instance immediately (on the stack when executing in a
StackContext).
|
TriangleList<E> |
removeDegenerate(Parameter<Length> tol)
Return a new triangle list that is identical to this one, but with any degenerate
triangles removed.
|
TriangleList<E> |
reverse()
Returns an new
TriangleList with the elements in this list in reverse
order. |
E |
set(int index,
E element)
Replaces the
GeomTriangle at the specified position in this list with the
specified element. |
TriangleList<E> |
to(Unit<Length> unit)
Returns the equivalent to this list but with all the elements stated in the
specified unit.
|
TriangleList<E> |
toDimension(int newDim)
Return a copy of this list converted to the specified number of physical
dimensions.
|
TriangleVertData |
toVertData(Parameter<Length> tol)
Convert this list of Triangle objects into a TriangleVertData structure with a
non-repeating (unique) list of vertices, non-degenerate triangles defined by
indices into the list of vertices, areas of all the triangles, and normals for all
the triangles.
|
static TriangleList<Triangle> |
triangulateQuads(PointArray<? extends GeomPoint> quads)
Return a TriangleList containing a simple triangulation of the input
array of quadrilateral panels.
|
static <E extends GeomTriangle> |
valueOf(E... elements)
Return a TriangleList containing the
GeomTriangle objects in the
specified array. |
static TriangleList<Triangle> |
valueOf(java.util.List<? extends GeomPoint> vertices,
int[] indexes)
Return a TriangleList containing the triangles
|
static <E extends GeomTriangle> |
valueOf(java.lang.String name,
java.util.Collection<E> elements)
Return a TriangleList containing the
GeomTriangle objects in the
specified collection. |
static <E extends GeomTriangle> |
valueOf(java.lang.String name,
E... elements)
Return a TriangleList containing the
GeomTriangle objects in the
specified list. |
add, add, add, addAll, addAll, addAll, clear, contains, containsAll, containsGeometry, equals, get, get, getAll, getBoundsMax, getBoundsMin, getFirst, getIndexFromName, getLast, getLimitPoint, getParDimension, getUnit, hashCode, indexOf, isEmpty, isValid, iterator, lastIndexOf, listIterator, listIterator, remove, remove, remove, removeAll, reset, retainAll, size, subList, toArray, toArray, toText, unmodifiableList
addChangeListener, clone, compareTo, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName, toString
addChangeListener, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName
public static TriangleList newInstance()
TriangleList
instance (on the stack when executing in a StackContext
)
that can store a list of GeomTriangle
objects.public static TriangleList newInstance(java.lang.String name)
TriangleList
instance (on the stack when executing in a StackContext
)
with the specified name, that can store a list of GeomTriangle
objects.name
- The name to be assigned to this list (may be null
).public static <E extends GeomTriangle> TriangleList<E> valueOf(java.lang.String name, java.util.Collection<E> elements)
GeomTriangle
objects in the
specified collection.E
- The type of triangle contained in the returned list of triangles.name
- The name to be assigned to this list (may be
null
).elements
- A collection of triangle elements. May not be null.public static <E extends GeomTriangle> TriangleList<E> valueOf(java.lang.String name, E... elements)
GeomTriangle
objects in the
specified list.E
- The type of triangle contained in the returned list of triangles.name
- The name to be assigned to this list (may be
null
).elements
- A list of triangle elements. May not be null.public static <E extends GeomTriangle> TriangleList<E> valueOf(E... elements)
GeomTriangle
objects in the
specified array.E
- The type of triangle contained in the returned list of triangles.elements
- An array of triangle elements. May not be null.public static TriangleList<Triangle> valueOf(java.util.List<? extends GeomPoint> vertices, int[] indexes)
vertices
- A list of all the vertices in the list of triangles. May not be null.indexes
- An array of indexes into the vertices list. Each set of 3 consecutive
indexes into the vertices list defines a triangle. May not be null.public static TriangleList<Triangle> triangulateQuads(PointArray<? extends GeomPoint> quads)
quads
- An array of quadrilateral panels (defined by a topologically
rectangular array of points). May not be null.public int getPhyDimension()
Triangle
objects or 0 if this list has no Triangle objects in it.getPhyDimension
in interface GeomElement<TriangleList>
getPhyDimension
in class AbstractGeomList<TriangleList,E extends GeomTriangle>
public TriangleList<E> getRange(int first, int last)
getRange
in interface GeometryList<TriangleList,E extends GeomTriangle>
getRange
in class AbstractGeomList<TriangleList,E extends GeomTriangle>
first
- index of the first element to return (0 returns the 1st
element, -1 returns the last, etc).last
- index of the last element to return (0 returns the 1st
element, -1 returns the last, etc).java.lang.IndexOutOfBoundsException
- if the given index is out of range:
index >= size()
public E set(int index, E element)
GeomTriangle
at the specified position in this list with the
specified element. Null elements are ignored. The input element must have the same
physical dimensions as the other items in this list, or an exception is thrown.set
in interface java.util.List<E extends GeomTriangle>
set
in class AbstractGeomList<TriangleList,E extends GeomTriangle>
index
- The index of the element to replace (0 returns the 1st element, -1
returns the last, -2 returns the 2nd from last, etc).element
- The element to be stored at the specified position.
null
elements are ignored.java.lang.IndexOutOfBoundsException
- - if index > size()
DimensionException
- if the input element's dimensions are different from
this list's dimensions.public void add(int index, E value)
GeomTriangle
at the specified position in this list.
Shifts the element currently at that position (if any) and any subsequent elements
to the right (adds one to their indices). Null values are ignored. The input
element must have the same physical dimensions as the other items in this list, or
an exception is thrown.
Note: If this method is used concurrent access must be synchronized (the list is not thread-safe).
add
in interface java.util.List<E extends GeomTriangle>
add
in class AbstractGeomList<TriangleList,E extends GeomTriangle>
index
- the index at which the specified element is to be inserted. (0 returns
the 1st element, -1 returns the last, -2 returns the 2nd from last,
etc).value
- The element to be inserted. May not be null.java.lang.IndexOutOfBoundsException
- if index > size()
DimensionException
- if the input element's dimensions are different from
this list's dimensions.public boolean addAll(int index, java.util.Collection<? extends E> c)
GeomTriangle
objects in the specified collection into
this list at the specified position. Shifts the element currently at that position
(if any) and any subsequent elements to the right (increases their indices). The
new elements will appear in this list in the order that they are returned by the
specified collection's iterator. The behavior of this operation is unspecified if
the specified collection is modified while the operation is in progress. Note that
this will occur if the specified collection is this list, and it's nonempty. The
input elements must have the same physical dimensions as the other items in this
list, or an exception is thrown.addAll
in interface java.util.List<E extends GeomTriangle>
addAll
in class AbstractGeomList<TriangleList,E extends GeomTriangle>
index
- index at which to insert first element from the specified collection.c
- Elements to be inserted into this collection. May not be null.true
if this collection changed as a result of the call.DimensionException
- if the input element's dimensions are different from
this list's dimensions.public TriangleList<E> reverse()
TriangleList
with the elements in this list in reverse
order.reverse
in interface GeometryList<TriangleList,E extends GeomTriangle>
reverse
in class AbstractGeomList<TriangleList,E extends GeomTriangle>
public TriangleList<E> removeDegenerate(Parameter<Length> tol)
tol
- The tolerance for determining if a triangle is degenerate. A value of
null
would indicate that exactly zero area is required to
be degenerate.public Parameter<Area> getArea()
public TriangleList<E> toDimension(int newDim)
newDim
- The dimension of the element to return.public TriangleList<E> to(Unit<Length> unit)
unit
- the length unit of the list to be returned. May not be null.ConversionException
- if the the input unit is not a length unit.public TriangleList<E> copy()
TriangleList
instance
allocated
by the calling
thread (possibly on the stack).public TriangleList<Triangle> copyToReal()
public TriangleList<TriangleTrans> getTransformed(GTransform transform)
GeomTransform
and contains transformed versions of the
contents of this list as children. Any list elements that are not
transformable will simply be added to the output list without
transformation.transform
- The transform to apply to this geometry element. May not be null.DimensionException
- if this element is not 3D.public TriangleVertData toVertData(Parameter<Length> tol)
tol
- The position tolerance used to determine if two vertices are coincident.
Pass null
or 0 if all vertices are to be retained.public static void recycle(TriangleList instance)
instance
- The instance to be recycled.