Exemple #1
0
        /**
         * Gets the face area
         *
         * @return face area
         */
        public double getArea()
        {
            //area = (a * c * sen(B))/2
            Point3d  p1 = v1.getPosition();
            Point3d  p2 = v2.getPosition();
            Point3d  p3 = v3.getPosition();
            Vector3d xy = new Vector3d(p2.x - p1.x, p2.y - p1.y, p2.z - p1.z);
            Vector3d xz = new Vector3d(p3.x - p1.x, p3.y - p1.y, p3.z - p1.z);

            double a = p1.distance(p2);
            double c = p1.distance(p3);
            double B = xy.angle(xz);

            return((a * c * Math.Sin(B)) / 2d);
        }
Exemple #2
0
        //--------------------------------OTHERS----------------------------------------//

        /**
         * Computes the distance from the line point to another point
         *
         * @param otherPoint the point to compute the distance from the line point. The point
         * is supposed to be on the same line.
         * @return points distance. If the point submitted is behind the direction, the
         * distance is negative
         */
        public double computePointToPointDistance(Point3d otherPoint)
        {
            double   distance = otherPoint.distance(point);
            Vector3d vec      = new Vector3d(otherPoint.x - point.x, otherPoint.y - point.y, otherPoint.z - point.z);

            vec.normalize();
            if (vec.dot(direction) < 0)
            {
                return(-distance);
            }
            else
            {
                return(distance);
            }
        }