Beispiel #1
0
        public static Vk3 rotateY(float rad, Vk3 v1)
        {
            var s = (float)Math.Sin(rad);
            var c = (float)Math.Cos(rad);
            var x = c * v1.x + s * v1.z;
            var z = -s * v1.x + c * v1.z;

            return(new Vk3(x, v1.y, z));
        }
Beispiel #2
0
        public static List <Pt3> getCircPathList(int n)
        {
            var lst = new List <Pt3>();
            Pt3 cen = new Pt3(0, 0, 0);
            var rad = 0.5f;

            for (int i = 0; i <= n; i++)
            {
                var ang = 2 * Math.PI * i / n;
                var v   = new Vk3((float)Math.Sin(ang), 0, (float)Math.Cos(ang));
                lst.Add(cen + rad * v);
            }
            return(lst);
        }
Beispiel #3
0
        float F(optimAnchorPoint oap)
        {
            var v0 = oap.source;

            // scale
            var v1 = new Vk3(v0.x * scavek.x, v0.y * scavek.y, v0.z * scavek.z);
            // rotate (just y for now)
            var v2 = rotateY(rotvek.y, v1);

            // translate
            var v3 = v2 + trnvek;

            var   dt  = v3 - oap.target;
            float err = dt.x * dt.x + dt.y * dt.y + dt.z * dt.z;

            return(err);
        }
Beispiel #4
0
        public static Vk3 operator-(Pt3 a, Pt3 b)
        {
            var v = new Vk3(a.x - b.x, a.y - b.y, a.z - b.z);

            return(v);
        }
Beispiel #5
0
        public static Vk3 operator *(float a, Vk3 b)
        {
            Vk3 v = new Vk3(a * b.x, a * b.y, a * b.z);

            return(v);
        }
Beispiel #6
0
        public static Vk3 operator +(Vk3 a, Vk3 b)
        {
            Vk3 v = new Vk3(a.x + b.x, a.y + b.y, a.z + b.z);

            return(v);
        }
Beispiel #7
0
        public static Vk3 operator -(Vk3 a, Vk3 b)
        {
            Vk3 v = new Vk3(a.x - b.x, a.y - b.y, a.z - b.z);

            return(v);
        }
Beispiel #8
0
 public optimAnchorPoint(string name, Vk3 source, Vk3 target)
 {
     this.name   = name;
     this.source = source;
     this.target = target;
 }