Ejemplo n.º 1
0
        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);
        }
        /// <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);
        }
Ejemplo n.º 3
0
 public static double FindAngleWTF(ProjectedPoint a, ProjectedPoint b)
 {
     return(-Math.Atan2(a.Northing - b.Northing, a.Easting - b.Easting));
 }
Ejemplo n.º 4
0
        private Vector3 ProjectedPointToWorld(ProjectedPoint point, CameraMan cameraMan)
        {
            Vector3 v = new Vector3((float)point.Northing, (float)point.Height, (float)point.Easting);

            return(v);
        }