private static Visual3D CreateCuboidView(Point3D Center, double Width, double Height, double Depth, Vector3D W, Vector3D H, Vector3D D, SnappedPrimitive snappedPrimitive) { Point3D[] Pnts = new Point3D[8]; Pnts[0] = new Point3D(-Width / 2, Height / 2, -Depth / 2); Pnts[1] = new Point3D(Width / 2, Height / 2, -Depth / 2); Pnts[2] = new Point3D(Width / 2, -Height / 2, -Depth / 2); Pnts[3] = new Point3D(-Width / 2, -Height / 2, -Depth / 2); Pnts[4] = new Point3D(-Width / 2, Height / 2, Depth / 2); Pnts[5] = new Point3D(Width / 2, Height / 2, Depth / 2); Pnts[6] = new Point3D(Width / 2, -Height / 2, Depth / 2); Pnts[7] = new Point3D(-Width / 2, -Height / 2, Depth / 2); double[][] P = FindTransformationMatrix(W, H, D); TransformPoints(Pnts, Center, P); Int32Collection Idx = new Int32Collection(); Idx.AddMany(0, 2, 1); Idx.AddMany(0, 3, 2); Idx.AddMany(6, 5, 2); Idx.AddMany(2, 5, 1); Idx.AddMany(4, 5, 6); Idx.AddMany(4, 6, 7); Idx.AddMany(4, 7, 3); Idx.AddMany(4, 3, 0); Idx.AddMany(5, 4, 0); Idx.AddMany(5, 0, 1); Idx.AddMany(7, 6, 3); Idx.AddMany(2, 3, 6); var geometry = new MeshGeometry3D(); geometry.Positions = new Point3DCollection(Pnts); geometry.TriangleIndices = Idx; return(CreateVisual(geometry, snappedPrimitive)); }