Ejemplo n.º 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());
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 4
0
 public void SetLightDirection(Vec3f direction)
 {
     SunDirection = -direction.Normalized();
 }
Ejemplo n.º 5
0
 public void SetNormal(Vec3f direction)
 {
     Normal = direction.Normalized();
 }