4747 raise ValueError ("[Test] BBox should contain this point" )
4848 if box2 .contains_point (geom .Point2D ([10 , 0 ])):
4949 raise ValueError ("[Test] BBox should not contain this point" )
50+
51+ # --- 3D Bounding Box and Ray/Line intersections ---
52+ bbox3 = geom .BoundingBox3D ()
53+ bbox3 .add_point (geom .Point3D ([- 1 , - 1 , - 1 ]))
54+ bbox3 .add_point (geom .Point3D ([1 , 1 , 1 ]))
55+
56+ # Rays
57+ ray_inside = geom .Ray3D ( geom .Vector3D ([0 , 0 , 1 ]),geom .Point3D ([0 , 0 , 0 ]))
58+ if not bbox3 .intersects_ray (ray_inside ):
59+ raise ValueError ("[Test] Wrong result with ray_inside" )
60+
61+ ray_up = geom .Ray3D ( geom .Vector3D ([0 , 0 , 1 ]),geom .Point3D ([0 , 0 , 2 ]))
62+ if bbox3 .intersects_ray (ray_up ):
63+ raise ValueError ("[Test] Wrong result with ray_up" )
64+
65+ ray_down = geom .Ray3D ( geom .Vector3D ([0 , 0 , 1 ]),geom .Point3D ([0 , 0 , - 2 ]))
66+ if not bbox3 .intersects_ray (ray_down ):
67+ raise ValueError ("[Test] Wrong result with ray_down" )
68+
69+ # Infinite lines
70+ line_inside = geom .InfiniteLine3D ( geom .Vector3D ([0 , 0 , 1 ]),geom .Point3D ([0 , 0 , 0 ]))
71+ if not bbox3 .intersects_infinite_line (line_inside ):
72+ raise ValueError ("[Test] Wrong result with line_inside" )
73+
74+ line_up = geom .InfiniteLine3D ( geom .Vector3D ([0 , 0 , 1 ]),geom .Point3D ([0 , 0 , 2 ]))
75+ if not bbox3 .intersects_infinite_line (line_up ):
76+ raise ValueError ("[Test] Wrong result with line_up" )
77+
78+ line_down = geom .InfiniteLine3D ( geom .Vector3D ([0 , 0 , 1 ]),geom .Point3D ([0 , 0 , - 2 ]))
79+ if not bbox3 .intersects_infinite_line (line_down ):
80+ raise ValueError ("[Test] Wrong result with line_down" )
0 commit comments