public XmlVertex(Rhino.Geometry.Point3f v, Rhino.Geometry.Vector3f n) { position = new XmlPosition() { x = v.X, y = v.Y, z = v.Z }; normal = new XmlNormal() { x = n.X, y = n.Y, z = n.Z }; }
public static Vector3f ToVec3f(this Rhino.Geometry.Point3f rhPt) { return(new Vector3f(rhPt.X, rhPt.Y, rhPt.Z)); }
public void Insert_Mesh_Sections(Rhino.Geometry.Mesh[] M) { Sem_custom_mesh.WaitOne(); int ct = 0; m_templateC = new Rhino.Geometry.Mesh(); m_referenceC = new System.Collections.Generic.List <Node>(); double rt2 = Math.Sqrt(2); Hare.Geometry.Point min = RDD_Location(Bounds.Min_PT, 0, 0, 0, dx, dy, dz); foreach (Rhino.Geometry.Mesh m in M) { foreach (Rhino.Geometry.MeshFace mf in m.Faces) { //Find the centroid of the face... Rhino.Geometry.Point3f p = new Rhino.Geometry.Point3f(m.Vertices[mf.A].X + m.Vertices[mf.B].X + m.Vertices[mf.C].X, m.Vertices[mf.A].Y + m.Vertices[mf.B].Y + m.Vertices[mf.C].Y, m.Vertices[mf.A].Z + m.Vertices[mf.B].Z + m.Vertices[mf.C].Z); //Record this face as an individual entity. if (mf.IsQuad) { p = new Rhino.Geometry.Point3f((p.X + m.Vertices[mf.D].X) / 4, (p.Y + m.Vertices[mf.D].Y) / 4, (p.Z + m.Vertices[mf.D].Z) / 4); } else { p = new Rhino.Geometry.Point3f(p.X / 3, p.Y / 3, p.Z / 3); } //Identify the corresponding cell... Hare.Geometry.Point hp = new Hare.Geometry.Point(p.X, p.Y, p.Z); int[] loc = RDD_Location(hp); if (loc[0] < 0 || loc[0] >= this.PFrame.Length) { continue; } if (loc[1] < 0 || loc[1] >= this.PFrame[loc[0]].Length) { continue; } if (loc[2] < 0 || loc[2] >= this.PFrame[loc[0]][loc[1]].Length) { continue; } m_templateC.Vertices.Add(m.Vertices[mf.A]); m_templateC.Vertices.Add(m.Vertices[mf.B]); m_templateC.Vertices.Add(m.Vertices[mf.C]); if (mf.IsQuad) { m_templateC.Vertices.Add(m.Vertices[mf.D]); m_templateC.Faces.AddFace(ct, ct + 1, ct + 2, ct + 3); ct += 4; } else { m_templateC.Faces.AddFace(ct, ct + 1, ct + 2); ct += 3; } //Record the reference to the cell that contains this polygon. m_referenceC.Add(this.PFrame[loc[0]][loc[1]][loc[2]]); } } Sem_custom_mesh.Release(); }
static Vector3 ToVector3(ref Rhino.Geometry.Point3f p) => new Vector3(p.X, p.Z, p.Y) * _scale;