Package geomss.geom
Class LinearComboCurve
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<T>
-
- geomss.geom.AbstractCurve<LinearComboCurve>
-
- geomss.geom.LinearComboCurve
-
- All Implemented Interfaces:
Curve<LinearComboCurve>,GeomElement<LinearComboCurve>,GeometryList<LinearComboCurve,Curve>,LinearCombination<LinearComboCurve,Curve>,ParametricGeometry<LinearComboCurve>,Transformable<LinearComboCurve>,java.io.Serializable,java.lang.Cloneable,java.lang.Comparable,java.lang.Iterable<Curve>,java.util.Collection<Curve>,java.util.List<Curve>,javolution.lang.Reusable,javolution.xml.XMLSerializable
public class LinearComboCurve extends AbstractCurve<LinearComboCurve> implements LinearCombination<LinearComboCurve,Curve>
Represents a linear combination made up of a list ofCurveobjects. A linear combination curve is formed by a weighted linear addition of a list of one or more curves. For example:B = W1*Crv_1 + ... + Wn*Crv_nwhere W1 through Wn are scalar weights. The linear addition is done independently of physical dimension (each dimension is added separately) and the weighted addition is done in parameter space:B = W1*Crv_1(s) + ... + Wn*Crv_n(s).Any number of curves may be added to a LinearComboCurve, but they all must have the same physical dimensions.
Modified by: Joseph A. Huwaldt
- Version:
- March 23, 2025
- Author:
- Joseph A. Huwaldt, Date: September 8, 2015
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class geomss.geom.AbstractCurve
GTOL
-
Fields inherited from class geomss.geom.AbstractGeomElement
RESOURCES
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, Curve value)Inserts the specifiedCurveat the specified position in this list with a default weight of 1.0.booleanadd(int index, Curve... array)Inserts all of theCurveobjects in the specified list of arguments into this LinearComboCurve at the specified position with a default weight of 1.0 assigned to each.voidadd(int index, Curve curve, java.lang.Double weight)Inserts the specifiedCurveat the specified position in this list.booleanadd(Curve curve)Appends the specifiedCurveto the end of this LinearComboCurve with a default weight of 1.0.booleanadd(Curve... array)Appends all of the elements in the specified list of arguments to this LinearComboCurve with a default weight of 1.0 assigned to each.booleanadd(Curve curve, java.lang.Double weight)Appends the specifiedCurveto the end of this list of curves.booleanaddAll(int index, Curve[] arr)Inserts all of theCurveobjects in the specified array into this LinearComboCurve at the specified position with a default weight of 1.0 assigned to each.booleanaddAll(int index, java.util.Collection<? extends Curve> curves)Inserts all of the curves in the specified collection of curves into this LinearComboCurve with default weights of 1.0 for each.booleanaddAll(int index, java.util.Collection<? extends Curve> curves, java.util.Collection<java.lang.Double> weights)Inserts all of the curves in the specified collection and their associated weights into this LinearComboCurve at the specified position.booleanaddAll(Curve[] arr)Appends all of the curves in the specified array to this LinearComboCurve with a default weight of 1.0 assigned to each.booleanaddAll(java.util.Collection<? extends Curve> curves)Adds all of the curves in the specified collection to this LinearComboCurve with a default weight of 1.0 for each.booleanaddAll(java.util.Collection<? extends Curve> curves, java.util.Collection<java.lang.Double> weights)Appends all of the curves in the specified collection to this LinearComboCurve.voidclear()Removes all of the curves from this linear combination.booleancontains(java.lang.Object o)Returns true if this LinearComboCurve contains the specifiedCurve.booleancontainsAll(java.util.Collection<?> c)Returns true if this collection contains all of theCurveobjects in the specified collection.booleancontainsGeometry()Returnstrueif this list actually contains any curves andfalseif this list is empty.LinearComboCurvecopy()Returns a copy of thisLinearComboCurveinstanceallocatedby the calling thread (possibly on the stack).LinearComboCurvecopyToReal()Return a copy of this object with any transformations or subranges removed (applied).booleanequals(java.lang.Object obj)Compares the specified object with this list ofCurveobjects for equality.Curveget(int index)Returns the Curve at the specified position in this LinearComboCurve.Curveget(java.lang.String name)Returns theCurvewith the specified name from this list.GeomList<Curve>getAll()Returns an newGeomListwith all the curves in this list.PointgetBoundsMax()Return the coordinate point representing the maximum bounding box corner (e.g.: max X, max Y, max Z).PointgetBoundsMin()Return the coordinate point representing the minimum bounding box corner of this geometry element (e.g.: min X, min Y, min Z).CurvegetFirst()Returns the first curve from this LinearComboCurve.java.lang.DoublegetFirstWeight()Returns the first linear combination weight from this LinearComboCurve.intgetIndexFromName(java.lang.String name)Return the index to the 1st Curve in this list with the specified name.CurvegetLast()Returns the last curve from this LinearComboCurve list of curves.java.lang.DoublegetLastWeight()Returns the last linear combination weight from this LinearComboCurve.intgetPhyDimension()Returns the number of physical dimensions of the geometry element.LinearComboCurvegetRange(int first, int last)Returns the range of Curves in this LinearComboCurve from the specified start and ending indexes as a new LinearComboCurve.PointgetRealPoint(double s)Calculate a point on the curve for the given parametric distance along the curve.java.util.List<Vector<javax.measure.quantity.Length>>getSDerivatives(double s, int grade)Calculate all the derivatives from0togradewith respect to parametric distance on the curve for the given parametric distance along the curve,d^{grade}p(s)/d^{grade}s.LinearComboCurvegetTransformed(GTransform transform)Returns a transformed version of this element.javax.measure.unit.Unit<javax.measure.quantity.Length>getUnit()Returns the unit in which the curves in this linear combination curve are stated.java.lang.DoublegetWeight(int index)Returns the linear combination weight at the specified position in this LinearComboCurve.java.util.List<java.lang.Double>getWeightRange(int first, int last)Returns the range of linear combination weights in this LinearComboCurve from the specified start and ending indexes as a List of double values.inthashCode()Returns the hash code for thisLinearComboCurve.intindexOf(java.lang.Object element)Returns the index in this list of the first occurrence of the specifiedCurve, or -1 if the list does not contain this curve.booleanisEmpty()Returnstrueif this collection contains no elements.booleanisValid()Returntrueif this LinearComboCurve contains valid and finite numerical components.java.util.Iterator<Curve>iterator()Returns an iterator over the curves in this LinearComboCurve.intlastIndexOf(java.lang.Object element)Returns the index in this list of the last occurrence of the specifiedCurve, or -1 if the list does not contain this curve.java.util.ListIterator<Curve>listIterator()Returns a list iterator over the curves in this LinearComboCurve.java.util.ListIterator<Curve>listIterator(int index)Returns a Curve list iterator from the specified position.static LinearComboCurvenewInstance()Returns a new, empty, preallocated or recycledLinearComboCurveinstance (on the stack when executing in aStackContext), that can store a list ofCurveobjects and associated weighting factors.static LinearComboCurvenewInstance(java.lang.String name)Returns a new, empty, preallocated or recycledLinearComboCurveinstance (on the stack when executing in aStackContext), that can store a list ofCurveobjects and associated weighting factors.static voidrecycle(LinearComboCurve instance)Recycles a case instance immediately (on the stack when executing in a StackContext).Curveremove(int index)Removes the curve (and its associated weight) at the specified position in this LinearComboCurve.booleanremove(java.lang.Object o)Removes a single instance of the specifiedCurve(and its associated weight) from this collection, if it is present.Curveremove(java.lang.String name)Removes the curve with the specified name from this list.booleanremoveAll(java.util.Collection<?> c)Removes from this list all theCurveobjects that are contained in the specified collection.voidreset()Resets the internal state of this object to its default values.booleanretainAll(java.util.Collection<?> c)Retains only the curves in this list that are contained in the specified collection.LinearComboCurvereverse()Return a new curve that is identical to this one, but with the parameterization reversed.Curveset(int index, Curve curve)Replaces the Curve at the specified position in this list of curves with the specified Curve.Curveset(int index, Curve curve, java.lang.Double weight)Replaces the Curve and weight at the specified position in this LinearComboCurve with the specified curve and weight.java.lang.DoublesetWeight(int index, java.lang.Double weight)Replaces the weight at the specified position in this LinearComboCurve with the specified weight.intsize()Returns the number ofCurveobjects that make up this linear combination curve.GeomList<LinearComboCurve>splitAt(double s)Split this curve at the specified parametric position returning a list containing two curves (a lower curve with smaller parametric positions than "s" and an upper curve with larger parametric positions).LinearComboCurvesubList(int fromIndex, int toIndex)Returns a view of the portion of this LinearComboCurve between fromIndex, inclusive, and toIndex, exclusive.LinearComboCurveto(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)Returns the equivalent to this LinearComboCurve but stated in the specified unit.Curve[]toArray()Returns an array containing all of the curves in this collection.<T> T[]toArray(T[] a)Returns an array containing all of the curves in this collection.LinearComboCurvetoDimension(int newDim)Return the equivalent of this LinearComboCurve converted to the specified number of physical dimensions.NurbsCurvetoNurbs(Parameter<javax.measure.quantity.Length> tol)Return a NURBS curve representation of this curve to within the specified tolerance.javolution.text.TexttoText()Returns the text representation of this geometry element.java.util.List<Curve>unmodifiableList()Returns an unmodifiable list view of the curves in this list.java.util.List<java.lang.Double>unmodifiableWeightList()Returns an unmodifiable list view of the weights in this list.static LinearComboCurvevalueOf(Curve... curves)Return a LinearComboCurve made up of theCurveobjects in the specified array each with a default weight of 1.0.static LinearComboCurvevalueOf(java.util.Collection<? extends Curve> curves, double... weights)Return a LinearComboCurve made up of theCurveand weight objects in the specified collections.static LinearComboCurvevalueOf(java.util.Collection<? extends Curve> curves, java.util.Collection<java.lang.Double> weights)Return a LinearComboCurve made up of theCurveand weight objects in the specified collections.-
Methods inherited from class geomss.geom.AbstractCurve
extractGrid, getArcLength, getArcLength, getArcLength, getBinormal, getBinormal, getClosest, getClosest, getClosest, getClosest, getClosest, getClosest, getCurvature, getCurvature, getDerivatives, getEnclosedArea, getFarthest, getFarthest, getFarthest, getLimitPoint, getParDimension, getPoint, getPoint, getPointAtArcLength, getPrincipalNormal, getPrincipalNormal, getRealPoint, getSDerivative, getSDerivatives, getTangencyPoint, getTangent, getTangent, getTorsion, getTorsion, getVariationOfCurvature, getVariationOfCurvature, gridToTolerance, intersect, intersect, intersect, intersect, intersect, isCircular, isDegenerate, isLine, isPlanar, splitAt
-
Methods inherited from class geomss.geom.AbstractGeomElement
addChangeListener, clone, compareTo, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName, toString
-
Methods inherited from interface geomss.geom.GeomElement
addChangeListener, getAllUserData, getID, getLimitPoint, getName, getParDimension, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName
-
-
-
-
Method Detail
-
newInstance
public static LinearComboCurve newInstance()
Returns a new, empty, preallocated or recycledLinearComboCurveinstance (on the stack when executing in aStackContext), that can store a list ofCurveobjects and associated weighting factors. The list is initially empty and therefore the linear combination is initially undefined.- Returns:
- A new empty LinearComboCurve.
-
newInstance
public static LinearComboCurve newInstance(java.lang.String name)
Returns a new, empty, preallocated or recycledLinearComboCurveinstance (on the stack when executing in aStackContext), that can store a list ofCurveobjects and associated weighting factors. The list is initially empty and therefore the linear combination is initially undefined.- Parameters:
name- The name to be assigned to this LinearComboCurve (may be null).- Returns:
- A new empty LinearComboCurve.
-
valueOf
public static LinearComboCurve valueOf(java.util.Collection<? extends Curve> curves, java.util.Collection<java.lang.Double> weights)
Return a LinearComboCurve made up of theCurveand weight objects in the specified collections.- Parameters:
curves- A collection of curves that define the LinearComboCurve. May not be null.weights- A collection of weights (one for each curve). May not be null and must have the same size as "curves".- Returns:
- A new LinearComboCurve made up of the curves and weights in the specified collections.
-
valueOf
public static LinearComboCurve valueOf(java.util.Collection<? extends Curve> curves, double... weights)
Return a LinearComboCurve made up of theCurveand weight objects in the specified collections.- Parameters:
curves- A collection of curves that define the LinearComboCurve. May not be null.weights- An array of weights (one for each curve). May not be null and must have the same size as "curves".- Returns:
- A new LinearComboCurve made up of the curves and weights in the specified collections.
-
valueOf
public static LinearComboCurve valueOf(Curve... curves)
Return a LinearComboCurve made up of theCurveobjects in the specified array each with a default weight of 1.0.- Parameters:
curves- An array of curves that define the LinearComboCurve. May not be null.- Returns:
- A new LinearComboCurve made up of the curves in the specified array each with a default weight of 1.0.
-
unmodifiableList
public java.util.List<Curve> unmodifiableList()
Returns an unmodifiable list view of the curves in this list. Attempts to modify the returned collection result in an UnsupportedOperationException being thrown.- Specified by:
unmodifiableListin interfaceGeometryList<LinearComboCurve,Curve>- Returns:
- the unmodifiable view over this list of curves.
-
unmodifiableWeightList
public java.util.List<java.lang.Double> unmodifiableWeightList()
Returns an unmodifiable list view of the weights in this list. Attempts to modify the returned collection result in an UnsupportedOperationException being thrown.- Specified by:
unmodifiableWeightListin interfaceLinearCombination<LinearComboCurve,Curve>- Returns:
- the unmodifiable view over this list of weights.
-
isEmpty
public boolean isEmpty()
Returnstrueif this collection contains no elements.
-
containsGeometry
public boolean containsGeometry()
Returnstrueif this list actually contains any curves andfalseif this list is empty.- Specified by:
containsGeometryin interfaceGeometryList<LinearComboCurve,Curve>- Returns:
- true if this list actually contains geometry.
-
size
public int size()
Returns the number ofCurveobjects that make up this linear combination curve. If the surface contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.- Specified by:
sizein interfacejava.util.Collection<Curve>- Specified by:
sizein interfaceGeomElement<LinearComboCurve>- Specified by:
sizein interfacejava.util.List<Curve>- Returns:
- the number of elements in this list of curves.
-
get
public Curve get(int index)
Returns the Curve at the specified position in this LinearComboCurve.- Specified by:
getin interfacejava.util.List<Curve>- Parameters:
index- index of curve to return (0 returns the 1st element, -1 returns the last, -2 returns the 2nd from last, etc).- Returns:
- the Curve at the specified position in this LinearComboCurve.
- Throws:
java.lang.IndexOutOfBoundsException- if the given index is out of range:index > size()
-
getWeight
public java.lang.Double getWeight(int index)
Returns the linear combination weight at the specified position in this LinearComboCurve.- Specified by:
getWeightin interfaceLinearCombination<LinearComboCurve,Curve>- Parameters:
index- index of weight to return (0 returns the 1st element, -1 returns the last, -2 returns the 2nd from last, etc).- Returns:
- the linear combination weight at the specified position in this LinearComboCurve.
- Throws:
java.lang.IndexOutOfBoundsException- if the given index is out of range:index > size()
-
getFirst
public Curve getFirst()
Returns the first curve from this LinearComboCurve.- Specified by:
getFirstin interfaceGeometryList<LinearComboCurve,Curve>- Returns:
- the first curve in this list.
-
getFirstWeight
public java.lang.Double getFirstWeight()
Returns the first linear combination weight from this LinearComboCurve.- Specified by:
getFirstWeightin interfaceLinearCombination<LinearComboCurve,Curve>- Returns:
- the first weight in this list.
-
getLast
public Curve getLast()
Returns the last curve from this LinearComboCurve list of curves.- Specified by:
getLastin interfaceGeometryList<LinearComboCurve,Curve>- Returns:
- the last curve in this list.
-
getLastWeight
public java.lang.Double getLastWeight()
Returns the last linear combination weight from this LinearComboCurve.- Specified by:
getLastWeightin interfaceLinearCombination<LinearComboCurve,Curve>- Returns:
- the last weight in this list.
-
getRange
public LinearComboCurve getRange(int first, int last)
Returns the range of Curves in this LinearComboCurve from the specified start and ending indexes as a new LinearComboCurve.- Specified by:
getRangein interfaceGeometryList<LinearComboCurve,Curve>- Parameters:
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).- Returns:
- A LinearComboCurve made up of the curves in the given range from this LinearComboCurve.
- Throws:
java.lang.IndexOutOfBoundsException- if the given index is out of range:index ≥ size()
-
getWeightRange
public java.util.List<java.lang.Double> getWeightRange(int first, int last)
Returns the range of linear combination weights in this LinearComboCurve from the specified start and ending indexes as a List of double values.- Specified by:
getWeightRangein interfaceLinearCombination<LinearComboCurve,Curve>- Parameters:
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).- Returns:
- A List made up of the weights in the given range from this LinearComboCurve.
- Throws:
java.lang.IndexOutOfBoundsException- if the given index is out of range:index ≥ size()
-
get
public Curve get(java.lang.String name)
Returns theCurvewith the specified name from this list.- Specified by:
getin interfaceGeometryList<LinearComboCurve,Curve>- Parameters:
name- The name of the curve we are looking for in the list.- Returns:
- The curve matching the specified name. If the specified element name
isn't found in the list, then
nullis returned.
-
subList
public LinearComboCurve subList(int fromIndex, int toIndex)
Returns a view of the portion of this LinearComboCurve between fromIndex, inclusive, and toIndex, exclusive. (If fromIndex and toIndex are equal, the returned LinearComboCurve is empty.) The returned LinearComboCurve is backed by this LinearComboCurve, so changes in the returned LinearComboCurve are reflected in this LinearComboCurve, and vice-versa. This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a list can be used as a range operation by passing a subList view instead of a whole list. For example, the following idiom removes a range of values from a list:list.subList(from, to).clear();Similar idioms may be constructed forindexOfandlastIndexOf, and all of the algorithms in theCollectionsclass can be applied to a subList. The semantics of the list returned by this method become undefined if the backing list (i.e., this list) is structurally modified in any way other than via the returned list (structural modifications are those that change the size of this list, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results).- Specified by:
subListin interfacejava.util.List<Curve>- Parameters:
fromIndex- low endpoint (inclusive) of the subList.toIndex- high endpoint (exclusive) of the subList.- Returns:
- a view of the specified range within this LinearComboCurve.
- Throws:
java.lang.IndexOutOfBoundsException- if the given index is out of range:index > size()
-
getAll
public GeomList<Curve> getAll()
Returns an newGeomListwith all the curves in this list.- Specified by:
getAllin interfaceGeometryList<LinearComboCurve,Curve>- Returns:
- A new GeomList with all the curves in this list.
-
reverse
public LinearComboCurve reverse()
Return a new curve that is identical to this one, but with the parameterization reversed.- Specified by:
reversein interfaceCurve<LinearComboCurve>- Specified by:
reversein interfaceGeometryList<LinearComboCurve,Curve>- Returns:
- A new curve that is identical to this one, but with the parameterization reversed.
-
indexOf
public int indexOf(java.lang.Object element)
Returns the index in this list of the first occurrence of the specifiedCurve, or -1 if the list does not contain this curve.- Specified by:
indexOfin interfacejava.util.List<Curve>- Parameters:
element- The Curve to search for.- Returns:
- the index in this List of the first occurrence of the specified curve, or -1 if the List does not contain this curve.
-
lastIndexOf
public int lastIndexOf(java.lang.Object element)
Returns the index in this list of the last occurrence of the specifiedCurve, or -1 if the list does not contain this curve. More formally, returns the highest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.- Specified by:
lastIndexOfin interfacejava.util.List<Curve>- Parameters:
element- The Curve to search for.- Returns:
- the index in this list of the last occurrence of the specified curve, or -1 if the list does not contain this curve.
-
contains
public boolean contains(java.lang.Object o)
Returns true if this LinearComboCurve contains the specifiedCurve. More formally, returns true if and only if this LinearComboCurve's curves contains at least one element e such that (o==null ? e==null : o.equals(e)).
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
Returns true if this collection contains all of theCurveobjects in the specified collection.- Specified by:
containsAllin interfacejava.util.Collection<Curve>- Specified by:
containsAllin interfacejava.util.List<Curve>- Parameters:
c- collection of curves to be checked for containment in this collection.- Returns:
trueif this collection contains all of the curves in the specified collection.
-
getIndexFromName
public int getIndexFromName(java.lang.String name)
Return the index to the 1st Curve in this list with the specified name.- Specified by:
getIndexFromNamein interfaceGeometryList<LinearComboCurve,Curve>- Parameters:
name- The name of the Curve to find in this list- Returns:
- The index to the named Curve or -1 if it is not found.
-
add
public void add(int index, Curve value)
Inserts the specifiedCurveat the specified position in this list with a default weight of 1.0. 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 value 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 table is not thread-safe).
- Specified by:
addin interfacejava.util.List<Curve>- Parameters:
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 Curve to be inserted with a default weight of 1.0.- Throws:
java.lang.IndexOutOfBoundsException- ifindex > size()DimensionException- if the input value dimensions are different from this list's dimensions.
-
add
public void add(int index, Curve curve, java.lang.Double weight)
Inserts the specifiedCurveat 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 curve 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 table is not thread-safe).
- Specified by:
addin interfaceLinearCombination<LinearComboCurve,Curve>- Parameters:
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).curve- The Curve to be inserted. May not be null.weight- The linear combination weight of the curve to be inserted. May not be null.- Throws:
java.lang.IndexOutOfBoundsException- ifindex > size()DimensionException- if the input curve dimensions are different from this list's dimensions.
-
add
public boolean add(Curve curve)
Appends the specifiedCurveto the end of this LinearComboCurve with a default weight of 1.0. Null values are ignored. The input curve 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 table is not thread-safe).
- Specified by:
addin interfacejava.util.Collection<Curve>- Specified by:
addin interfacejava.util.List<Curve>- Parameters:
curve- The curve to be appended to this list with a default weight of 1.0. May not be null.- Returns:
- true if this list changed as a result of this call.
- Throws:
DimensionException- if the input element's dimensions are different from this list's dimensions.DimensionException- if the input curve dimensions are different from this list's dimensions.
-
add
public boolean add(Curve curve, java.lang.Double weight)
Appends the specifiedCurveto the end of this list of curves. Null values are ignored. The input curve 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 table is not thread-safe).
- Specified by:
addin interfaceLinearCombination<LinearComboCurve,Curve>- Parameters:
curve- The curve to be appended to this list. May not be null.weight- The linear combination weight of the curve to be appended. May not be null.- Returns:
- true if this list changed as a result of this call.
- Throws:
DimensionException- if the input element's dimensions are different from this list's dimensions.DimensionException- if the input curve dimensions are different from this list's dimensions.
-
add
public boolean add(Curve... array)
Appends all of the elements in the specified list of arguments to this LinearComboCurve with a default weight of 1.0 assigned to each. The input curve must have the same physical dimensions as the other items in this list, or an exception is thrown.- Specified by:
addin interfaceGeometryList<LinearComboCurve,Curve>- Parameters:
array- the curves to be inserted into this collection with a default weight of 1.0 assigned to each. May not be null.- Returns:
trueif this collection changed as a result of the call.- Throws:
DimensionException- if the input curve dimensions are different from this list's dimensions.
-
add
public boolean add(int index, Curve... array)
Inserts all of theCurveobjects in the specified list of arguments into this LinearComboCurve at the specified position with a default weight of 1.0 assigned to each. 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 appeared in the array. The input curve must have the same physical dimensions as the other items in this list, or an exception is thrown.- Specified by:
addin interfaceGeometryList<LinearComboCurve,Curve>- Parameters:
index- index at which to insert first element from the specified array.array- the curves to be inserted into this collection with a default weight of 1.0 for each. May not be null.- Returns:
trueif this collection changed as a result of the call.- Throws:
DimensionException- if the input curve dimensions are different from this list's dimensions.
-
addAll
public boolean addAll(java.util.Collection<? extends Curve> curves)
Adds all of the curves in the specified collection to this LinearComboCurve with a default weight of 1.0 for each. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. This implies that the behavior of this call is undefined if the specified collection is this collection, and this collection is nonempty. The input curves must have the same physical dimensions as the other items in this list, or an exception is thrown.- Specified by:
addAllin interfacejava.util.Collection<Curve>- Specified by:
addAllin interfacejava.util.List<Curve>- Parameters:
curves- curves to be inserted into this list with a default of 1.0 for each. May not be null.- Returns:
trueif this LinearComboCurve changed as a result of the call- Throws:
DimensionException- if the input curve dimensions are different from this list's dimensions.
-
addAll
public boolean addAll(int index, java.util.Collection<? extends Curve> curves)
Inserts all of the curves in the specified collection of curves into this LinearComboCurve with default weights of 1.0 for each. Shifts the curve currently at that position (if any) and any subsequent curves to the right (increases their indices). The new curves 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 curves must have the same physical dimensions as the other items in this list, or an exception is thrown.- Specified by:
addAllin interfacejava.util.List<Curve>- Parameters:
index- index at which to insert first curve from the specified collection.curves- curves to be inserted into this list with default weights of 1.0 for each. May not be null.- Returns:
trueif this LinearComboCurve changed as a result of the call- Throws:
DimensionException- if the input curve dimensions are different from this list's dimensions.
-
addAll
public boolean addAll(java.util.Collection<? extends Curve> curves, java.util.Collection<java.lang.Double> weights)
Appends all of the curves in the specified collection to this LinearComboCurve. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. This implies that the behavior of this call is undefined if the specified collection is this collection, and this collection is nonempty. The input curves must have the same physical dimensions as the other items in this list, or an exception is thrown.- Specified by:
addAllin interfaceLinearCombination<LinearComboCurve,Curve>- Parameters:
curves- the curves to be appended onto this list of curves. May not be null.weights- the linear combination weights associated with all of the curves being appended. May not be null and must be the same size as "curves".- Returns:
trueif this LinearComboCurve changed as a result of the call- Throws:
DimensionException- if the input curve dimensions are different from this list's dimensions.
-
addAll
public boolean addAll(int index, java.util.Collection<? extends Curve> curves, java.util.Collection<java.lang.Double> weights)
Inserts all of the curves in the specified collection and their associated weights into this LinearComboCurve at the specified position. Shifts the curve currently at that position (if any) and any subsequent curves to the right (increases their indices). The new curves 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 curves must have the same physical dimensions as the other items in this list, or an exception is thrown.- Specified by:
addAllin interfaceLinearCombination<LinearComboCurve,Curve>- Parameters:
index- index at which to insert first curve from the specified collection.curves- the curves to be inserted into this linear combination. May not be null.weights- the linear combination weights associated with each curve being inserted. May not be null and must be the same size as "curves".- Returns:
trueif this LinearComboCurve changed as a result of the call- Throws:
DimensionException- if the input curve dimensions are different from this list's dimensions.
-
addAll
public boolean addAll(Curve[] arr)
Appends all of the curves in the specified array to this LinearComboCurve with a default weight of 1.0 assigned to each. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. The input curves must have the same physical dimensions as the other items in this list, or an exception is thrown.- Specified by:
addAllin interfaceGeometryList<LinearComboCurve,Curve>- Parameters:
arr- curves to be appended onto this collection with a default weight of 1.0 for each. May not be null.- Returns:
trueif this collection changed as a result of the call.- Throws:
DimensionException- if the input curve dimensions are different from this list's dimensions.
-
addAll
public boolean addAll(int index, Curve[] arr)
Inserts all of theCurveobjects in the specified array into this LinearComboCurve at the specified position with a default weight of 1.0 assigned to each. 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 input curves must have the same physical dimensions as the other items in this list, or an exception is thrown.- Specified by:
addAllin interfaceGeometryList<LinearComboCurve,Curve>- Parameters:
index- index at which to insert first element from the specified array.arr- the curves to be inserted into this collection with a default weight of 1.0 for each. May not be null.- Returns:
trueif this collection changed as a result of the call.- Throws:
DimensionException- if the input curve dimensions are different from this list's dimensions.
-
set
public Curve set(int index, Curve curve)
Replaces the Curve at the specified position in this list of curves with the specified Curve. The weight at that position is left unchanged. Null elements are ignored. The input curve must have the same physical dimensions as the other items in this list, or an exception is thrown.- Specified by:
setin interfacejava.util.List<Curve>- Parameters:
index- The index of the curve to replace (0 returns the 1st curve, -1 returns the last, -2 returns the 2nd from last, etc).curve- The curve to be stored at the specified position. The weight at that position is left unchanged. May not be null.- Returns:
- The curve previously at the specified position in this list.
- Throws:
java.lang.IndexOutOfBoundsException- - ifindex > size()DimensionException- if the input curve dimensions are different from this list's dimensions.
-
setWeight
public java.lang.Double setWeight(int index, java.lang.Double weight)
Replaces the weight at the specified position in this LinearComboCurve with the specified weight. The curve at that position is left unchanged. Null elements are ignored.- Specified by:
setWeightin interfaceLinearCombination<LinearComboCurve,Curve>- Parameters:
index- The index of the weight to replace (0 returns the 1st element, -1 returns the last, -2 returns the 2nd from last, etc).weight- The weight to be stored at the specified position. The curve at that position is left unchanged. May not be null.- Returns:
- The weight previously at the specified position in this list.
- Throws:
java.lang.IndexOutOfBoundsException- - ifindex > size()
-
set
public Curve set(int index, Curve curve, java.lang.Double weight)
Replaces the Curve and weight at the specified position in this LinearComboCurve with the specified curve and weight. Null elements are ignored. The input curve must have the same physical dimensions as the other items in this list, or an exception is thrown.- Specified by:
setin interfaceLinearCombination<LinearComboCurve,Curve>- Parameters:
index- The index of the curve and weight to replace (0 returns the 1st element, -1 returns the last, -2 returns the 2nd from last, etc).curve- The curve to be stored at the specified position. May not be null.weight- The weight to be stored at the specified position. May not be null.- Returns:
- The curve previously at the specified position in this list. The previous weight is lost.
- Throws:
java.lang.IndexOutOfBoundsException- - ifindex > size()DimensionException- if the input curve dimensions are different from this list's dimensions.
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
Removes from this list all theCurveobjects that are contained in the specified collection.
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
Retains only the curves in this list that are contained in the specified collection. In other words, removes from this LinearComboCurve all theCurveobjects that are not contained in the specified collection.
-
remove
public boolean remove(java.lang.Object o)
Removes a single instance of the specifiedCurve(and its associated weight) from this collection, if it is present. More formally, removes an element e such that (o==null ? e==null : o.equals(e)), if this collection contains one or more such elements. Returns true if this collection contained the specified curve (or equivalently, if this collection changed as a result of the call).
-
remove
public Curve remove(int index)
Removes the curve (and its associated weight) at the specified position in this LinearComboCurve. Shifts any subsequent curves and weights to the left (subtracts one from their indices). Returns the curve that was removed from the list; the removed weight is lost.- Specified by:
removein interfacejava.util.List<Curve>- Parameters:
index- the index of the curve and weight to remove. (0 returns the 1st element, -1 returns the last, -2 returns the 2nd from last, etc).- Returns:
- the curve previously at the specified position.
-
remove
public Curve remove(java.lang.String name)
Removes the curve with the specified name from this list. Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.- Specified by:
removein interfaceGeometryList<LinearComboCurve,Curve>- Parameters:
name- the name of the element to remove.- Returns:
- the element previously at the specified position.
-
clear
public void clear()
Removes all of the curves from this linear combination. The linear combination will be empty and undefined after this call returns.
-
iterator
public java.util.Iterator<Curve> iterator()
Returns an iterator over the curves in this LinearComboCurve.
-
listIterator
public java.util.ListIterator<Curve> listIterator()
Returns a list iterator over the curves in this LinearComboCurve.- Specified by:
listIteratorin interfacejava.util.List<Curve>- Returns:
- an iterator over this list of curves.
-
listIterator
public java.util.ListIterator<Curve> listIterator(int index)
Returns a Curve list iterator from the specified position.- Specified by:
listIteratorin interfacejava.util.List<Curve>- Parameters:
index- the index of first Curve to be returned from the list iterator (by a call to the next method).- Returns:
- a list iterator of the curves in this list starting at the specified position in this list.
-
toArray
public <T> T[] toArray(T[] a)
Returns an array containing all of the curves in this collection. If the collection fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this collection.- Specified by:
toArrayin interfacejava.util.Collection<Curve>- Specified by:
toArrayin interfacejava.util.List<Curve>- Type Parameters:
T- The type of elements in this LinearComboCurve (Curve type).- Parameters:
a- the array into which the elements of the collection are to be stored, if it is big enough; otherwise, a new array of the same type is allocated for this purpose.- Returns:
- an array containing the curves of this collection.
-
getPhyDimension
public int getPhyDimension()
Returns the number of physical dimensions of the geometry element. This implementation always returns the physical dimension of the underlying Curve objects or 0 if this list has no Curve objects in it.- Specified by:
getPhyDimensionin interfaceGeomElement<LinearComboCurve>- Returns:
- The number of physical dimensions of the geometry element.
-
getRealPoint
public Point getRealPoint(double s)
Calculate a point on the curve for the given parametric distance along the curve.- Specified by:
getRealPointin interfaceCurve<LinearComboCurve>- Parameters:
s- parametric distance to calculate a point for (0.0 to 1.0 inclusive).- Returns:
- the calculated point
-
getSDerivatives
public java.util.List<Vector<javax.measure.quantity.Length>> getSDerivatives(double s, int grade)
Calculate all the derivatives from0togradewith respect to parametric distance on the curve for the given parametric distance along the curve,d^{grade}p(s)/d^{grade}s.Example:
1st derivative (grade = 1), this returns[p(s), dp(s)/ds];
2nd derivative (grade = 2), this returns[p(s), dp(s)/ds, d^2p(s)/d^2s]; etc.- Specified by:
getSDerivativesin interfaceCurve<LinearComboCurve>- Parameters:
s- Parametric distance to calculate derivatives for (0.0 to 1.0 inclusive).grade- The maximum grade to calculate the derivatives for (1=1st derivative, 2=2nd derivative, etc)- Returns:
- A list of derivatives up to the specified grade of the curve at the specified parametric position.
- Throws:
java.lang.IllegalArgumentException- if the grade is < 0.
-
splitAt
public GeomList<LinearComboCurve> splitAt(double s)
Split this curve at the specified parametric position returning a list containing two curves (a lower curve with smaller parametric positions than "s" and an upper curve with larger parametric positions).- Specified by:
splitAtin interfaceCurve<LinearComboCurve>- Parameters:
s- The parametric position where this curve should be split (must not be 0 or 1!).- Returns:
- A list containing two curves: 0 == the lower curve, 1 == the upper curve.
-
isValid
public boolean isValid()
Returntrueif this LinearComboCurve contains valid and finite numerical components. A value offalsewill be returned if any of the coordinate values or weights are NaN or Inf.- Specified by:
isValidin interfaceGeomElement<LinearComboCurve>- Returns:
- true if this line segment contains valid and finite data.
-
getTransformed
public LinearComboCurve getTransformed(GTransform transform)
Returns a transformed version of this element. The returned list of objects implementGeomTransformand contains transformed versions of the contents of this list as children.- Specified by:
getTransformedin interfaceTransformable<LinearComboCurve>- Parameters:
transform- The transformation to apply to this geometry. May not be null.- Returns:
- A new LinearCombonCurve that is identical to this one with the specified transformation applied to member curves.
- Throws:
DimensionException- if this surface is not 3D.
-
getBoundsMin
public Point getBoundsMin()
Return the coordinate point representing the minimum bounding box corner of this geometry element (e.g.: min X, min Y, min Z).- Specified by:
getBoundsMinin interfaceGeomElement<LinearComboCurve>- Returns:
- The minimum bounding box coordinate for this geometry element.
- Throws:
java.lang.IndexOutOfBoundsException- if this list contains no geometry.
-
getBoundsMax
public Point getBoundsMax()
Return the coordinate point representing the maximum bounding box corner (e.g.: max X, max Y, max Z).- Specified by:
getBoundsMaxin interfaceGeomElement<LinearComboCurve>- Returns:
- The maximum bounding box coordinate for this geometry element.
- Throws:
java.lang.IndexOutOfBoundsException- if this list contains no elements.
-
getUnit
public javax.measure.unit.Unit<javax.measure.quantity.Length> getUnit()
Returns the unit in which the curves in this linear combination curve are stated.- Specified by:
getUnitin interfaceGeomElement<LinearComboCurve>- Returns:
- The unit in which the curves in this LinearComboCurve are stated or the default unit if this surface has no member curves.
-
to
public LinearComboCurve to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit) throws javax.measure.converter.ConversionException
Returns the equivalent to this LinearComboCurve but stated in the specified unit.- Specified by:
toin interfaceCurve<LinearComboCurve>- Specified by:
toin interfaceGeomElement<LinearComboCurve>- Specified by:
toin interfaceGeometryList<LinearComboCurve,Curve>- Specified by:
toin interfaceParametricGeometry<LinearComboCurve>- Parameters:
unit- the length unit of the curve to be returned. May not be null.- Returns:
- an equivalent to this LinearComboCurve but stated in the specified unit.
- Throws:
javax.measure.converter.ConversionException- if the the input unit is not a length unit.
-
toDimension
public LinearComboCurve toDimension(int newDim)
Return the equivalent of this LinearComboCurve converted to the specified number of physical dimensions. If the number of dimensions is greater than this element, then zeros are added to the additional dimensions. If the number of dimensions is less than this element, then the extra dimensions are simply dropped (truncated). If the new dimensions are the same as the dimension of this element, then this element is simply returned.- Specified by:
toDimensionin interfaceCurve<LinearComboCurve>- Specified by:
toDimensionin interfaceGeomElement<LinearComboCurve>- Specified by:
toDimensionin interfaceGeometryList<LinearComboCurve,Curve>- Specified by:
toDimensionin interfaceParametricGeometry<LinearComboCurve>- Parameters:
newDim- The dimension of the curve to return.- Returns:
- This LinearComboCurve converted to the new dimensions.
-
toNurbs
public NurbsCurve toNurbs(Parameter<javax.measure.quantity.Length> tol)
Return a NURBS curve representation of this curve to within the specified tolerance.- Specified by:
toNurbsin interfaceCurve<LinearComboCurve>- Parameters:
tol- The greatest possible difference between this curve and the NURBS representation returned. May not be null.- Returns:
- A NURBS curve that represents this curve to within the specified tolerance.
-
toText
public javolution.text.Text toText()
Returns the text representation of this geometry element.- Specified by:
toTextin interfaceGeomElement<LinearComboCurve>- Overrides:
toTextin classAbstractGeomElement<LinearComboCurve>- Returns:
- the text representation of this geometry element.
-
equals
public boolean equals(java.lang.Object obj)
Compares the specified object with this list ofCurveobjects for equality. Returns true if and only if both collections are of the same type and both collections contain equal elements in the same order.- Specified by:
equalsin interfacejava.util.Collection<Curve>- Specified by:
equalsin interfacejava.util.List<Curve>- Overrides:
equalsin classAbstractGeomElement<LinearComboCurve>- Parameters:
obj- the object to compare with.- Returns:
trueif this list is identical to that list;falseotherwise.
-
hashCode
public int hashCode()
Returns the hash code for thisLinearComboCurve.- Specified by:
hashCodein interfacejava.util.Collection<Curve>- Specified by:
hashCodein interfacejava.util.List<Curve>- Overrides:
hashCodein classAbstractGeomElement<LinearComboCurve>- Returns:
- the hash code value.
-
copy
public LinearComboCurve copy()
Returns a copy of thisLinearComboCurveinstanceallocatedby the calling thread (possibly on the stack).- Specified by:
copyin interfaceCurve<LinearComboCurve>- Specified by:
copyin interfaceGeomElement<LinearComboCurve>- Specified by:
copyin interfaceParametricGeometry<LinearComboCurve>- Returns:
- an identical and independent copy of this object.
-
copyToReal
public LinearComboCurve copyToReal()
Return a copy of this object with any transformations or subranges removed (applied).- Specified by:
copyToRealin interfaceCurve<LinearComboCurve>- Specified by:
copyToRealin interfaceGeomElement<LinearComboCurve>- Returns:
- A copy of this object with any transformations or subranges removed.
-
reset
public void reset()
Resets the internal state of this object to its default values. Subclasses that override this method must callsuper.reset();to ensure that the state is reset properly.- Specified by:
resetin interfacejavolution.lang.Reusable- Overrides:
resetin classAbstractGeomElement<LinearComboCurve>
-
recycle
public static void recycle(LinearComboCurve instance)
Recycles a case instance immediately (on the stack when executing in a StackContext).- Parameters:
instance- The instance to be recycled.
-
-