Comparison
Canonical path: NemAll_Python_Geometry.Comparison
Utility class with methods for comparing two with each other
AllPointsAreOneAxis
staticmethod
AllPointsAreOneAxis(polyline: Polyline2D, tolerance: float) -> bool
Check if all points of polyline are on one straight line
Parameters:
-
polyline
(Polyline2D
) –Polyline
-
tolerance
(float
) –Tolerance
Returns:
-
bool
–Result of the check
Congruent
overloaded
compare 2D points of two 2D lines if are congruent
Parameters:
-
l1p1
(Point2D
) –the 1. point of the 1. line
-
l1p2
(Point2D
) –the 2. point of the 1. line
-
l2p1
(Point2D
) –the 1. point of the 2. line
-
l2p2
(Point2D
) –the 2. point of the 2. line
Returns:
-
bool
–true if lines are congruent, otherwise false.
DeterminePosition
overloaded
DeterminePosition(
geoObject: object, point: Point2D, tolerance: float
) -> eComparisionResult
Determine the relative position of a point to an object.
Parameters:
-
geoObject
(object
) –IGeometry
-
point
(Point2D
) –Point
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
eComparisionResult
–eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eLeft, eRight, eAbove, eBelow
DeterminePosition(
line: Line2D, point: Point2D, tolerance: float
) -> eComparisionResult
Determine the relative position of a point to a 2D line.
Parameters:
-
line
(Line2D
) –2D line
-
point
(Point2D
) –Point
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
eComparisionResult
–eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eLeft, eRight, eAbove, eBelow
DeterminePosition(
axis: Axis2D, point: Point2D, tolerance: float
) -> eComparisionResult
Determine the relative position of a point to a 2D axis.
Parameters:
-
axis
(Axis2D
) –2D axis
-
point
(Point2D
) –Point
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
eComparisionResult
–eOnElement, eAbove, eBelow
DeterminePosition(
polyline: Polyline2D, point: Point2D, tolerance: float
) -> eComparisionResult
Determine the relative position of a point to a 2D polyline. Returns position of point to the closest line of poly line
Parameters:
-
polyline
(Polyline2D
) –2D polyline
-
point
(Point2D
) –Point
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
eComparisionResult
–eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eLeft, eRight, eAbove, eBelow
DeterminePosition(
arc: Arc2D, point: Point2D, tolerance: float
) -> eComparisionResult
Determine the relative position of a point to a 2D arc.
Parameters:
-
arc
(Arc2D
) –2D arc
-
point
(Point2D
) –Point
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
eComparisionResult
–eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eLeft, eRight, eAbove, eBelow
DeterminePosition(
arc: Arc3D, point: Point3D, tolerance: float
) -> eComparisionResult
Determine the relative position of a point to a 3D arc.
Parameters:
-
arc
(Arc3D
) –3D arc
-
point
(Point3D
) –Point
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
eComparisionResult
–eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eLeft, eRight, eAbove, eBelow
DeterminePosition(
clothoid: Clothoid2D, point: Point2D, tolerance: float
) -> eComparisionResult
Determine the relative position of a point to a 2D clothoid.
Parameters:
-
clothoid
(Clothoid2D
) –2D clothoid
-
point
(Point2D
) –Point
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
eComparisionResult
–eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eLeft, eRight, eAbove, eBelow
DeterminePosition(
spline: Spline2D, point: Point2D, tolerance: float
) -> eComparisionResult
Determine the relative position of a point to a 2D spline.
Parameters:
-
spline
(Spline2D
) –2D spline
-
point
(Point2D
) –Point
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
eComparisionResult
–eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eLeft, eRight, eAbove, eBelow
DeterminePosition(
polygon: Polygon2D, point: Point2D, tolerance: float
) -> eComparisionResult
Determine the relative position of a point to a polygon 2D.
Parameters:
-
polygon
(Polygon2D
) –Polygon2D
-
point
(Point2D
) –Point
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
eComparisionResult
–eInside(inside the polygon), eOutside, eOnElement (on one of the edges), eEqualToEndPoint or Unknown
DeterminePosition(polygon: Polygon2D, line: Line2D) -> eComparisionResult
Determine the relative position of a line to a polygon 2D.
Parameters:
Returns:
-
eComparisionResult
–eInside(inside the polygon), eOutside, eNotParallel(the line crosses the polygon), eOnElement (on one of the edges), or Unknown
DeterminePosition(
line: Line3D, point: Point3D, tolerance: float
) -> eComparisionResult
Determine the relative position of a point to a 3D line
Parameters:
-
line
(Line3D
) –3D line
-
point
(Point3D
) –Point
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
eComparisionResult
–eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eLeft, eRight, eAbove, eBelow
DeterminePosition(
polyline: Polyline3D, point: Point3D, tolerance: float
) -> eComparisionResult
Determine the relative position of a point to a 3D polyline
Parameters:
-
polyline
(Polyline3D
) –3D polyline
-
point
(Point3D
) –Point
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
eComparisionResult
–eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eLeft, eRight, eAbove, eBelow
DeterminePosition(phed: Polyhedron3D, point: Point3D) -> eComparisionResult
Determine the relative position of a point to a Polyhedron
Parameters:
-
phed
(Polyhedron3D
) –Polyhedron
-
point
(Point3D
) –Point
Returns:
-
eComparisionResult
–eInside,eOutside
DeterminePosition(
spline: Spline3D, point: Point3D, tolerance: float
) -> eComparisionResult
Determine the relative position of a point to a Spline3D
Parameters:
-
spline
(Spline3D
) –Spline3D
-
point
(Point3D
) –Point
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
eComparisionResult
–eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eOutside
DeterminePosition(
spline: BSpline3D, point: Point3D, tolerance: float
) -> eComparisionResult
Determine the relative position of a point to a BSpline3D
Parameters:
-
spline
(BSpline3D
) –BSpline3D
-
point
(Point3D
) –Point
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
eComparisionResult
–eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eOutside
DeterminePosition(
path: Path3D, point: Point3D, tolerance: float
) -> eComparisionResult
Determine the relative position of a point to a Path3D
Parameters:
-
path
(Path3D
) –Path3D
-
point
(Point3D
) –Point
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
eComparisionResult
–eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eOutside
DeterminePosition(
b: BRep3D, point: Point3D, tolerance: float
) -> eComparisionResult
Determine the relative position of a point to a 3D BRep
Parameters:
-
b
(BRep3D
) –BRep3D
-
point
(Point3D
) –Point
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
eComparisionResult
–eOnElement(identical to a vertes of the BRep), eInside (inside the BRep)
DeterminePosition(
polygon1: Polygon2D, polygon2: Polygon2D
) -> eComparisionResult
Determine the relative position of the second polygon to the first polygon
Parameters:
Returns:
-
eComparisionResult
–eInside,eOutside,eCrossing
DeterminePosition(line: Line2D, minMax: MinMax2D) -> eComparisionResult
Determine the relative position of minMax to line
Parameters:
Returns:
-
eComparisionResult
–eOutside,eCrossing,eUnknown
DeterminePosition(lines: Line2DList, minMax: MinMax2D) -> eComparisionResult
Determine the relative position of the minMax to lines
Parameters:
-
lines
(Line2DList
) –lines
-
minMax
(MinMax2D
) –minmax
Returns:
-
eComparisionResult
–eOutside,eCrossing,eUnknown
DeterminePosition(
igeo: object, point: Point3D, tolerance: float
) -> eComparisionResult
Determine the relative position of a point to a 3D geometry
Parameters:
-
igeo
(object
) –3D geometry
-
point
(Point3D
) –Point3D
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
eComparisionResult
–eInside,eOutside
DeterminePositionEx
staticmethod
DeterminePositionEx(
polyline: Polyline2D, point: Point2D, tolerance: float
) -> tuple[eComparisionResult, VecSizeTList]
Determine the relative position of a point to a 2D polyline.
Parameters:
-
polyline
(Polyline2D
) –2D polyline
-
point
(Point2D
) –Point
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
tuple[eComparisionResult, VecSizeTList]
–tuple(eOnElement(between start and end points), eEqualToStartPoint, eEqualToEndPoint, eLeft, eRight, eAbove, eBelow, number of the segment of polyline in which was the point found (-1 - is not on polyline, 0 - first segm., ...))
Equal
overloaded
Compare two floating point numbers without tolerance
Parameters:
-
el1
(float
) –first number
-
el2
(float
) –second number
Returns:
-
bool
–true when equal, otherwise false.
Compare two floating point numbers with tolerance
Parameters:
-
el1
(float
) –first number
-
el2
(float
) –second number
-
tol
(float
) –value used to calculate allowed delta
Returns:
-
bool
–true when equal, otherwise false.
Equal(el1: Clothoid2D, el2: Clothoid2D, tol: float) -> bool
Compare two 2D clothoids with tolerance
Parameters:
-
el1
(Clothoid2D
) –first clothoid
-
el2
(Clothoid2D
) –second clothoid
-
tol
(float
) –value used to calculate allowed delta
Returns:
-
bool
–true when equal, otherwise false.
Equal(el1: Polyline3D, el2: Polyline3D, tol: float) -> bool
Compare two 3D polylines with tolerance
Parameters:
-
el1
(Polyline3D
) –first polyline
-
el2
(Polyline3D
) –second polyline
-
tol
(float
) –value used to calculate allowed delta
Returns:
-
bool
–true when equal, otherwise false.
Compare 2 geometries with given tolerance
Parameters:
-
igeo1_object
–first geometry
-
igeo2_object
–second geometry
-
tol
(float
) –value used to calculate allowed delta
Returns:
-
bool
–true when equal
EqualCoordsRel
overloaded
EqualDistance
overloaded
EqualRel
overloaded
compare 2 doubles using built-in relative tolerance
Parameters:
-
el1
(float
) –- element
-
el2
(float
) –- element
Returns:
-
bool
–true when equal, otherwise false.
compare 2 doubles using given relative tolerance
Parameters:
-
el1
(float
) –- element
-
el2
(float
) –- element
-
tol
(float
) –relative tolerance
Returns:
-
bool
–true when equal, otherwise false.
GetSegmentNumber
overloaded
GetSegmentNumber(geoObject: object, segment: Line2D, tolerance: float) -> int
Determine the segment position of a point to a 2D geometry object
Parameters:
-
geoObject
(object
) –IGeometry
-
segment
(Line2D
) –Line2D
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
int
–segment number 0 is first element
GetSegmentNumber(geoObject: object, point: Point3D, tolerance: float) -> int
Determine the segment position of a point to a geometry object
Parameters:
-
geoObject
(object
) –IGeometry
-
point
(Point3D
) –Point3D
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
int
–segment number 0 is first element
GetSegmentNumber(geoObject: object, point: Point2D, tolerance: float) -> int
Determine the segment position of a point to a 2D geometry object
Parameters:
-
geoObject
(object
) –IGeometry
-
point
(Point2D
) –Point2D
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
int
–segment number 0 is first element
GetSegmentNumber(
polyPoints: PolyPoints2D, point: Point2D, tolerance: float
) -> int
Determine the segment position of a point to a PolyPoints
Parameters:
-
polyPoints
(PolyPoints2D
) –PolyPoints
-
point
(Point2D
) –Point2D
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
int
–segment number 0 is first element
GetSegmentNumber(
polyPoints: PolyPoints3D, point: Point3D, tolerance: float
) -> int
Determine the segment position of a point to a PolyPoints
Parameters:
-
polyPoints
(PolyPoints3D
) –PolyPoints
-
point
(Point3D
) –Point3D
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
int
–segment number 0 is first element
GetSegmentNumber(
polyPoints: PolyPoints2D, segment: Line2D, tolerance: float
) -> int
Determine the segment position of a point to a PolyPoints
Parameters:
-
polyPoints
(PolyPoints2D
) –PolyPoints
-
segment
(Line2D
) –Line2D
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
int
–segment number 0 is first element
GetSegmentNumber(
polyPoints: PolyPoints3D, segment: Line3D, tolerance: float
) -> int
Determine the segment position of a point to a PolyPoints
Parameters:
-
polyPoints
(PolyPoints3D
) –PolyPoints
-
segment
(Line3D
) –Line3D
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
int
–segment number 0 is first element
GetSegmentNumber(geoObject: object, segment: Line3D, tolerance: float) -> int
Determine the segment position of a point to a geometry object
Parameters:
-
geoObject
(object
) –IGeometry
-
segment
(Line3D
) –Line3D
-
tolerance
(float
) –tolerance (if distance < tolerance, point on object)
Returns:
-
int
–segment number 0 is first element
HitsElement
staticmethod
HitsElement(result: eComparisionResult) -> bool
Check if comparison result hits element in some way
Parameters:
-
result
(eComparisionResult
) –the comparison result to check
Returns:
-
bool
–true, if the result indicates that the element is hit, otherwise false e.g. left, right, etc.
IsInside
overloaded
Args: line lineToCheck
IsParallel
overloaded
IsParallel(el1: Line2D, el2: Line2D) -> tuple[eComparisionResult, float]
test 2 2D lines for parallel
Parameters:
Returns:
-
tuple[eComparisionResult, float]
–tuple(eParallel, eAntiParallel, eNotParallel, result distance)
IsParallel(lines: Line2DList) -> eComparisionResult
Check of parallelism for vector of 2D lines
Return eAntiParallel if at least one line is antiparallel and all rest are parallel Return eNotParallel if at least one line is not parallel In all rest cases return eParallel
Parameters:
-
lines
(Line2DList
) –- vector of 2D lines
Returns:
-
eComparisionResult
–eParallel, eAntiParallel, eNotParallel
IsParallel(el1: Line3D, el2: Line3D) -> tuple[eComparisionResult, float]
test 2 3D lines for parallel
Parameters:
Returns:
-
tuple[eComparisionResult, float]
–tuple(eParallel, eAntiParallel, eNotParallel, result distance)
IsParallel(el1: object, el2: object) -> tuple[eComparisionResult, float]
test 2 Geometry object for parallel
Parameters:
-
el1
(object
) –- element
-
el2
(object
) –- element
Returns:
-
tuple[eComparisionResult, float]
–tuple(eParallel, eAntiParallel, eNotParallel, result distance)
Overlapped
overloaded
Overlapped(el1: Polyline2D, el2: Polyline2D) -> bool
compare of 2 Polyline 2D
Parameters:
-
el1
(Polyline2D
) –Polyline2D
-
el2
(Polyline2D
) –Polyline2D
Returns:
-
bool
–true when overlapped, otherwise false
Overlapped(
el1: Polyline3D, el2: Polyline3D, partiallyToo: bool = False
) -> bool
compare of 2 Polyline 3D
Parameters:
-
el1
(Polyline3D
) –Polyline3D
-
el2
(Polyline3D
) –Polyline3D
-
partiallyToo
(bool
, default:False
) –First and last segment of polyline have not be identical but is enough that lies on the second polyline segments
Returns:
-
bool
–true when overlapped, otherwise false
Overlapped(pp1: PolyPoints2D, pp2: PolyPoints2D) -> bool
compare of PolyPoints
Parameters:
-
pp1
(PolyPoints2D
) –PolyPoints
-
pp2
(PolyPoints2D
) –PolyPoints
Returns:
-
bool
–true when overlapped, otherwise false
Overlapped(pp1: PolyPoints3D, pp2: PolyPoints3D) -> bool
compare of PolyPoints
Parameters:
-
pp1
(PolyPoints3D
) –PolyPoints
-
pp2
(PolyPoints3D
) –PolyPoints
Returns:
-
bool
–true when overlapped, otherwise false
Overlapped(phed1: Polyhedron3D, phed2: Polyhedron3D) -> bool
compare of 2 3D Polyhedra
Parameters:
-
phed1
(Polyhedron3D
) –Polyhedron3D
-
phed2
(Polyhedron3D
) –Polyhedron3D
Returns:
-
bool
–true when overlapped, otherwise false
compare of 2 Geometries
Parameters:
-
geo1
(object
) –IGeometry
-
geo2
(object
) –IGeometry
Returns:
-
bool
–true when overlapped, otherwise false