1"""Demonstrate 3‑D intersection helpers."""
2from geo.core import Point3D, Vector3D
3from geo.primitives_3d import Sphere, Plane
4from geo.operations.intersections_3d import (
5 sphere_sphere_intersection, plane_plane_intersection, line_triangle_intersection_moller_trumbore
6)
7from geo.primitives_3d import Line3D
8
9s1 = Sphere(Point3D(0, 0, 0), 2)
10s2 = Sphere(Point3D(3, 0, 0), 2)
11print("Sphere–sphere →", sphere_sphere_intersection(s1, s2).type)
12
13pl1 = Plane(Point3D(0, 0, 0), Vector3D(0, 0, 1))
14pl2 = Plane(Point3D(0, 0, 1), Vector3D(1, 0, 1))
15print("Plane–plane line =", plane_plane_intersection(pl1, pl2))
16
17orig = Point3D(0, 0, 5)
18dir = Vector3D(0, 0, -1)
19tri = (
20 Point3D(-1, -1, 0), Point3D(1, -1, 0), Point3D(0, 1, 0)
21)
22print("Ray-triangle hit:", line_triangle_intersection_moller_trumbore(orig, dir, *tri))