public ModelPanel() { _camera = new GLCamera(); this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ModelPanel_MouseDown); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ModelPanel_MouseMove); this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ModelPanel_MouseUp); }
public Vector3 TraceZ(Vector3 point, float z) { GLCamera camera = CurrentViewport.Camera; if (camera == null) { return(new Vector3()); } double a = point._z - z; //Perform trig functions, using camera for angles //Get angle, truncating to MOD 180 //double angleX = _camera._rotation._y - ((int)(_camera._rotation._y / 180.0) * 180); double angleX = Math.IEEERemainder(-camera._rotation._y, 180.0); if (angleX < -90.0f) { angleX = -180.0f - angleX; } if (angleX > 90.0f) { angleX = 180.0f - angleX; } double angleY = Math.IEEERemainder(camera._rotation._x, 180.0); if (angleY < -90.0f) { angleY = -180.0f - angleY; } if (angleY > 90.0f) { angleY = 180.0f - angleY; } float lenX = (float)(Math.Tan(angleX * Math.PI / 180.0) * a); float lenY = (float)(Math.Tan(angleY * Math.PI / 180.0) * a); return(new Vector3(point._x + lenX, point._y + lenY, z)); }