Esempio n. 1
0
        internal static Vector3Class GetPixelPointFromModelPoint(Vector3Class modelPoint, AtumPrinter selectedPrinter)
        {
            int hxres = RenderEngine.PrintJob.SelectedPrinter.ProjectorResolutionX / 2;
            int hyres = RenderEngine.PrintJob.SelectedPrinter.ProjectorResolutionY / 2;

            return(new Vector3Class((float)(modelPoint.X * 10.0) + 1 + hxres, (float)(modelPoint.Y * 10.0) + 1 + hyres, modelPoint.Z));
        }
Esempio n. 2
0
    public Vector3Class Normalize(Vector3Class v)
    {
        float        sizeOfV     = Mathf.Sqrt(Mathf.Pow(v.x, 2) + Mathf.Pow(v.y, 2) + Mathf.Pow(v.z, 2));
        Vector3Class normalizedV = new Vector3Class(v.x / sizeOfV, v.y / sizeOfV, v.z / sizeOfV);

        return(normalizedV);
    }
Esempio n. 3
0
 internal static void FilteredByLowestPointOffsetLowerThenLowerPointTop(ConcurrentDictionary <LowestPointPolygon, Dictionary <float, List <PolyNode> > > lowestPointsContours, STLModel3D stlModel)
 {
     foreach (var lowestPointContourItem in lowestPointsContours)
     {
         foreach (var contourOffsetItem in lowestPointContourItem.Key.LowestPointsWithOffset)
         {
             //add lowest point support cones
             foreach (var supportPoint in contourOffsetItem.Value)
             {
                 var triangleIntersectionBelow = new Vector3Class();
                 if (supportPoint.Filter == typeOfAutoSupportFilter.None)
                 {
                     var triangleIntersection = Convert2DSupportPointToIntersectionTriangle(stlModel, supportPoint.Point, lowestPointContourItem.Key.SliceHeight, triangleIntersectionBelow);
                     var intersectedData      = new MagsAIIntersectionData()
                     {
                         BottomPoint = triangleIntersectionBelow, TopPoint = triangleIntersection.IntersectionPoint, SliceHeight = lowestPointContourItem.Key.SliceHeight
                     };
                     if (!lowestPointContourItem.Key.LowestPointsWithOffsetIntersectionPoint.ContainsKey(contourOffsetItem.Key))
                     {
                         lowestPointContourItem.Key.LowestPointsWithOffsetIntersectionPoint.Add(contourOffsetItem.Key, new List <MagsAIIntersectionData>());
                     }
                     lowestPointContourItem.Key.LowestPointsWithOffsetIntersectionPoint[contourOffsetItem.Key].Add(intersectedData);
                     if (triangleIntersection.IntersectionPoint.Z < lowestPointContourItem.Key.LowestIntersectionPointsTop)
                     {
                         intersectedData.Filter = typeOfAutoSupportFilter.FilteredByLowestPointOffsetLowerThenLowerPointTop;
                     }
                 }
             }
         }
     }
 }
Esempio n. 4
0
 internal ISectData(object o, Triangle p, Vector3Class isect, Vector3Class orgin, Vector3Class dir)
 {
     intersect = new Vector3Class(isect);
     origin    = new Vector3Class(orgin);
     direction = new Vector3Class(dir);
     poly      = p;
 }
Esempio n. 5
0
        private void Rotate(float angleY, float angleZ, TriangleInfoList triangles)
        {
            Matrix4 rotationMatrix = Matrix4.CreateRotationY(OpenTK.MathHelper.DegreesToRadians(angleY));

            for (var arrayIndex = 0; arrayIndex < triangles.Count; arrayIndex++)
            {
                for (var triangleIndex = 0; triangleIndex < triangles[arrayIndex].Count; triangleIndex++)
                {
                    for (var vectorIndex = 0; vectorIndex < 3; vectorIndex++)
                    {
                        var rotatedVector = Vector3Class.Transform(triangles[arrayIndex][triangleIndex].Vectors[vectorIndex].Position, rotationMatrix);
                        triangles[arrayIndex][triangleIndex].Vectors[vectorIndex].Position = rotatedVector;
                    }
                }
            }

            rotationMatrix = Matrix4.CreateRotationZ(OpenTK.MathHelper.DegreesToRadians(angleZ));

            for (var arrayIndex = 0; arrayIndex < triangles.Count; arrayIndex++)
            {
                for (var triangleIndex = 0; triangleIndex < triangles[arrayIndex].Count; triangleIndex++)
                {
                    for (var vectorIndex = 0; vectorIndex < 3; vectorIndex++)
                    {
                        var rotatedVector = Vector3Class.Transform(triangles[arrayIndex][triangleIndex].Vectors[vectorIndex].Position, rotationMatrix);
                        triangles[arrayIndex][triangleIndex].Vectors[vectorIndex].Position = rotatedVector;
                    }
                }
            }
        }
