Question
A basic way of controlling/representing the position and orientation of an object in 3D space would be to keep track of 6 numbers: 3 for
A basic way of controlling/representing the position and orientation of an object in 3D space would be to keep track of 6 numbers:
3 for the X, Y, and Z position
3 for the rotations about the X, Y, and Z axis
Write pseudo code (or C++ code) to represent how you would achieve the following program:
Imagine an object in a 3D space, which has a forward (where it's facing) and can "look around" by rotating from its current position.
The object can be facing any direction you want, so long as it is aligned with one of the axes.
This program:
- Sets global variables mentioned above (all starting at 0 by default) for representing a hypothetical object in 3D space.
- Has turning function(s) that may or may not also take in inputs (i.e. numbers representing the direction). The function(s) turn the object by one degree.
- Has move function(s) that may or may not also take in inputs (i.e numbers representing forward/backwards). The function(s) takes its current position and calculates the next position were the object (in its current orientation) to move forward (or backward) one distance unit. (i.e, having the object rotated 45 degrees about the Z-axis and moving forward one unit would be like moving units along the X and Y-axis)
Rounding to a whole number/using strictly integers is unnecessaryot advised.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started