|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object GeometryUtil
public final class GeometryUtil
utility class for some useful calculations
Method Summary | ||
---|---|---|
static double |
distanceFromLine(VectorXZ p,
VectorXZ v1,
VectorXZ v2)
returns the closest distance between point p and a line defined by two points |
|
static double |
distanceFromLineSegment(VectorXZ p,
LineSegmentXZ s)
returns the closest distance between point p and line segment s |
|
static List<VectorXZ> |
distributePointsOn(long seed,
PolygonWithHolesXZ polygonWithHolesXZ,
AxisAlignedBoundingBoxXZ boundary,
double density,
double minimumDistance)
distributes points pseudo-randomly on a polygon area. |
|
static List<VectorXZ> |
equallyDistributePointsAlong(double preferredDistance,
boolean pointsAtStartAndEnd,
List<VectorXZ> points)
distributes points along a line segment sequence. |
|
static List<VectorXZ> |
equallyDistributePointsAlong(double preferredDistance,
boolean pointsAtStartAndEnd,
VectorXZ lineStart,
VectorXZ lineEnd)
distributes points along a line segment. |
|
static VectorXZ |
getLineIntersection(VectorXZ pointA,
VectorXZ directionA,
VectorXZ pointB,
VectorXZ directionB)
returns the position vector where two lines intersect. |
|
static VectorXZ |
getLineSegmentIntersection(VectorXZ pointA1,
VectorXZ pointA2,
VectorXZ pointB1,
VectorXZ pointB2)
returns the position vector where two line segments intersect. |
|
static VectorXZ |
getTrueLineSegmentIntersection(VectorXZ pointA1,
VectorXZ pointA2,
VectorXZ pointB1,
VectorXZ pointB2)
variant of getLineSegmentIntersection(VectorXZ, VectorXZ, VectorXZ, VectorXZ)
that also returns null (= does not announce an intersection)
if the two segments share an end point |
|
static PolygonXZ |
insertIntoPolygon(PolygonXZ polygon,
VectorXZ point,
double snapDistance)
returns a polygon that is constructed from a given polygon by inserting a point into one of the segments of the original polygon. |
|
static VectorXYZ |
interpolateBetween(VectorXYZ pos1,
VectorXYZ pos2,
double influenceRatioPos2)
three-dimensional version of interpolateBetween(VectorXZ, VectorXZ, double) |
|
static VectorXZ |
interpolateBetween(VectorXZ pos1,
VectorXZ pos2,
double influenceRatioPos2)
returns a point on a line segment between pos1 and pos2, with parameterized placement between the two end nodes. |
|
static VectorXYZ |
interpolateElevation(VectorXZ posForEle,
VectorXYZ pos1,
VectorXYZ pos2)
performs linear interpolation of elevation information for a position on a line segment |
|
static double |
interpolateValue(VectorXZ posForValue,
VectorXZ pos1,
double valueAt1,
VectorXZ pos2,
double valueAt2)
performs linear interpolation of any value for a position on a line segment |
|
static boolean |
isBetween(VectorXZ p,
VectorXZ l1,
VectorXZ l2)
returns true if p is "between" l1 and l2, i.e. |
|
static boolean |
isRightOf(VectorXZ p,
VectorXZ l1,
VectorXZ l2)
returns true if the point p is on the right of the line though l1 and l2 |
|
static List<VectorXYZ> |
sequenceAbove(List<VectorXYZ> sequence,
double yDistance)
returns a sequence of vectors at a distance above an original sequence |
|
static
|
triangleNormalListFromTriangleStrip(List<? extends V> normals)
|
|
static List<TriangleXYZ> |
trianglesFromTriangleFan(List<? extends VectorXYZ> vs)
|
|
static List<TriangleXYZ> |
trianglesFromTriangleStrip(List<? extends VectorXYZ> vs)
|
|
static List<TriangleXYZ> |
trianglesFromVertexList(List<? extends VectorXYZ> vs)
|
|
static
|
triangleVertexListFromTriangleFan(List<? extends V> vs)
|
|
static
|
triangleVertexListFromTriangleStrip(List<? extends V> vs)
|
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final List<TriangleXYZ> trianglesFromVertexList(List<? extends VectorXYZ> vs)
public static final List<TriangleXYZ> trianglesFromTriangleStrip(List<? extends VectorXYZ> vs)
public static final <V> List<V> triangleVertexListFromTriangleStrip(List<? extends V> vs)
public static final <V> List<V> triangleNormalListFromTriangleStrip(List<? extends V> normals)
public static final List<TriangleXYZ> trianglesFromTriangleFan(List<? extends VectorXYZ> vs)
public static final <V> List<V> triangleVertexListFromTriangleFan(List<? extends V> vs)
public static final VectorXZ getLineIntersection(VectorXZ pointA, VectorXZ directionA, VectorXZ pointB, VectorXZ directionB)
public static final VectorXZ getLineSegmentIntersection(VectorXZ pointA1, VectorXZ pointA2, VectorXZ pointB1, VectorXZ pointB2)
public static final VectorXZ getTrueLineSegmentIntersection(VectorXZ pointA1, VectorXZ pointA2, VectorXZ pointB1, VectorXZ pointB2)
getLineSegmentIntersection(VectorXZ, VectorXZ, VectorXZ, VectorXZ)
that also returns null (= does not announce an intersection)
if the two segments share an end point
public static final boolean isRightOf(VectorXZ p, VectorXZ l1, VectorXZ l2)
public static final boolean isBetween(VectorXZ p, VectorXZ l1, VectorXZ l2)
public static final double distanceFromLine(VectorXZ p, VectorXZ v1, VectorXZ v2)
public static final double distanceFromLineSegment(VectorXZ p, LineSegmentXZ s)
public static final List<VectorXYZ> sequenceAbove(List<VectorXYZ> sequence, double yDistance)
sequence
- original sequenceyDistance
- distance in y direction between new and original sequence;
can be negative for creating a sequence below the original sequence.public static VectorXZ interpolateBetween(VectorXZ pos1, VectorXZ pos2, double influenceRatioPos2)
public static VectorXYZ interpolateBetween(VectorXYZ pos1, VectorXYZ pos2, double influenceRatioPos2)
interpolateBetween(VectorXZ, VectorXZ, double)
public static VectorXYZ interpolateElevation(VectorXZ posForEle, VectorXYZ pos1, VectorXYZ pos2)
public static double interpolateValue(VectorXZ posForValue, VectorXZ pos1, double valueAt1, VectorXZ pos2, double valueAt2)
public static List<VectorXZ> equallyDistributePointsAlong(double preferredDistance, boolean pointsAtStartAndEnd, VectorXZ lineStart, VectorXZ lineEnd)
preferredDistance
- ideal distance between resulting points;
this method will try to keep the actual distance as close to this as possiblepointsAtStartAndEnd
- if true, there will be a point at lineStart
and lineEnd each; if false, the closest points will be half the usual
distance away from thesepublic static List<VectorXZ> equallyDistributePointsAlong(double preferredDistance, boolean pointsAtStartAndEnd, List<VectorXZ> points)
preferredDistance
- ideal distance between resulting points;
this method will try to keep the actual distance as close to this as possiblepointsAtStartAndEnd
- if true, there will be a point at lineStart
and lineEnd each; if false, the closest points will be half the usual
distance away from thesepublic static PolygonXZ insertIntoPolygon(PolygonXZ polygon, VectorXZ point, double snapDistance)
polygon
- original polygon, will not be modified by this methodpoint
- the new pointsnapDistance
- minimum distance of new point from segment endpoints;
if the new point is closer, the unmodified
original polygon will be returned.public static List<VectorXZ> distributePointsOn(long seed, PolygonWithHolesXZ polygonWithHolesXZ, AxisAlignedBoundingBoxXZ boundary, double density, double minimumDistance)
seed
- a seed for random number generationpolygonWithHolesXZ
- polygon on which the points should be placedboundary
- boundary of the relevant area or null;
points outside of the boundary are optional.density
- desired number of points per unit of areaminimumDistance
- minimum distance between resulting points
(not yet implemented)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |