コード例 #1
0
ファイル: AngleHelper.cs プロジェクト: IanMadlenya/VisualSail
        public static ProjectedPoint PolarToRectangular(ProjectedPoint origin, double theta, double r)
        {
            ProjectedPoint result = new ProjectedPoint();

            result.Easting   = r * Math.Cos(theta);
            result.Northing  = r * Math.Sin(theta);
            result.Easting  += origin.Easting;
            result.Northing += origin.Northing;
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Project a point from word-space to screen-space
        /// </summary>
        public virtual ProjectedPoint Project(Vector3 point)
        {
            var result = new ProjectedPoint
            {
                Distance = Vector3.Distance(Position, point),
            };

            // Project point to cube space
            var projection = Matrix.Multiply(point, _viewMatrix).DivideByW();

            // Clip points outside of view
            if (Clip(projection))
            {
                result.Visibility = ProjectedPoint.PointVisibility.Clipped;
            }

            // Fit results between 0-1
            result.Position = Matrix.Multiply(projection, ViewPortMatrix).ToVector3();

            return(result);
        }
コード例 #3
0
ファイル: AngleHelper.cs プロジェクト: IanMadlenya/VisualSail
 public static double FindAngleWTF(ProjectedPoint a, ProjectedPoint b)
 {
     return(-Math.Atan2(a.Northing - b.Northing, a.Easting - b.Easting));
 }
コード例 #4
0
        private Vector3 ProjectedPointToWorld(ProjectedPoint point, CameraMan cameraMan)
        {
            Vector3 v = new Vector3((float)point.Northing, (float)point.Height, (float)point.Easting);

            return(v);
        }