scikit-spatial
raw JSON → 9.0.1 verified Fri May 01 auth: no python
Spatial objects (points, lines, planes, vectors) and computations based on NumPy arrays. Current version: 9.0.1. Release cadence: irregular, with major version bumps for breaking changes.
pip install scikit-spatial Common errors
error AttributeError: 'Point' object has no attribute 'plot' ↓
cause Plotting requires matplotlib, which is an optional dependency.
fix
Install matplotlib: pip install matplotlib. Then re-run your code.
error TypeError: __init__() takes 1 positional argument but 4 were given ↓
cause Using old constructor style Point(x, y, z) instead of Point([x, y, z]).
fix
Pass coordinates as a single list: Point([x, y, z]).
error ValueError: The direction vector cannot be zero. ↓
cause Creating a Line with a zero direction vector.
fix
Ensure the direction vector is non-zero, e.g., Line(point=[0,0,0], direction=[1,0,0]).
Warnings
breaking In version 9.0.0, the 'Point' class constructor changed: a single list/array of coordinates is required, not separate arguments. ↓
fix Use 'Point([x, y, z])' instead of 'Point(x, y, z)'.
gotcha The 'Line' class no longer accepts 'point' and 'direction' as positional arguments; they must be keyword arguments. ↓
fix Always use keyword arguments: Line(point=..., direction=...).
deprecated The 'Plane.from_points' method is deprecated in favor of 'Plane.from_three_points'. ↓
fix Use 'Plane.from_three_points' instead of 'Plane.from_points'.
Imports
- Point
from skspatial.objects import Point - Line
from skspatial.objects import Line - Plane
from skspatial.objects import Plane - Vector
from skspatial.objects import Vector
Quickstart
from skspatial.objects import Point, Line, Vector
point = Point([1, 2, 3])
line = Line(point=[0, 0, 0], direction=[1, 1, 1])
vector = Vector([1, 0, 0])
print(point)
print(line)
print(vector)
# Distance from point to line
dist = line.distance_point(point)
print(f"Distance: {dist}")