public static void DrawWireCube([NotNull] this OrientedBoundingBox box) { if (box == null) { throw new ArgumentNullException(nameof(box)); } var p0 = box.CornerPoint(0); var p1 = box.CornerPoint(1); var p2 = box.CornerPoint(2); var p3 = box.CornerPoint(3); var p4 = box.CornerPoint(4); var p5 = box.CornerPoint(5); var p6 = box.CornerPoint(6); var p7 = box.CornerPoint(7); var points = new[] { p0, p2, p6, p4, p0, p1, p3, p7, p5, p1 }; Handles.DrawPolyLine(points); Handles.DrawLine(p2, p3); Handles.DrawLine(p6, p7); Handles.DrawLine(p4, p5); }
public static OrientedBoundingBox BruteEnclosing(Vector3[] points) { var axis = new Vector3[3]; NativeMethods.obb_brute_enclosing(points, points.Length, out var center, out var extent, axis); var box = new OrientedBoundingBox(center, extent, axis[0], axis[1], axis[2]); return(box); }
public static extern void obb_face_plane( [In][Out] OrientedBoundingBox box, int index, out Plane plane );
public static extern void obb_random_point_on_surface( [In] OrientedBoundingBox box, LCG rng, out Vector3 outVec );
public static extern bool obb_intersects_ray( [In][Out] OrientedBoundingBox box, Ray other );
public static extern bool obb_intersects_obb( [In][Out] OrientedBoundingBox box, OrientedBoundingBox other );
public static extern bool obb_contains_point( [In][Out] OrientedBoundingBox box, Vector3 other );
public static extern void obb_enclose( [In][Out] OrientedBoundingBox box, Vector3 point );
public static extern void obb_translate( [In][Out] OrientedBoundingBox box, Vector3 offset );
public static extern void obb_scale( [In][Out] OrientedBoundingBox box, Vector3 center, Vector3 factor );
public static extern void obb_face_point( [In][Out] OrientedBoundingBox box, int index, float u, float v, out Vector3 point );
public static extern void obb_corner_point( [In][Out] OrientedBoundingBox box, int index, out Vector3 point );
public static extern bool obb_is_degenerate( [In][Out] OrientedBoundingBox box );
public static extern bool obb_is_finite( [In][Out] OrientedBoundingBox box );
public bool Contains(OrientedBoundingBox other) { return(NativeMethods.obb_contains_obb(this, other)); }
public bool Intersects(OrientedBoundingBox other) { return(NativeMethods.obb_intersects_obb(this, other)); }
public static extern float obb_distance( [In][Out] OrientedBoundingBox box, Vector3 point );
public static extern void obb_point_inside( [In][Out] OrientedBoundingBox box, float x, float y, float z, out Vector3 point );
public static extern void obb_point_on_edge( [In][Out] OrientedBoundingBox box, int index, float u, out Vector3 point );
public static extern bool obb_contains_obb( [In][Out] OrientedBoundingBox box, OrientedBoundingBox other );
public static extern void obb_edge( [In][Out] OrientedBoundingBox box, int index, out Line segment );
public static extern bool obb_intersects_line_segment( [In][Out] OrientedBoundingBox box, Line other );
public static extern void obb_world_to_local( [In][Out] OrientedBoundingBox box, out Matrix3X4 local );
public static extern bool obb_intersects_plane( [In][Out] OrientedBoundingBox box, Plane other );
public static extern void obb_local_to_world( [In][Out] OrientedBoundingBox box, out Matrix3X4 world );