Canguro.Analysis.ExtrudedShape.Extrusion.computeLocalSystem C# (CSharp) Метод

computeLocalSystem() приватный статический Метод

Builds a local system on the line
private static computeLocalSystem ( System.Vector3 line, System.Vector3 origAxes ) : System.Vector3[]
line System.Vector3 This is the direction that must be followed
origAxes System.Vector3
Результат System.Vector3[]
            private static Vector3[] computeLocalSystem(Vector3 line, Vector3[] origAxes)
            {
                float zn;
                // Cortesia del hippie-comeflores y reconfigurada para la extrusion
                Vector3[] localAxes = new Vector3[3];

                // Longitudinal axis
                localAxes[2] = Vector3.Normalize(line);

                // Check if the vector and the beam axes try to follow Z axis
                zn = Vector3.Dot(localAxes[2], origAxes[2]);

                // Calculate projection of Z and n. Try to find local 2 axis following Z
                //zn = Vector3.Dot(k, localAxes[2]);

                // Axis parallel to Z (Dot product near maximum value equals parallelism)
                if (Math.Abs(zn) > 0.999999)
                {
                    // Local Axis 2 = X and 3 = +/- Y
                    localAxes[0] = origAxes[0];
                    localAxes[1] = origAxes[1];
                    localAxes[2] = origAxes[2];
                }
                else
                {
                    // Local 2 equals the difference between the projected Z at n and Z
                    localAxes[0] = Vector3.Normalize(origAxes[2] - Vector3.Scale(localAxes[2], zn));
                    localAxes[1] = Vector3.Cross(localAxes[0], localAxes[2]);
                }

                return localAxes;
            }
ExtrudedShape.Extrusion