Esempio n. 6
0
        internal static void CalculateByModel(STLModel3D model, AtumPrinter selectedPrinter)
        {
            //convert polynode to pixel values
            for (var arrayIndex = 0; arrayIndex < model.Triangles.Count; arrayIndex++)
            {
                for (var triangleIndex = 0; triangleIndex < model.Triangles[arrayIndex].Count; triangleIndex++)
                {
                    for (var vectorIndex = 0; vectorIndex < 3; vectorIndex++)
                    {
                        var pixelPoint  = Helpers.VectorHelper.GetPixelPointFromModelPoint(model.Triangles[arrayIndex][triangleIndex].Points[vectorIndex], selectedPrinter);
                        var pixelPointX = (int)Math.Round(pixelPoint.X, 0);
                        var pixelPointY = (int)Math.Round(pixelPoint.Y, 0);

                        //transform pixelPoint
                        if (pixelPointX >= selectedPrinter.ProjectorResolutionX)
                        {
                            pixelPointX = selectedPrinter.ProjectorResolutionX - 1;
                        }

                        if (pixelPointY >= selectedPrinter.ProjectorResolutionY)
                        {
                            pixelPointY = selectedPrinter.ProjectorResolutionY - 1;
                        }
                        var transformedPixelPoint = selectedPrinter.LensWarpingCorrection.TransformationVectors[pixelPointX, pixelPointY];

                        pixelPoint = new Vector3Class(transformedPixelPoint.X, transformedPixelPoint.Y, pixelPoint.Z);

                        //pixelPoint to 3d space point
                        var modelPoint = Helpers.VectorHelper.GetModelPointFromPixelPoint(pixelPoint, selectedPrinter);
                        model.Triangles[arrayIndex][triangleIndex].Vectors[vectorIndex].Position = modelPoint;
                    }
                }
            }
        }
Esempio n. 7
0
        /* Simulates the forward kinematics,
         * given a solution. */


        public PositionRotation ForwardKinematics(float[] Solution)
        {
            Vector3Class prevPoint = new Vector3Class(Joints[0].transform.position);

            // Takes object initial rotation into account
            QuaternionClass rotation = new QuaternionClass();

            rotation.SetValues(transform.rotation);
            for (int i = 1; i < Joints.Length; i++)
            {
                QuaternionClass angleAxis = new QuaternionClass();
                angleAxis.convertFromAxisAngle(Joints[i - 1].Axis, Solution[i - 1]);

                rotation *= angleAxis;
                Vector3Class nextPoint = prevPoint + rotation.multiplyVec3(rotation, Joints[i].StartOffset);

                if (DebugDraw)
                {
                    Debug.DrawLine(prevPoint.GetValues(), nextPoint.GetValues(), Color.blue);
                }

                prevPoint = nextPoint;
            }

            // The end of the effector
            return(new PositionRotation(prevPoint, rotation));
        }
Esempio n. 8
0
        internal static void CalcRotationAnglesYZFromVector(Vector3Class vector, bool inverseOrigin, out float zAngle, out float yAngle)
        {
            //first get X angle
            zAngle = OpenTK.MathHelper.RadiansToDegrees((float)Math.Atan2(vector.Y, vector.X));

            if (Math.Round(vector.Y, 2) == 0.00d)
            {
                zAngle = 0;
            }

            //before calc y angle rotate vector using xAngle transform
            Matrix4 rotationMatrix = Matrix4.CreateRotationZ(OpenTK.MathHelper.DegreesToRadians(-zAngle));

            var rotatedVector = Vector3Class.Transform(vector, rotationMatrix);
            var yAngleNormal  = inverseOrigin ? -90 : 90;

            yAngle = yAngleNormal - OpenTK.MathHelper.RadiansToDegrees((float)Math.Atan2(rotatedVector.Z, rotatedVector.X));

            if (Math.Round(1 - vector.Z, 2) == 0.00d)
            {
                yAngle = 0;
            }

            if (yAngle == 360)
            {
                yAngle = 0;
            }
        }
