internal void OnDeserialized(StreamingContext context) { Edges.ForEach(e => e.Brep = this); Loops.ForEach(l => l.Brep = this); Trims.ForEach(t => t.Brep = this); Faces.ForEach(f => f.Brep = this); //TODO: all the data props to the real props }
public void Serialize(BinaryWriter writer) { Header.Serialize(writer); Vertices.ForEach(vertex => vertex.Serialize(writer)); Normals.ForEach(normal => normal.Serialize(writer)); Faces.ForEach(face => face.Serialize(writer)); SubObjects.ForEach(subObject => subObject.Serialize(writer)); PartAnimations?.ForEach(partAnimation => partAnimation.Serialize(writer)); CollisionPlaneVectors.ForEach(plane => plane.Serialize(writer)); CollisionVolumes.ForEach(volume => volume.Serialize(writer)); Materials.ForEach(material => material.Serialize(writer)); }
public override void Transform(Transformations.IUnitTransformation transform, TransformFlags flags) { Faces.ForEach(f => f.Transform(transform, flags)); // Handle flip transforms / negative scales var origin = GetOrigin(); if (Faces.All(x => x.Plane.OnPlane(origin) >= 0)) { // All planes are facing inwards - flip them all Faces.ForEach(x => x.Flip()); } base.Transform(transform, flags); }
private int CalculateLength() { using (MemoryStream buffer = new MemoryStream()) using (BinaryWriter writer = new BinaryWriter(buffer)) { Vertices.ForEach(vertex => vertex.Serialize(writer)); Normals.ForEach(normal => normal.Serialize(writer)); Faces.ForEach(face => face.Serialize(writer)); SubObjects.ForEach(subObject => subObject.Serialize(writer)); CollisionPlaneVectors.ForEach(collisionPlane => collisionPlane.Serialize(writer)); CollisionVolumes.ForEach(collisionVolume => collisionVolume.Serialize(writer)); Materials.ForEach(material => material.Serialize(writer)); return((int)buffer.Length); } }
public override void Transform(Transformations.IUnitTransformation transform, TransformFlags flags) { Coordinate newStart = transform.Transform(BoundingBox.Start); Coordinate newEnd = transform.Transform(BoundingBox.End); if ((newStart - newEnd).VectorMagnitude() > 1000000m) { return; } Faces.ForEach(f => f.Transform(transform, flags)); // Handle flip transforms / negative scales var origin = GetOrigin(); if (Faces.All(x => x.Plane.OnPlane(origin) >= 0)) { // All planes are facing inwards - flip them all Faces.ForEach(x => x.Flip()); } base.Transform(transform, flags); }
protected Solid(SerializationInfo info, StreamingContext context) : base(info, context) { Faces = ((Face[])info.GetValue("Faces", typeof(Face[]))).ToList(); Faces.ForEach(x => x.Parent = this); }
public void SetHighlights() { Faces.ForEach(f => f.SetHighlights((UInt32)Flags)); }