public class Spline
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Spline.SetPathMode |
Modifier and Type | Field and Description |
---|---|
protected double[][] |
box |
protected java.util.ArrayList<Segment> |
segments |
Constructor and Description |
---|
Spline()
general constructor
|
Spline(java.util.ArrayList<Spline> splines)
constructs a spline made of other spline
|
Spline(double[] x1,
double[] x2)
constructs a spline composed of a single linear segmen
|
Modifier and Type | Method and Description |
---|---|
protected void |
addCubicSegment(double[] x1,
double[] p1,
double[] p2,
double[] x2,
boolean reverse) |
protected void |
addLinearSegment(double[] x1,
double[] x2,
boolean reverse) |
protected void |
addSmoothSegments(java.util.ArrayList<double[]> points,
boolean reverse) |
double |
area() |
double[] |
centroid(int segment) |
void |
computeBoundingBox() |
void |
computeLength() |
double |
evalT(double[] pos)
Returns parametric t for pos if on line
|
double[] |
firstPoint() |
double[][] |
getBox() |
double[] |
getPoint(int i) |
Segment |
getSegment(int i) |
java.util.ArrayList<Segment> |
getSegments() |
double[] |
intersect(Spline s2)
Intersects two splines and returns intersection parametric t
Considers entire spline rang
|
double[] |
intersect(Spline s2,
int start_p,
int end_p)
Intersects the spline with another and returns intersection parametric t
only considers segments between start_p and end_p, inclusive
|
double |
intersect0(Spline s2)
Intersects two splines and returns intersection parametric t for this spline
Considers entire spline rang
|
boolean |
isInternal(double[] xp) |
static boolean |
isInternal(double[] xp,
Segment segment) |
double[] |
lastPoint() |
double |
nodeArea(int i) |
double[] |
normal(double t) |
int |
numPoints() |
int |
numSegments() |
double[] |
pos(double t)
Evaluates position given by parametric position
|
double[] |
randomPos() |
double |
randomT() |
protected double |
randomTforRZ() |
protected void |
reverseSegmentOrdering() |
double |
segmentArea(int i) |
void |
setPath(java.lang.String path,
Matrix T,
boolean flip_normals)
Sets the spline using a SVG-like path syntax:
M x y : moves the current position to x y
L x y : creates a linear segment from current position to (x,y)
C k1x k1y k2x k2y x y : creates a cubic segment from current position to (x,y) using knots k1 and k2
S x y : creates a smooth segment from current position to (x,y)
Z : adds discontinuity into the spline
Unlike SVG, the cubic path is specified only by the final position.
|
double[] |
splitSpline(int nn,
boolean reverse)
this function returns an array of parametric position [0,1] that split
a multisegment spline into nn-1 segments.
|
double |
stripArea(double t1,
double t2) |
double[] |
tangent(double t) |
Segment |
visibleSegment(double[] xp) |
static Segment |
visibleSegment(double[] xp,
java.util.ArrayList<Segment> segments) |
protected java.util.ArrayList<Segment> segments
protected double[][] box
public Spline()
public Spline(java.util.ArrayList<Spline> splines)
spliness
- public Spline(double[] x1, double[] x2)
x1
- x2t
- public double[][] getBox()
public void setPath(java.lang.String path, Matrix T, boolean flip_normals)
path
- path definition in SVG format, also supports boundary:[first|last]T
- tranformation matrixflip_normals
- true if connectivity should be reversed (flip normals)protected void reverseSegmentOrdering()
protected void addLinearSegment(double[] x1, double[] x2, boolean reverse)
x1
- x2
- reverse
- protected void addCubicSegment(double[] x1, double[] p1, double[] p2, double[] x2, boolean reverse)
x1
- p1
- p2
- x2
- reverse
- protected void addSmoothSegments(java.util.ArrayList<double[]> points, boolean reverse)
points
- reverse
- public final void computeBoundingBox()
public double[] firstPoint()
public double[] lastPoint()
public double[] getPoint(int i)
i
- * @return i-th pointpublic Segment getSegment(int i)
i
- * @return i-th segmentpublic java.util.ArrayList<Segment> getSegments()
public int numSegments()
public int numPoints()
public final void computeLength()
public double nodeArea(int i)
i
- * @return node area, area centered around the nodepublic double segmentArea(int i)
i
- * @return area of the segment, analogous to cell area in meshpublic double stripArea(double t1, double t2)
t1
- t2
- * @return area of a strip between two endpoints, assumes linear strippublic double area()
public double randomT()
protected double randomTforRZ()
public double[] randomPos()
public double[] pos(double t)
t
- parametric position, whole part indicates segmentpublic double evalT(double[] pos)
pos
- point position to evaluatepublic double[] intersect(Spline s2, int start_p, int end_p)
s2
- start_p
- end_p
- public double[] intersect(Spline s2)
s2e
- public double intersect0(Spline s2)
s2e
- public boolean isInternal(double[] xp)
xp
- public static boolean isInternal(double[] xp, Segment segment)
xp
- segment
- public Segment visibleSegment(double[] xp)
xp
- public static Segment visibleSegment(double[] xp, java.util.ArrayList<Segment> segments)
xp
- * @return first Boundary segment from the list visible from a point or nullsegments
- public double[] centroid(int segment)
segment
- * @return centroid of a line segmentpublic double[] normal(double t)
t
- * @return normal vectorpublic double[] tangent(double t)
t
- * @return tangent vectorpublic double[] splitSpline(int nn, boolean reverse)
nn
- reverse.
-