java.lang.Object
de.grogra.vecmath.geom.Variables
de.grogra.vecmath.geom.IntersectionList
This class contains a list of intersection points of a line with the
surface of a
Volume
. The list is
piecewise sorted in ascending order of distance, i.e., of
Intersection.parameter
. The congiguous
pieces are computed by
Volume.computeIntersections(de.grogra.vecmath.geom.Line, int, de.grogra.vecmath.geom.IntersectionList, de.grogra.vecmath.geom.Intersection, de.grogra.vecmath.geom.Intersection)
.- Author:
- Ole Kniemeyer
-
Field Summary
FieldsModifier and TypeFieldDescriptionContains the list of intersections.int
Specifies the number of valid intersections inelements
.Fields inherited from class de.grogra.vecmath.geom.Variables
cache, istack, tmpLine, tmpMatrix3, tmpPoint0, tmpPoint1, tmpPoint2, tmpPoint3, tmpVector0, tmpVector1, tmpVector2, tmpVector3
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppends an intersection element to this list and returns the appended instance.Appends an intersection element to this list and returns the appended instance.void
addSwap
(int index) Appends a new intersection element to this list and swaps it with the existing element atindex
.void
clear()
Clears this list so that the size is 0.int
findClosestIntersection
(double p, double maxDiff, int start, int end) Returns the index of the intersection whose parameter is closest top
.void
remove
(int start, int end) Removes the elements with indices fromstart
toend - 1
.void
setSize
(int size) Sets thesize
of this list to the specified value.toString()
-
Field Details
-
Constructor Details
-
IntersectionList
public IntersectionList()
-
-
Method Details
-
setSize
public void setSize(int size) Sets thesize
of this list to the specified value. The firstsize
elements
will contain valid instances when this method returns.- Parameters:
size
- new size of this list
-
clear
public void clear()Clears this list so that the size is 0. -
add
Appends an intersection element to this list and returns the appended instance. The parameters are used to initialize the intersection element.- Parameters:
v
- volume of intersectionl
- line of intersectionp
- line parameter of intersectiontype
- type of intersection (seeIntersection.type
)- Returns:
- newly appended intersection instance
-
add
Appends an intersection element to this list and returns the appended instance. The parameters are used to initialize the intersection element.- Parameters:
v
- volume of intersectionl
- line of intersectionp
- line parameter of intersectiontype
- type of intersection (seeIntersection.type
)face
-face
value of intersection- Returns:
- newly appended intersection instance
-
addSwap
public void addSwap(int index) Appends a new intersection element to this list and swaps it with the existing element atindex
.- Parameters:
index
- index of the element to be swapped with the new element
-
remove
public void remove(int start, int end) Removes the elements with indices fromstart
toend - 1
.- Parameters:
start
- index to start (inclusive)end
- index to end (exclusive)
-
findClosestIntersection
public int findClosestIntersection(double p, double maxDiff, int start, int end) Returns the index of the intersection whose parameter is closest top
. Only intersection elements with indices fromstart
toend - 1
and with a parameter value whose difference top
is less thanmaxDistance
are considered.- Parameters:
p
- a line parametermaxDiff
- maximum difference betweenp
and intersectionsstart
- index to start (inclusive)end
- index to end (exclusive)- Returns:
- index of closest intersection, or -1
-
toString
-