Beispiel #1
0
        public void CalculateFlatNormals()
        {
            if (!(this.Owner is Mesh mesh))
            {
                throw new InvalidOperationException();
            }

            this.Normals.Clear();

            this.MappingMode   = MappingMode.ByPolygon;
            this.ReferenceMode = ReferenceMode.Direct;

            foreach (Polygon item in mesh.Polygons)
            {
                XYZ normal = XYZ.FindNormal(
                    mesh.Vertices[item.ToArray()[0]],
                    mesh.Vertices[item.ToArray()[1]],
                    mesh.Vertices[item.ToArray()[2]]);

                this.Normals.Add(normal.Normalize());
            }
        }