Esempio n. 9
0
        internal static bool HasTriangleOverhangSide(Triangle triangle, out Vector3Class vector1, out Vector3Class vector2)
        {
            var result = false;

            vector1 = vector2 = new Vector3Class();

            if (triangle.Normal.Z < 0)
            {
                for (var vectorIndex = 0; vectorIndex < 3; vectorIndex++)
                {
                    var startIndex = vectorIndex - 1;
                    if (startIndex < 0)
                    {
                        startIndex = 2;
                    }
                    var endIndex    = vectorIndex;
                    var vectorAngle = CalcZAngleBetweenPoints(triangle.Vectors[startIndex].Position, triangle.Vectors[endIndex].Position);
                    if ((vectorAngle >= 0 && vectorAngle <= 1) || (vectorAngle >= 179 && vectorAngle <= 181) || (vectorAngle >= 359 && vectorAngle <= 360))
                    {
                        vector1 = triangle.Vectors[startIndex].Position;
                        vector2 = triangle.Vectors[endIndex].Position;
                        return(true);
                    }
                }
            }

            return(result);
        }
Esempio n. 10
0
        public ConeCap(Vector3Class center, List <Vector3Class> capPoints, bool upsideDown)
        {
            for (var capPointIndex = 0; capPointIndex < capPoints.Count; capPointIndex++)
            {
                //create left triagle
                var leftTriangle = new Triangle();
                leftTriangle.Vectors[0].Position = center;
                leftTriangle.Vectors[1].Position = capPoints[capPointIndex];

                if (capPointIndex == capPoints.Count - 1)
                {
                    leftTriangle.Vectors[2].Position = capPoints[0];
                }
                else
                {
                    leftTriangle.Vectors[2].Position = capPoints[capPointIndex + 1];
                }

                if (upsideDown)
                {
                    leftTriangle.Flip();
                }
                leftTriangle.CalcNormal();
                this[0].Add(leftTriangle);
            }
        }
Esempio n. 11
0
    public float maxStretch = 0.3f;          //maximo de lo que se puede estirar un segmento

    void Start()
    {
        //inicializar el line renderer
        lineRenderer = GetComponent <LineRenderer>();
        //recibir las posiciones de los 2 extremos de la cuerda
        Vector3Class initPos = new Vector3Class(pos1.transform.position);
        Vector3Class endPos  = new Vector3Class(pos2.transform.position);

        //generador de los puntos de la cuerda, en resumen hace un vector entre pos1,pos2
        Vector3Class stringVector = endPos - initPos;

        stringVector = stringVector.Normalize(stringVector);

        List <Vector3Class> ropePositions = new List <Vector3Class>();

        //determina el punto inicial de todos los segmentos con
        //"largo segmento * posicion en lista * direccion normalizadapos1pos2 + pos1"
        for (int i = 0; i < stringPartitions; i++)
        {
            Vector3Class partPos = initPos;
            partPos += stringVector * i * stringPartLength;
            ropePositions.Add(partPos);
        }
        //se añaden todos los segmentos con la posicion deseada
        //se introducen los elementos al reves para facilitar algunos calculos
        for (int i = ropePositions.Count - 1; i >= 0; i--)
        {
            ropeSegments.Add(new CilinderBody(ropePositions[i]));
        }
        //actualiza posicion del objeto bola
        pos2.position = ropeSegments[0].pos.GetValues();
    }
Esempio n. 12
0
        public void Translate(Vector3Class translationVector)
        {
            for (var arrayIndex = 0; arrayIndex < this.Count; arrayIndex++)
            {
                for (var triangleIndex = 0; triangleIndex < this[arrayIndex].Count; triangleIndex++)
                {
                    for (var vectorIndex = 0; vectorIndex < 3; vectorIndex++)
                    {
                        this[arrayIndex][triangleIndex].Vectors[vectorIndex].Position += translationVector;
                    }
                }
            }

            //rotate bottom points
            for (var bottomPointIndex = 0; bottomPointIndex < this.BottomPoints.Count; bottomPointIndex++)
            {
                this.BottomPoints[bottomPointIndex] += translationVector;
            }

            //rotate top points
            for (var topPointIndex = 0; topPointIndex < this.TopPoints.Count; topPointIndex++)
            {
                this.TopPoints[topPointIndex] += translationVector;
            }
        }
