Example #1
2
 static Cube()
 {
     var b1 = new MeshBuilder();
     b1.AddBox(new Vector3(0, 0, 0), 1, 1, 1);
     geometry = b1.ToMeshGeometry3D();
 }
Example #2
1
        private bool HasValidStartEnd(int startIndex, int endIndex, Geometry3D geom, out string message)
        {
            message = string.Empty;

            if (startIndex > geom.Colors.Count ||
                endIndex > geom.Colors.Count - 1)
            {
                message = "The start and end indices must be within the bounds of the array.";
                return false;
            }

            if (endIndex < startIndex)
            {
                message = "The end index must be greater than the start index.";
                return false;
            }

            return true;
        }
        static InteractionHandle3D()
        {
            var b1 = new MeshBuilder();
            b1.AddSphere(new Vector3(0.0f, 0.0f, 0), 0.135);
            NodeGeometry = b1.ToMeshGeometry3D();

            var b2 = new MeshBuilder();
            b2.AddCylinder(new Vector3(0, 0, 0), new Vector3(1, 0, 0), 0.05, 32, true, true);
            EdgeHGeometry = b2.ToMeshGeometry3D();

            var b3 = new MeshBuilder();
            b3.AddCylinder(new Vector3(0, 0, 0), new Vector3(0, 1, 0), 0.05, 32, true, true);
            EdgeVGeometry = b3.ToMeshGeometry3D();

            var b4 = new MeshBuilder();
            b4.AddBox(new Vector3(0, 0, 0), 0.175, 0.175, 0.175);
            BoxGeometry = b4.ToMeshGeometry3D();
        }
Example #4
0
        /// <summary>
        /// Returns a line geometry of the axis-aligned bounding-box of the given mesh.
        /// </summary>
        /// <param name="mesh">Input mesh for the computation of the b-box</param>
        /// <returns></returns>
        public static LineGeometry3D GenerateBoundingBox(Geometry3D mesh)
        {
            var bb = global::SharpDX.BoundingBox.FromPoints(mesh.Positions.Array);

            return(GenerateBoundingBox(bb));
        }
Example #5
0
 static Sphere()
 {
     var b1 = new MeshBuilder();
     b1.AddSphere(new Vector3(0, 0, 0), 0.5);
     geometry = b1.ToMeshGeometry3D();
 }
Example #6
0
 /// <summary>
 /// Returns a line geometry of the axis-aligned bounding-box of the given mesh.
 /// </summary>
 /// <param name="mesh">Input mesh for the computation of the b-box</param>
 /// <returns></returns>
 public static LineGeometry3D GenerateBoundingBox(Geometry3D mesh)
 {
     var bb = global::SharpDX.BoundingBox.FromPoints(mesh.Positions.Array);
     return GenerateBoundingBox(bb);
 }
Example #7
0
        /// <summary>
        /// Returns a line geometry of the axis-aligned bounding-box of the given mesh.
        /// </summary>
        /// <param name="mesh">Input mesh for the computation of the b-box</param>
        /// <returns></returns>
        public static LineGeometry3D GenerateBoundingBox(Geometry3D mesh)
        {
            var bb = BoundingBoxExtensions.FromPoints(mesh.Positions);

            return(GenerateBoundingBox(bb));
        }