Expand description
Core types and structures for Clipper2
Direct port from clipper.core.h This module contains the fundamental data types and basic operations
Re-exports§
pub use get_bounds_path as get_bounds;
Modules§
- constants
- Constants matching C++ implementation Direct port from clipper.core.h line 55-71
- errors
- Error constants matching C++ implementation
Structs§
- Clipper2
Exception - Exception type for Clipper2 errors Direct port from clipper.core.h line 27
- Point
- 2D point with generic numeric type Direct port from clipper.core.h line 117
- Rect
- Rectangle with generic numeric type Direct port from clipper.core.h line 295
- UInt128
Struct - 128-bit unsigned integer struct for high-precision multiplication Direct port from clipper.core.h line 685
Enums§
- Fill
Rule - Fill rule determines how polygons with self-intersections are filled Direct port from clipper.core.h line 108
- Location
- Location of a point relative to a rectangle Direct port from clipper.rectclip.h line 20
- Point
InPolygon Result - Result of point-in-polygon test Direct port from clipper.core.h line 1046
Constants§
- INVALID_
POIN T64 - Invalid point constants
- INVALID_
POINTD
Traits§
- FromF64
- Trait for converting from f64 with appropriate rounding behavior
Matches C++ Point
constructor semantics: rounds for integral types, casts for float - ToF64
- Helper trait for converting to f64 - matching C++ static_cast
behavior
Functions§
- area
- Calculate area of a polygon path using the shoelace formula Direct port from clipper.core.h line 854
- area_
paths - Calculate total area of multiple polygon paths Direct port from clipper.core.h line 874
- check_
precision_ range - Check if precision is within acceptable range and adjust if needed Direct port from clipper.core.h line 682
- check_
precision_ range_ simple - Check precision range without error code (convenience function) Direct port from clipper.core.h line 691
- cross_
product_ sign - Get the sign of the cross product of vectors (pt1->pt2) and (pt2->pt3) Uses high-precision 128-bit arithmetic for exact results with i64 coordinates Direct port from clipper.core.h line 753
- cross_
product_ three_ points - Calculate cross product of two vectors formed by three points
Direct port from clipper.core.h line 810 - cross_
product_ two_ vectors - Calculate cross product of two vectors Direct port from clipper.core.h line 816
- distance_
sqr - Calculate squared distance between two points Direct port from clipper.core.h line 834
- do_
error - Handle errors by throwing appropriate exceptions Direct port from clipper.core.h line 73
- dot_
product_ three_ points - Calculate dot product of two vectors formed by three points Direct port from clipper.core.h line 822
- dot_
product_ two_ vectors - Calculate dot product of two vectors Direct port from clipper.core.h line 828
- ellipse_
point64 - Generate an elliptical path around a center point Direct port from clipper.h line 613 (Ellipse template function)
- ellipse_
point_ d - Generate an elliptical path around a center point (PointD version) Direct port from clipper.h line 613 (Ellipse template function)
- get_
bounds_ path - Calculate the bounding rectangle of a path Direct port from clipper.core.h line 432
- get_
bounds_ path_ convert - Calculate the bounding rectangle of a path with type conversion Direct port from clipper.core.h line 467
- get_
bounds_ paths - Calculate the bounding rectangle of multiple paths Direct port from clipper.core.h line 449
- get_
bounds_ paths_ convert - Calculate the bounding rectangle of multiple paths with type conversion Direct port from clipper.core.h line 484
- get_
closest_ point_ on_ segment - Get the closest point on a segment to an off-segment point Direct port from clipper.core.h line 1024
- get_
location - Get the location of a point relative to a rectangle Returns false if the point is on the rectangle edge, true otherwise Direct port from clipper.rectclip.cpp line 37
- get_
segment_ intersect_ pt - Calculate exact intersection point between two line segments for Point64 Direct port from clipper.core.h line 902 - simplified version for i64 coordinates
- get_
segment_ intersect_ pt_ d - Calculate intersection point between two line segments for PointD (floating-point) Direct port from clipper.core.h line 952 (floating-point specialization)
- get_
sign - Get the sign of a value: -1, 0, or 1 Direct port from clipper.core.h line 996
- is_
collinear - Test if three points are collinear (lie on the same straight line) Direct port from clipper.core.h line 796 - simplified version for Point64
- is_
horizontal - Check if a line segment between two points is horizontal Returns true if both points have the same y-coordinate Direct port from clipper.rectclip.cpp line 68
- is_
positive - Test if a polygon has positive orientation (counterclockwise) Direct port from clipper.core.h line 886
- mid_
point - Calculate midpoint between two points Direct port from clipper.core.h line 278
- multiply_
u64 - Multiply two 64-bit unsigned integers to get 128-bit result Direct port from clipper.core.h line 690
- near_
equal - Check if two points are near each other within a distance threshold Direct port from clipper.core.h line 616
- perpendic_
dist_ from_ line_ sqrd - Perpendicular distance squared from a point to a line defined by two points Direct port from clipper.core.h line 840 Uses the formula: (Ax3 + By3 + C)^2 / (A^2 + B^2) where A, B, C define the line equation
- perpendicular_
distance_ from_ line_ sqr - Calculate squared perpendicular distance from point to line Direct port from clipper.core.h line 840
- point_
in_ polygon - Determine if a point is inside, on the boundary, or outside a polygon Direct port from clipper.core.h line 1049 - simplified version for Point64 Uses the winding number algorithm with proper edge case handling
- products_
are_ equal - Check if products ab and cd are equal using exact 128-bit arithmetic Direct port from clipper.core.h line 703
- reflect_
point - Reflect a point about a pivot point Direct port from clipper.core.h line 986
- scale_
path - Scale a path with type conversion and separate x/y scales Direct port from clipper.core.h line 523
- scale_
path_ uniform - Scale a path with uniform scale Direct port from clipper.core.h line 550
- scale_
paths - Scale multiple paths with type conversion and separate x/y scales Includes range checking for integral output types Direct port from clipper.core.h line 557
- scale_
paths_ uniform - Scale multiple paths with uniform scale Direct port from clipper.core.h line 584
- scale_
rect - Scale a rectangle with type conversion Direct port from clipper.core.h line 405
- segments_
intersect - Check if two line segments intersect Direct port from clipper.core.h line 1003
- sqr
- Square a value (matches C++ template
inline double Sqr(T val)) Direct port from clipper.core.h line 611 - strip_
duplicates_ path - Strip duplicate consecutive points from a path Direct port from clipper.core.h line 658
- strip_
duplicates_ paths - Strip duplicate consecutive points from multiple paths Direct port from clipper.core.h line 670
- strip_
near_ equal - Strip near-equal consecutive points from a path Direct port from clipper.core.h line 623
- strip_
near_ equal_ paths - Strip near-equal consecutive points from multiple paths Direct port from clipper.core.h line 647
- transform_
path - Transform a path between types (no scaling, just type conversion) Direct port from clipper.core.h line 591
- transform_
paths - Transform multiple paths between types (no scaling, just type conversion) Direct port from clipper.core.h line 601
- translate_
point - Translate a point by dx, dy Direct port from clipper.core.h line 975
- tri_
sign - Helper for returning -1, 0, or 1 based on sign Direct port from clipper.core.h line 697