Esempio n. 13
0
        public void Rotate(float angleY, float angleZ)
        {
            Matrix4 rotationMatrix = Matrix4.CreateRotationY(OpenTK.MathHelper.DegreesToRadians(angleY));

            for (var arrayIndex = 0; arrayIndex < this.Count; arrayIndex++)
            {
                for (var triangleIndex = 0; triangleIndex < this[arrayIndex].Count; triangleIndex++)
                {
                    for (var vectorIndex = 0; vectorIndex < 3; vectorIndex++)
                    {
                        var rotatedVector = Vector3Class.Transform(this[arrayIndex][triangleIndex].Vectors[vectorIndex].Position, rotationMatrix);
                        this[arrayIndex][triangleIndex].Vectors[vectorIndex].Position = rotatedVector;
                    }
                }
            }

            this.Normal = Vector3Class.Transform(this.Normal, rotationMatrix);

            rotationMatrix = Matrix4.CreateRotationZ(OpenTK.MathHelper.DegreesToRadians(angleZ));

            for (var arrayIndex = 0; arrayIndex < this.Count; arrayIndex++)
            {
                for (var triangleIndex = 0; triangleIndex < this[arrayIndex].Count; triangleIndex++)
                {
                    for (var vectorIndex = 0; vectorIndex < 3; vectorIndex++)
                    {
                        var rotatedVector = Vector3Class.Transform(this[arrayIndex][triangleIndex].Vectors[vectorIndex].Position, rotationMatrix);
                        this[arrayIndex][triangleIndex].Vectors[vectorIndex].Position = rotatedVector;
                        this[arrayIndex][triangleIndex].CalcNormal();
                    }
                }
            }

            this.Normal = Vector3Class.Transform(this.Normal, rotationMatrix);
        }
Esempio n. 14
0
 public TriangleIntersection(Triangle triangle, Vector3Class intersectionPoint)
 {
     this.Normal            = triangle.Normal;
     this.Vectors           = triangle.Vectors;
     this.Index             = triangle.Index;
     this.IntersectionPoint = intersectionPoint;
 }
Esempio n. 15
0
        internal static TriangleIntersection CalcNearestTriangle(Vector3Class origin, Vector3Class direction, STLModel3D selectedModel, Vector3Class linkedCloneTranslation)
        {
            TriangleIntersection nearestTriangle = null;

            TriangleIntersection[] intersectedTriangles = null;
            if (selectedModel != null)
            {
                //model
                var intersectedSupportCones = new List <Triangle>();
                var supportDistance         = 50000f;

                var cameraPosition = linkedCloneTranslation != null ? origin : origin;
                if (IntersectionProvider.IntersectTriangle(cameraPosition, direction, selectedModel, IntersectionProvider.typeDirection.OneWay, false, linkedCloneTranslation != null ? linkedCloneTranslation: new Vector3Class(), out intersectedTriangles))
                {
                    if (intersectedTriangles != null)
                    {
                        foreach (var intersectedTriangle in intersectedTriangles)
                        {
                            if (intersectedTriangle != null && intersectedTriangle.IntersectionPoint != null)
                            {
                                var cameraDistance = (SceneView.CameraPosition - intersectedTriangle.IntersectionPoint).Length;
                                if (cameraDistance < supportDistance)
                                {
                                    supportDistance = cameraDistance;

                                    nearestTriangle = intersectedTriangle;
                                }
                            }
                        }
                    }
                }
            }

            return(nearestTriangle);
        }
Esempio n. 16
0
 public void ApproachTarget(Vector3Class target)
 {
     for (int i = 0; i < Solution.Length; i++)
     {
         float pendent = CalculateGradient(target, Solution, i, DeltaGradient);
         Solution[i] -= LearningRate * pendent;
     }
 }
Esempio n. 17
0
    void DrawLines()
    {
        Vector3Class angularVec = new Vector3Class(curAngularVelX, 0, curAngularVelZ);

        angularVec = angularVec.CrossProduct(angularVec, stringVector);

        Debug.DrawLine(pos2.position, angularVec.GetValues(), Color.green);
    }
Esempio n. 18
0
    public float Distance(Vector3Class v1, Vector3Class v2)
    {
        Vector3Class v3 = new Vector3Class();

        v3 = v1 - v2;

        return(v3.Size());
    }
