I used to be despatched right here by softwareengineering.stackexchange.com.
I’m writing a WinForms .NET utility utilizing C#. I exploit SkiaSharp for drawing for efficiency causes.
I can already create a cuboid, rotate it, mission its factors, and draw. For this, I exploit the strategy that I’ve a “window” on which the rays of the rotated strong behind it hit. In entrance of the window is a digital camera. This is meant to be a 1st particular person digital camera.
Here the projection method:
SKPoint projected = new SKPoint(Convert.ToSingle((CameraPos.x - WindowPos.x) / (CameraPos.x - rotatedVector.x) * rotatedVector.y),
Convert.ToSingle((CameraPos.x - WindowPos.x) / (CameraPos.x - rotatedVector.x) * (-rotatedVector.z)));
I exploit many, many vectors for this. The vectors are sorted from again to entrance earlier than projecting and drawing.
My query to you is that I now wish to transfer and rotate the digital camera (that works) and accordingly the world modifications with it. One sees then different issues and the issues otherwise. What is the method for this?
In and of itself, I’ve no problem or panic about math and vectors – I simply need it to be proper ultimately.
For testing, I’m utilizing this on-line software, the place
quader(-1|-2|0 1|4|2){00b800}
vektor(7|0|1 -7|2|1){0091ff}
vektor(7|0|1 -7|2|-1){0091ff}
vektor(7|0|1 -7|-2|1){0091ff}
vektor(7|0|1 -7|-2|-1){0091ff}
vektor(5|5|1 -5|-7|1){ff006a}
vektor(5|5|1 -5|-7|-1){ff006a}
vektor(5|5|1 -5|-3|1){ff006a}
vektor(5|5|1 -5|-3|-1){ff006a}
vektor(5|5|1 -6|-3|-1){000000}
vektor(5|5|1 -6|-3|1){000000}
Imagine standing at place one, the place the sunshine blue arrows begin from. I’m trying straight on the physique. But in the event you transfer and rotate the digital camera, you will seem like I illustrated the magenta arrows. Now you may even see one aspect of the field that was not seen from place 1. Besides, the cuboid is crooked as seen from place 2. I am unable to discover the method to calculate the entire thing.