Package com.solibri.geometry.primitive3d
Interface Segment3d
-
- All Known Subinterfaces:
MSegment3d
public interface Segment3d
Read-only interface for handling segments in 3-dimensional space.- Since:
- 9.10.2
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description MVector3d
closestPointTo(Vector3d point)
Returns the point on this Segment that is closest to the given point.boolean
contains(Vector3d point)
Returns true if the given point lies on this Segment, otherwise returns false.static Segment3d
create(Vector3d startPoint, Vector3d endPoint)
Creates an instance.double
distance(Vector3d point)
Returns the minimum distance between this Segment and the given point.double
distance(Segment3d other)
Returns the minimum distance between this Segment and the given Segment.double
distanceSquared(Vector3d point)
Returns the square of the minimum distance between this Segment and the given point.double
distanceSquared(Segment3d other)
Returns the square of the minimum distance between this Segment and the given Segment.default boolean
equalsWithTolerance(Segment3d other, double tolerance)
Returns true if the ends of this Segment match the ends of Segment other within tolerance.Vector3d
getEndPoint()
Returns the ending point of this Segment.default double
getLength()
Returns the length of this Segment.default double
getLengthSquared()
Returns the square of the length of this Segment.Vector3d
getStartPoint()
Returns the starting point of this Segment.Optional<MVector3d>
intersect(Plane plane)
Returns the point of intersection between this Segment and the given plane.Optional<MVector3d>
intersect(Segment3d other)
Returns the intersection point of this and other Segment.boolean
intersects(Plane plane)
Returns true if this segment intersects the given plane.default boolean
intersects(Segment3d other)
Returns true if this Segment intersects the given Segment, otherwise returns false.static Comparator<Segment3d>
lengthComparator()
Returns a comparator that compares non-null Segments by their length.default List<MVector3d>
sample(int amount)
Samples the given amount of points from the segment.MSegment3d
shortestSegmentBetween(Segment3d otherSegment)
Returns the shortest segment from this Segment to Segment b.
-
-
-
Method Detail
-
getStartPoint
Vector3d getStartPoint()
Returns the starting point of this Segment.- Returns:
- the starting point of this Segment
- Since:
- 9.10.2
-
getEndPoint
Vector3d getEndPoint()
Returns the ending point of this Segment.- Returns:
- the ending point of this Segment
- Since:
- 9.10.2
-
getLengthSquared
default double getLengthSquared()
Returns the square of the length of this Segment.- Returns:
- the square of the length of this Segment
- Since:
- 9.10.2
-
getLength
default double getLength()
Returns the length of this Segment.- Returns:
- the length of this Segment
- Since:
- 9.10.2
-
distanceSquared
double distanceSquared(Vector3d point)
Returns the square of the minimum distance between this Segment and the given point.- Parameters:
point
- the point for which the square of the distance to this Segment is computed- Returns:
- the square of the minimum distance between this Segment and the given point
- Since:
- 9.10.2
-
distance
double distance(Vector3d point)
Returns the minimum distance between this Segment and the given point.- Parameters:
point
- the point for which the distance to this Segment is computed- Returns:
- the minimum distance between this Segment and the given point
- Since:
- 9.10.2
-
closestPointTo
MVector3d closestPointTo(Vector3d point)
Returns the point on this Segment that is closest to the given point.- Parameters:
point
- the point for which closest point on this Segment is computed.- Returns:
- the point on this Segment that is closest to the given point
- Since:
- 9.10.2
-
distanceSquared
double distanceSquared(Segment3d other)
Returns the square of the minimum distance between this Segment and the given Segment.- Parameters:
other
- the Segment for which the square of the distance to this Segment is computed- Returns:
- the square of the minimum distance between this Segment and the given Segment
- Since:
- 9.10.2
-
distance
double distance(Segment3d other)
Returns the minimum distance between this Segment and the given Segment.- Parameters:
other
- the Segment for which the distance to this Segment is computed- Returns:
- the minimum distance between this Segment and the given Segment
- Since:
- 9.10.2
-
intersects
default boolean intersects(Segment3d other)
Returns true if this Segment intersects the given Segment, otherwise returns false.- Parameters:
other
- the Segment with which intersection is checked- Returns:
- true if this Segment intersects the given Segment, otherwise returns false
- Since:
- 9.10.2
-
intersect
Optional<MVector3d> intersect(Segment3d other)
Returns the intersection point of this and other Segment. If the two Segment instances do not intersect, then the return value is null. Theintersects(com.solibri.geometry.primitive3d.Segment3d)
method can be used to check if this Segment intersects another Segment.- Parameters:
other
- the Segment with which intersection point is computed- Returns:
- an optional that contains the intersection point of this and other Segment if it exists or empty if no intersection is found
- Since:
- 9.10.2
-
intersects
boolean intersects(Plane plane)
Returns true if this segment intersects the given plane.- Parameters:
plane
- the plane with which the intersection is checked- Returns:
- true if this segment intersects the given plane
- Since:
- 9.10.2
-
intersect
Optional<MVector3d> intersect(Plane plane)
Returns the point of intersection between this Segment and the given plane. If this Segment does not intersect the plane, then returns empty.- Parameters:
plane
- the plane with which the intersection is computed- Returns:
- an optional that contains the point of intersection if it exists or an empty optional otherwise
- Since:
- 9.10.2
-
contains
boolean contains(Vector3d point)
Returns true if the given point lies on this Segment, otherwise returns false.- Parameters:
point
- the point for which the check is performed- Returns:
- true if the given point lies on this Segment, otherwise returns false
- Since:
- 9.10.2
-
sample
default List<MVector3d> sample(int amount)
Samples the given amount of points from the segment. The start and end point are not included in the sample. If an amount of zero or less is given, an empty list is returned.- Parameters:
amount
- the amount of samples- Returns:
- the samples as a list from start point towards the end point
-
equalsWithTolerance
default boolean equalsWithTolerance(Segment3d other, double tolerance)
Returns true if the ends of this Segment match the ends of Segment other within tolerance. Otherwise returns false.- Parameters:
other
- the Segment that is checked for matching with this Segmenttolerance
- the tolerance used in checking- Returns:
- true if the ends of this Segment are within distance of tolerance to the ends of Segment other
- Since:
- 9.10.2
-
shortestSegmentBetween
MSegment3d shortestSegmentBetween(Segment3d otherSegment)
Returns the shortest segment from this Segment to Segment b. The returned Segment is not unique if the given Segment instances are parallel. If the given segments intersect, then the start and end points of the returned Segment will be equal.- Parameters:
otherSegment
- the target segment for the returned Segment- Returns:
- the shortest segment between the given segments, such that the start point is on this Segment and the end point is on the Segment b
- Since:
- 9.10.2
-
lengthComparator
static Comparator<Segment3d> lengthComparator()
Returns a comparator that compares non-null Segments by their length. The longer segment is considered to be greater in the ordering defined by the comparator returned by this method. This can be used for sorting Segments by length.- Returns:
- comparator that compares segments by length
- Since:
- 9.10.2
-
-