public static void Read(this VectorsReader reader, SnappedCuboid cuboid) { cuboid.CenterResult = reader.ReadPoint3D(); cuboid.WidthResult = reader.ReadValue(); cuboid.HeightResult = reader.ReadValue(); cuboid.DepthResult = reader.ReadValue(); cuboid.Wresult = reader.ReadVector3D(); cuboid.Hresult = reader.ReadVector3D(); cuboid.Dresult = reader.ReadVector3D(); }
public static VariableVectorsWriter Write(this VariableVectorsWriter writer, SnappedCuboid cuboid) { return(writer .Write(cuboid.Center) .Write(cuboid.Width) .Write(cuboid.Height) .Write(cuboid.Depth) .Write(cuboid.Wv) .Write(cuboid.Hv) .Write(cuboid.Dv)); }
public static VectorsWriter Write(this VectorsWriter writer, SnappedCuboid cuboid) { return(writer .Write(cuboid.CenterResult) .Write(cuboid.WidthResult) .Write(cuboid.HeightResult) .Write(cuboid.DepthResult) .Write(cuboid.Wresult) .Write(cuboid.Hresult) .Write(cuboid.Dresult)); }
public static Visual3D CreateCuboidView(SnappedCuboid cuboidData) { Contract.Requires(cuboidData != null); Contract.Ensures(Contract.Result <Visual3D>() != null); var visual = new ModelVisual3D(); var meshBuilder = new MeshBuilder(true, true); //meshBuilder.AddBox(cuboidData.CenterResult, cuboidData.WidthResult, cuboidData.HeightResult, cuboidData.DepthResult); //meshBuilder.AddBox(new Point3D(0,0,0), cuboidData.WidthResult, cuboidData.HeightResult, cuboidData.DepthResult); /* * meshBuilder.AddArrow(cuboidData.Origin, cuboidData.Origin + 0.5 * cuboidData.Wresult, 0.05); * var geometry = meshBuilder.ToMesh(); * visual.Children.Add(CreateVisual(geometry, Brushes.Green)); * * meshBuilder = new MeshBuilder(true, true); * meshBuilder.AddArrow(cuboidData.Origin, cuboidData.Origin + 0.5 * cuboidData.Hresult, 0.05); * geometry = meshBuilder.ToMesh(); * visual.Children.Add(CreateVisual(geometry, Brushes.Red)); * * meshBuilder = new MeshBuilder(true, true); * meshBuilder.AddArrow(cuboidData.Origin, cuboidData.Origin + 0.5 * cuboidData.Dresult, 0.05); * geometry = meshBuilder.ToMesh(); * visual.Children.Add(CreateVisual(geometry, Brushes.Blue));*/ Debug.WriteLine(string.Format("After : W*H={0}", Vector3D.DotProduct(cuboidData.Wresult, cuboidData.Hresult))); Debug.WriteLine(string.Format("After : W*D={0}", Vector3D.DotProduct(cuboidData.Wresult, cuboidData.Dresult))); Debug.WriteLine(string.Format("After : D*H={0}", Vector3D.DotProduct(cuboidData.Dresult, cuboidData.Hresult))); //meshBuilder = new MeshBuilder(true, true); //Point3D[] points = geometry.Positions.ToArray(); //TransformPoints(points, cuboidData.CenterResult, -cuboidData.Hresult, -cuboidData.Wresult, cuboidData.Dresult); //geometry.Positions = new Point3DCollection(points); visual.Children.Add(CreateCuboidView(cuboidData.CenterResult, cuboidData.WidthResult, cuboidData.HeightResult, cuboidData.DepthResult, cuboidData.Wresult, cuboidData.Hresult, cuboidData.Dresult, cuboidData)); //return CreateVisual(geometry, cuboidData, false); return(visual); }