Skip to main content

raygeo.geo.shape.point

Individual point operations.

Provides equality testing within a configurable tolerance, midpoint computation between two points, 2D/3D get_circumcenter of three points, and applying a 4x4 affine transformation matrix to a single point.

Functions

are_points_equal_3d()

are_points_equal_3d(
p1: types.Point3D,
p2: types.Point3D,
tolerance: float,
) -> bool

Check if two 3D points are equal within tolerance.

ParameterTypeDescription
p1types.Point3DFirst point (x, y, z).
p2types.Point3DSecond point (x, y, z).
tolerancefloatMaximum allowed difference.
ReturnsboolTrue if points are equal within tolerance.
ComplexityO(1) time, O(1) space

get_circumcenter()

get_circumcenter(
a: types.Point,
b: types.Point,
c: types.Point,
) -> tuple[types.Point, float]

Compute the get_circumcenter and radius of three 2D points.

Returns the center of the unique circle passing through all three points along with its radius. Returns ((0.0, 0.0), -1.0) when the points are collinear.

ParameterTypeDescription
atypes.PointFirst point (x, y).
btypes.PointSecond point (x, y).
ctypes.PointThird point (x, y).
Returnstuple[types.Point, float](center, radius) where center is (x, y).
ComplexityO(1) time, O(1) space

get_circumcenter_3d()

get_circumcenter_3d(
a: types.Point3D,
b: types.Point3D,
c: types.Point3D,
) -> Optional[types.Point3D]

Compute the get_circumcenter of three 3D points.

Returns the center of the unique circle passing through all three points. Returns None when the points are collinear.

ParameterTypeDescription
atypes.Point3DFirst point (x, y, z).
btypes.Point3DSecond point (x, y, z).
ctypes.Point3DThird point (x, y, z).
ReturnsOptional[types.Point3D]Circumcenter (x, y, z) or None if collinear.
ComplexityO(1) time, O(1) space

Circumcenter of three 3D points with circumcircle

Circumcenter of three 3D points with circumcircle

get_midpoint_3d()

get_midpoint_3d(p1: types.Point3D, p2: types.Point3D) -> types.Point3D

Get the midpoint between two 3D points.

ParameterTypeDescription
p1types.Point3DFirst point (x, y, z).
p2types.Point3DSecond point (x, y, z).
Returnstypes.Point3DMidpoint (x, y, z).
ComplexityO(1) time, O(1) space

Midpoint of a 3D segment

Midpoint of a 3D segment

rotate_point()

rotate_point(point: types.Point, angle: float) -> types.Point

Rotate a 2D point around the origin.

ParameterTypeDescription
pointtypes.PointPoint (x, y) to rotate.
anglefloatRotation angle in radians (counter-clockwise).
Returnstypes.PointRotated point (x, y).
ComplexityO(1) time, O(1) space

transform_point_3d()

transform_point_3d(
matrix: Sequence[Sequence[float]],
x: float,
y: float,
z: float,
) -> types.Point3D

Apply an affine transformation matrix to a 3D point.

ParameterTypeDescription
matrixSequence[Sequence[float]]4x4 affine transformation matrix.
xfloatX coordinate.
yfloatY coordinate.
zfloatZ coordinate.
Returnstypes.Point3DTransformed point (x, y, z).
ComplexityO(1) time, O(1) space