Beispiel #1
0
        public Vec3f Normal(int edgeIdx)
        {
            Vec3f d1 = GetEdgeDelta(edgeIdx);
            Vec3f d2 = GetEdgeDelta(Next(edgeIdx));

            Vec3f norm = Vec3f.Cross(d1, d2);

            return(norm.Normalized());
        }
Beispiel #2
0
        public static Vec3f ClosestPointToPoint(float planeDistance, Vec3f planeNormal, Vec3f point)
        {
            float distance;
            Vec3f translationVector;

            distance = -SignedDistanceToPoint(planeDistance, planeNormal, point);

            translationVector = planeNormal.Normalized() * distance;

            return(point + translationVector);
        }
Beispiel #3
0
        public Vec3f Normal(int vIdx1, int vIdx2, int vIdx3)
        {
            var v1 = Points[vIdx1];
            var v2 = Points[vIdx2];
            var v3 = Points[vIdx3];

            Vec3f d1 = v2 - v1;
            Vec3f d2 = v3 - v1;

            Vec3f norm = Vec3f.Cross(d1, d2);

            return(norm.Normalized());
        }
Beispiel #4
0
 public void SetLightDirection(Vec3f direction)
 {
     SunDirection = -direction.Normalized();
 }
Beispiel #5
0
 public void SetNormal(Vec3f direction)
 {
     Normal = direction.Normalized();
 }