Esempio n. 1
0
        // Rotate a vector
        // @param v the vector to be rotated
        // @returns the resulting rotated vector
        public Vector3D Rotate(Vector3D v)
        {
            Vector3D _i    = this.Imaginary();
            Vector3D _n    = new Vector3D(Vector3D.VectorProduct(_i, v));
            Vector3D delta = new Vector3D(_r * _n - (Vector3D.VectorProduct(_n, _i)));

            return(new Vector3D(v + 2.0f * delta));
        }
Esempio n. 2
0
        // Rotate a line segment.
        // param l the line segment to be rotated
        // @returns the resulting rotated line segment
        public LineSeg3D Rotate(LineSeg3D l)
        {
            // Simply rotate both lines
            Vector3D  i      = this.Imaginary();
            Vector3D  ns     = new Vector3D(Vector3D.VectorProduct(i, l.StartPoint()));
            Vector3D  ne     = new Vector3D(Vector3D.VectorProduct(i, l.EndPoint()));
            Vector3D  deltas = new Vector3D(_r * ns - (Vector3D)(Vector3D.VectorProduct(ns, i)));
            Vector3D  deltae = new Vector3D(_r * ne - (Vector3D)(Vector3D.VectorProduct(ne, i)));
            LineSeg3D result = new LineSeg3D(l.StartPoint() + 2.0f * deltas, l.EndPoint() + 2.0f * deltae);

            return(result);
        }