[ad_1]
I’m at present engaged on a specific challenge the place orthographic and perspective projections are each used interchangably. To maintain the transition between each projection modes considerably seamless, I make use of an adjustable focus level in 3D area. This works very well for my use case, however I’m having a little bit of hassle getting a number of the vector math proper to take care of the space between the digital camera and the given focus level when the consumer is in orthographic mode.
I’ll try to show the issue with a small mock-up drawing under. The precise rendering is in 3D however I do not suppose this specific drawback differs a lot in 2D.
The crimson circle is the main target level. It initially exists at place 1 with a specific distance between it and the digital camera, and I wish to keep this digital camera distance when the main target level is moved to place 2. One approach to accomplish that is to use the identical translation to the digital camera as the main target level, however I do not need the view itself to visibly shift. What I feel I must do is challenge the digital camera alongside its ahead vector by an unknown quantity, in order that it reaches one of many blue line positions in order that the space between place 2 and the digital camera continues to be the identical. That ‘unknown’ distance is what I’m making an attempt to resolve. It appears that projecting the delta of the 2 positions alongside the digital camera’s ahead vector shouldn’t be sufficient.
While I understand how to seek out the closest distance to the road, I can not actually see this primary method being tailored for sustaining a particular distance. I really feel like I’m failing to know some pretty simple arithmetic right here and would actually admire if somebody may level me in the fitting course.
Thank you!
[ad_2]
