Example #1
0
        protected Point3D planeNormal(int before, int center, int after)
        {
            Point3D v1 = (new Point3D(puntos[before - 1])) - new Point3D(puntos[center - 1]);
            Point3D v2 = (new Point3D(puntos[after - 1])) - new Point3D(puntos[center - 1]);

            return(v1.CrossProduct(v2).Normalized);
        }
Example #2
0
        public Point3D Rotated(double angle, Point3D axis)
        {
            Point3D l = axis.Scaled(this.ScalarProduct(axis));
            Point3D r = this - l;

            if (r.Norm == 0)
            {
                return(new Point3D(this));
            }
            double cosBeta = Math.Cos(angle * Math.PI / 180);
            double sinBeta = Math.Sin(angle * Math.PI / 180);

            return(l + r.Scaled(cosBeta) + axis.CrossProduct(r).Normalized.Scaled(r.Norm * sinBeta));
        }