コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public static extern void obb_face_plane(
     [In][Out] OrientedBoundingBox box,
     int index, out Plane plane
     );
コード例 #4
0
 public static extern void obb_random_point_on_surface(
     [In] OrientedBoundingBox box,
     LCG rng,
     out Vector3 outVec
     );
コード例 #5
0
 public static extern bool obb_intersects_ray(
     [In][Out] OrientedBoundingBox box,
     Ray other
     );
コード例 #6
0
 public static extern bool obb_intersects_obb(
     [In][Out] OrientedBoundingBox box,
     OrientedBoundingBox other
     );
コード例 #7
0
 public static extern bool obb_contains_point(
     [In][Out] OrientedBoundingBox box,
     Vector3 other
     );
コード例 #8
0
 public static extern void obb_enclose(
     [In][Out] OrientedBoundingBox box,
     Vector3 point
     );
コード例 #9
0
 public static extern void obb_translate(
     [In][Out] OrientedBoundingBox box,
     Vector3 offset
     );
コード例 #10
0
 public static extern void obb_scale(
     [In][Out] OrientedBoundingBox box,
     Vector3 center, Vector3 factor
     );
コード例 #11
0
 public static extern void obb_face_point(
     [In][Out] OrientedBoundingBox box,
     int index, float u, float v, out Vector3 point
     );
コード例 #12
0
 public static extern void obb_corner_point(
     [In][Out] OrientedBoundingBox box,
     int index, out Vector3 point
     );
コード例 #13
0
 public static extern bool obb_is_degenerate(
     [In][Out] OrientedBoundingBox box
     );
コード例 #14
0
 public static extern bool obb_is_finite(
     [In][Out] OrientedBoundingBox box
     );
コード例 #15
0
 public bool Contains(OrientedBoundingBox other)
 {
     return(NativeMethods.obb_contains_obb(this, other));
 }
コード例 #16
0
 public bool Intersects(OrientedBoundingBox other)
 {
     return(NativeMethods.obb_intersects_obb(this, other));
 }
コード例 #17
0
 public static extern float obb_distance(
     [In][Out] OrientedBoundingBox box,
     Vector3 point
     );
コード例 #18
0
 public static extern void obb_point_inside(
     [In][Out] OrientedBoundingBox box,
     float x, float y, float z, out Vector3 point
     );
コード例 #19
0
 public static extern void obb_point_on_edge(
     [In][Out] OrientedBoundingBox box,
     int index, float u, out Vector3 point
     );
コード例 #20
0
 public static extern bool obb_contains_obb(
     [In][Out] OrientedBoundingBox box,
     OrientedBoundingBox other
     );
コード例 #21
0
 public static extern void obb_edge(
     [In][Out] OrientedBoundingBox box,
     int index, out Line segment
     );
コード例 #22
0
 public static extern bool obb_intersects_line_segment(
     [In][Out] OrientedBoundingBox box,
     Line other
     );
コード例 #23
0
 public static extern void obb_world_to_local(
     [In][Out] OrientedBoundingBox box,
     out Matrix3X4 local
     );
コード例 #24
0
 public static extern bool obb_intersects_plane(
     [In][Out] OrientedBoundingBox box,
     Plane other
     );
コード例 #25
0
 public static extern void obb_local_to_world(
     [In][Out] OrientedBoundingBox box,
     out Matrix3X4 world
     );