static Vertex getMin(Vertex min, Vertex cur)
 {
     min.x = min.x < cur.x ? min.x : cur.x;
     min.y = min.y < cur.y ? min.y : cur.y;
     min.z = min.z < cur.z ? min.z : cur.z;
     return min;
 }
 static Vertex getMax(Vertex max, Vertex cur)
 {
     max.x = max.x > cur.x ? max.x : cur.x;
     max.y = max.y > cur.y ? max.y : cur.y;
     max.z = max.z > cur.z ? max.z : cur.z;
     return max;
 }
Beispiel #3
0
 static Vertex snapVertex(Vertex v, double snap)
 {
     v.x = Math.Round(v.x / snap) * snap;
     v.y = Math.Round(v.y / snap) * snap;
     v.z = Math.Round(v.z / snap) * snap;
     return v;
 }
Beispiel #4
0
 static Vertex scaleVertex(Vertex v, double scale)
 {
     v.x *= scale;
     v.y *= scale;
     v.z *= scale;
     return v;
 }
Beispiel #5
0
        static int getVertex(Model m, string line)
        {
            string[] strArr = line.Trim().Split(' ').Last().Split(',');

            if (strArr.Length != 3){
                throw new Exception("Vertex with an incorrect amount of arguments (3).\n" + line);
            }

            Vertex v = new Vertex(getNr(strArr[0]), getNr(strArr[1]), getNr(strArr[2]));

            int id = m.vertices.IndexOf(v);
            if (id == -1){
                m.vertices.Add(v);
                return m.vertices.LastIndexOf(v);
            }
            return id;
        }
Beispiel #6
0
 static void writeVertex(String name, Vertex v, StreamWriter w)
 {
     w.WriteLine("      " + name + " " + formatNr(v.x) + "," + formatNr(v.y) + "," + formatNr(v.z));
 }
 static string write(string name, Vertex v)
 {
     return name + "[" + v.x + ", " + v.y + ", " + v.z + "]\n";
 }
Beispiel #8
0
 internal static Vertex cross(Vertex v1, Vertex v2)
 {
     return new Vertex(v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, v1.x * v2.y - v1.y * v2.x);
 }