-
Notifications
You must be signed in to change notification settings - Fork 1
ViewSettings
interface ViewSettings {
camTx: number
camTy: number
camTz: number
camZoom: number
canvasToViewRatio: number
cubeRx: number
cubeRy: number
cubeRz: number
defaultCamOrientation: string
defaultCamZoffset: number
}
The defaultCamOrientation specifies the orientation of the cube when cubeRx=0, cubeRy=0 and cubeRz=0 (which are rotations of the cube) are all zero.
As discussed in the other pages, The world coordinate frame has the yellow point as the origin, the yellow axis is the z axis, the red axis is the y axis and the blue axis is the y axis, and dataZoffset=1 (the pyramid).
defaultCamOrientation="z-forward-x-left" |
``defaultCamOrientation="z-up-x-left"` |
|---|---|
![]() |
![]() |
defaultCamOrientation="z-up-x-forward" |
defaultCamOrientation=z-forward-x-right |
|---|---|
![]() |
![]() |
-
defaultCamZoffsetis the distance of the camera coordinate frame from the world coordinate frame origin whencamTz=0in thezAxisdirection of the world coordinate frame. -
camTxis the distance of the camera from the world coordinate frame origin in thexAxisdirection of the world coordinate frame. -
camTyis the distance of the camera from the world coordinate from origin in theyAxisdirection of the world coordinate frame.
The world coordinate frame has the yellow point as the origin. cubeRx, cubeRy, and cubeRz are angles in degrees for which the cube is rotated where the turning point is the origin of the coordinate frame. In the picture below cubeRx=0, cubeRy=27.5, cubeRz=0 which is wrt to the origin of the world coordinate frame.
If you want the cube to rotate with respect to the center of the floor of the cube. Make the cubeZoffset=1
In the picture below Rx=-25, Ry=0 Rz=-25.8 which is wrt to the origin of the world coordinate frame.
To better understand the cam.zoom and canvasToViewRatio I'm going to borrow some images from the following:
-
Scratch a Pixel 2.0: Finding the 2D pixel coordinates of a 3D Point Explained from Beginning to End
-
Gabriel Gambeta: Computer Graphics from scratch (Perspective Projection)



