public class PointListConnections extends Object
PointList. The
connections are based on the indices of the points in the model, so it is
easy to apply the connections to any variant of a PointList
representing a given geometry.| Constructor and Description |
|---|
PointListConnections()
Default constructor.
|
PointListConnections(PointList pl,
List<Line2d> lines)
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConnection(int from,
int to)
Add a connection between points with the given indices.
|
void |
addConnection(PointList pl,
Line2d line)
Add a connection between the two end points of the given line in the
given
PointList. |
void |
addConnection(PointList pl,
Point2d from,
Point2d to)
Add a connection between two points in the given
PointList. |
Point2dImpl |
calculateNormal(int id,
PointList pointList)
Calculate the normal vector at a given vertex id.
|
Point2dImpl |
calculateNormal(Point2d pt,
PointList pointList)
Calculate the normal vector at a given vertex.
|
Line2d |
calculateNormalLine(int idx,
PointList pointList,
float scale)
Calculate a normal line for a given vertex.
|
Line2d |
calculateNormalLine(Point2d pt,
PointList pointList,
float scale)
Calculate a normal line for a given vertex.
|
int[] |
getConnections(int id)
Get the indices of all the points connected to the point with the given
index.
|
Point2d[] |
getConnections(Point2d pt,
PointList pl)
Get the points connected to the given point.
|
List<Line2d> |
getLines(PointList pointList)
Get the connections as a list of lines based on the points in the given
PointList. |
public PointListConnections()
public PointListConnections(PointList pl, List<Line2d> lines)
pl - the PointList.lines - the lines.public void addConnection(int from, int to)
from - first pointto - second pointpublic void addConnection(PointList pl, Point2d from, Point2d to)
PointList.pl - the PointListfrom - the first pointto - the second pointpublic void addConnection(PointList pl, Line2d line)
PointList.pl - the PointListline - the linepublic Point2d[] getConnections(Point2d pt, PointList pl)
pt - The target point.pl - The PointList in whioch to search.public int[] getConnections(int id)
id - The point to search forpublic Line2d calculateNormalLine(Point2d pt, PointList pointList, float scale)
pt - the vertexpointList - the PointList in which to search/scale - The scaling to apply to the line; a scale of 1.0 will lead to
a line that is 2.0 units long (1.0 either side of the vertex).public Line2d calculateNormalLine(int idx, PointList pointList, float scale)
idx - the vertex indexpointList - the PointList in which to search/scale - The scaling to apply to the line; a scale of 1.0 will lead to
a line that is 2.0 units long (1.0 either side of the vertex).public Point2dImpl calculateNormal(Point2d pt, PointList pointList)
pt - the vertex.pointList - the PointList in which to search.public Point2dImpl calculateNormal(int id, PointList pointList)
id - the vertex id.pointList - the PointList in which to search.