Esempio n. 19
0
    private void CalculateAccelerations()
    {
        //calculamos la fuerza de cada muelle y las guardamos en una lista para luego adjudicarla a los segmentos
        List <Vector3Class> springForces = new List <Vector3Class>();

        for (int i = 0; i < ropeSegments.Count - 1; i++)
        {
            Vector3Class p1p2 = ropeSegments[i + 1].pos - ropeSegments[i].pos;

            //elasticity part
            float part1 = kElasticity * (p1p2.Size() - stringPartLength);

            //Damping part
            float part2 = kDamping * ((p1p2.DotProduct(ropeSegments[i + 1].speed - ropeSegments[i].speed, p1p2.Normalize(p1p2))));

            //calculamos total del muelle juntando las 2 partes
            Vector3Class resultForce = p1p2.Normalize(p1p2);
            resultForce *= (part1 + part2) * -1;

            //al estar el orden de pos2 a pos1, este force es el negativo (f2)
            resultForce *= -1;

            springForces.Add(resultForce);
        }

        for (int i = 0; i < ropeSegments.Count - 1; i++)
        {
            Vector3Class springForce = new Vector3Class();
            //spring que corresponde a F1 de la formula
            if (i != 0)
            {
                springForce -= springForces[i - 1];
            }

            //spring que corresponde a F2 de la formula
            springForce += springForces[i];

            //masa del segmento de la cuerda, hacemos variable a parte para añadir el peso de la bola al ultimo
            float springMass = massRopeSegment;
            //segmento con la bola
            if (i == 0)
            {
                springMass = massLastRopeSegment;
            }

            //creamos fuerza de gravedad con la masa
            Vector3Class gravityForce = new Vector3Class(0f, gravity, 0f);
            gravityForce *= springMass;

            //sumamos ambas fuerzas calculadas
            Vector3Class totalForce = springForce + gravityForce;
            //finalmente, calculamos la aceleracion resultante de la fuerza
            Vector3Class acceleration = totalForce / springMass;
            CilinderBody temp         = ropeSegments[i];
            temp.acc        = acceleration;
            ropeSegments[i] = temp;
        }
    }
Esempio n. 20
0
        private void RoateGeometry()
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            double num  = double.Parse(this.spinEditX.EditValue.ToString());
            double num2 = double.Parse(this.spinEditY.EditValue.ToString());
            double num3 = double.Parse(this.spinEditZ.EditValue.ToString());

            if (num == 0.0 && num2 == 0.0 && num3 == 0.0)
            {
                return;
            }
            num  = 3.14 * num / 180.0;
            num2 = 3.14 * num2 / 180.0;
            num3 = 3.14 * num3 / 180.0;
            if (this._connInfo == null || this._oid == -1)
            {
                return;
            }
            Gvitech.CityMaker.FdeCore.IFeatureClass featureClass = null;
            try
            {
                featureClass = this._connInfo.GetFeatureClass();
                IFeatureLayer featureLayer = this._connInfo.GetFeatureLayer();
                Gvitech.CityMaker.FdeCore.IRowBuffer row = featureClass.GetRow(this._oid);
                int num4 = row.FieldIndex(featureLayer.GeometryFieldName);
                if (num4 != -1)
                {
                    IGeometry geometry = row.GetValue(num4) as IGeometry;
                    if (geometry != null)
                    {
                        IVector3 vector = new Vector3Class();
                        vector.Set(1.0, 0.0, 0.0);
                        app.Current3DMapControl.ObjectEditor.Rotate(vector, geometry.Envelope.Center, num);
                        vector.Set(0.0, 1.0, 0.0);
                        app.Current3DMapControl.ObjectEditor.Rotate(vector, geometry.Envelope.Center, num2);
                        vector.Set(0.0, 0.0, 1.0);
                        app.Current3DMapControl.ObjectEditor.Rotate(vector, geometry.Envelope.Center, num3);
                    }
                }
            }
            catch (System.Exception)
            {
            }
            finally
            {
                //if (featureClass != null)
                //{
                //    System.Runtime.InteropServices.Marshal.ReleaseComObject(featureClass);
                //    featureClass = null;
                //}
            }
        }
