Exemple #1
0
        //---------------------------------------------------------------------------------------------
        //Поворот параллельно плоскости XY
        protected Point3D[] RotateParallelToPlaneXY(
            Point3D[] points,
            RealVector planeNormalVector
            )
        {
            RealVector[] coordinatesVectors = SpaceManager.GetCoordinatesVectors(points);
            RealVector[] newVectors;

            RealVector currentPlaneNormalVector = planeNormalVector;

            double rotationAngleAroundAxisX =
                Math.Atan(planeNormalVector[1] / planeNormalVector[2]);
            RealMatrix rotationMatrixAroundAxisX =
                SpaceManager.GetRotationMatrixAroundAxisX(rotationAngleAroundAxisX);

            newVectors =
                SpaceManager.RotateVectors(coordinatesVectors, rotationMatrixAroundAxisX);

            currentPlaneNormalVector =
                SpaceManager.RotateVector(currentPlaneNormalVector, rotationMatrixAroundAxisX);

            double rotationAngleAroundAxisY =
                -Math.Atan(currentPlaneNormalVector[0] / currentPlaneNormalVector[2]);
            RealMatrix rotationMatrixAroundAxisY =
                SpaceManager.GetRotationMatrixAroundAxisY(rotationAngleAroundAxisY);

            newVectors =
                SpaceManager.RotateVectors(newVectors, rotationMatrixAroundAxisY);

            Point3D[] newPoints = SpaceManager.CreatePoints3DFromVectors(newVectors);
            return(newPoints);
        }
        //---------------------------------------------------------------------------------------------
        //---------------------------------------------------------------------------------------------
        //---------------------------------------------------------------------------------------------
        //Повернуть точки
        private Point3D[] RotatePoints(Point3D[] points, RealMatrix rotationMatrix)
        {
            RealVector[] vectors        = SpaceManager.GetCoordinatesVectors(points);
            RealVector[] rotatedVectors = SpaceManager.RotateVectors(vectors, rotationMatrix);

            this.RotatedVectors = rotatedVectors; //debug

            Point3D[] rotatedPoints = SpaceManager.CreatePoints3DFromVectors(rotatedVectors);
            return(rotatedPoints);
        }