Esempio n. 21
0
    //ANGULO EN Z
    public void SetInitAngleZ()
    {
        inAngleZInput.text = initAngleZSlider.value.ToString();

        Vector3Class pendulumAngle = new Vector3Class(pendulum.transform.localEulerAngles);

        pendulumAngle.z = initAngleZSlider.GetComponent <Slider>().value;
        pendulum.NewPendulumAngle(pendulumAngle);
    }
Esempio n. 22
0
    public void InputSetInitAngleZ()
    {
        initAngleZSlider.value = float.Parse(inAngleZInput.text);

        Vector3Class pendulumAngle = new Vector3Class(pendulum.transform.localEulerAngles);

        pendulumAngle.z = float.Parse(inAngleZInput.GetComponent <InputField>().text);
        pendulum.NewPendulumAngle(pendulumAngle);
    }
Esempio n. 23
0
    public void convertFromAxisAngle(Vector3Class axis, float a)
    {
        a = a / 360 * (float)Mathf.PI * 2;
        w = Mathf.Cos(a / 2); //si w es menor que 0, l'angle es major que pi (LUL)

        x = axis.x * Mathf.Sin(a / 2);
        y = axis.y * Mathf.Sin(a / 2);
        z = axis.z * Mathf.Sin(a / 2);
    }
Esempio n. 24
0
    public static Vector3Class operator -(Vector3Class v1, Vector3Class v2)
    {
        Vector3Class v3 = new Vector3Class();

        v3.x = v1.x - v2.x;
        v3.y = v1.y - v2.y;
        v3.z = v1.z - v2.z;
        return(v3);
    }
Esempio n. 25
0
    public Vector3Class CrossProduct(Vector3Class v1, Vector3Class v2)
    {
        Vector3Class v3 = new Vector3Class();

        //sarrus
        v3.x = (v1.y * v2.z) - (v1.z * v2.y);
        v3.y = (-1 * (v1.x * v2.z)) + (v1.z * v2.x);
        v3.z = (v1.x * v2.y) - (v1.y * v2.z);
        return(v3);
    }
Esempio n. 26
0
        internal static Vector3Class GetModelPointFromPixelPoint(Vector3Class pixelPoint, AtumPrinter selectedPrinter)
        {
            int hxres = RenderEngine.PrintJob.SelectedPrinter.ProjectorResolutionX / 2;
            int hyres = RenderEngine.PrintJob.SelectedPrinter.ProjectorResolutionY / 2;

            pixelPoint    = pixelPoint - new Vector3Class(hxres + 1, hyres + 1, 0);
            pixelPoint.X /= 10f;
            pixelPoint.Y /= 10f;

            return(pixelPoint);
        }
Esempio n. 27
0
        private Vector3Class Rotate(float angleY, float angleZ, Vector3Class vector)
        {
            Matrix4 rotationMatrix = Matrix4.CreateRotationY(OpenTK.MathHelper.DegreesToRadians(angleY));

            vector = Vector3Class.Transform(vector, rotationMatrix);

            rotationMatrix = Matrix4.CreateRotationZ(OpenTK.MathHelper.DegreesToRadians(angleZ));
            vector         = Vector3Class.Transform(vector, rotationMatrix);

            return(vector);
        }
Esempio n. 28
0
        public static bool IsSameDirection(Vector3Class vector1, Vector3Class vector2)
        {
            var result = false;

            if (Vector3Class.Dot(vector1, vector2) > 0)
            {
                result = true;
            }

            return(result);
        }
Esempio n. 29
0
        public OrbitCameraController(Vector3Class targetCenter)
        {
            _view              = Matrix4.CreateFromAxisAngle(new Vector3(0f, 0f, 1f), 0.0001f);
            _viewWithOffset    = Matrix4.Identity;
            _cameraDistance    = InitialCameraDistance;
            _targetCenterPoint = targetCenter;

            _right = Vector3.UnitX;
            _up    = Vector3.UnitZ;
            _front = Vector3.UnitY;
        }
Esempio n. 30
0
        private static float CalcZAngleBetweenPoints(Vector3Class vector1, Vector3Class vector2)
        {
            float zDiff   = vector2.Z - vector1.Z;
            float xLength = (vector2 - new Vector3Class(0, 0, zDiff) - vector1).Length;
            var   zAngle  = (float)(Math.Atan2(zDiff, xLength) * 180.0 / Math.PI);

            if (zAngle < 0)
            {
                zAngle = 360 - -zAngle;
            }
            return(zAngle);
        }