Meshes and Transformations Flashcards
Types of Representations in 3D
Depth Images:
Definition: 2D arrays of pixel values representing distances from the camera to points on an object.
Point Clouds:
Definition: Collections of 3D points in space, often obtained through 3D scanning or other sensing methods.
Mesh:
Definition: A collection of vertices, edges, and faces defining the shape of a 3D object.
Voxels:
Definition: Volumetric pixels representing a 3D grid of values, commonly used in medical imaging or computer graphics.
What is a Mesh?
Definition: A 3D model representing the surface of an object with vertices, edges, and faces.
Vertices:
Definition: Points in 3D space defining corners or intersections of the mesh.
Edges:
Definition: Lines connecting pairs of vertices in the mesh.
Faces:
Definition: Polygons formed by connecting three or more vertices; common types include triangles and quadrilaterals.
Triangles:
Definition: Faces composed of three vertices and connecting edges.
Polygons:
Definition: Faces composed of more than three vertices, forming complex shapes.
Explain Convex and Concave Meshes:
Convex Meshes:
Definition: Meshes with all internal angles less than 180 degrees, used in physics simulations, collision detection, and optimization algorithms.
Concave Meshes:
Definition: Meshes with at least one internal angle greater than 180 degrees, used in applications requiring realistic and detailed object shapes, such as computer graphics for rendering complex models with intricate features.
Left-Handed vs. Right-Handed Coordinate Systems:
Left-Handed:
Definition: Left-hand represents X, Y, and Z axes, where positive X points right, positive Y points up, and positive Z points forward.
Right-Handed:
Definition: Right-hand represents X, Y, and Z axes, with positive X pointing right, positive Y pointing up, and positive Z pointing forward.
Unity’s Default:
Unity uses a left-handed coordinate system by default: positive X is right, positive Y is up, and positive Z is forward.
Coordinate Systems in Unity:
World Coordinate System:
Definition: Global coordinate system in Unity representing positions and orientations of objects in the overall game world.
Local Coordinate System:
Definition: Relative to an object’s own position and orientation, centered around the object. Local directions align with global axes based on object rotation.
GUI (Graphical User Interface) Coordinate System:
Definition: 2D coordinate system for Unity’s OnGUI system. Top-left corner is (0,0), positive values move down and to the right.
Screen Coordinate System:
Definition: Represents screen positions in pixels. Top-left corner is (0,0), positive values move down and to the right. Commonly used for mouse input or UI positioning.
Viewport Coordinate System:
Definition: Used for rendering, normalized from (0,0) in the bottom-left to (1,1) in the top-right, irrespective of screen resolution. Often used to specify areas in relation to the camera’s view.
Affine Transformations:
Definition:
An affine transformation is a linear transformation followed by a translation. It preserves points, straight lines, and planes.
Applications:
Commonly used in computer graphics and computer vision to transform and manipulate objects in both 2D and 3D spaces.
2D Rotation, Translation, Scale Representation as Matrices:
Se billedet
otation Matrix:
Represents 2D rotation as a matrix.
Translation Matrix:
Represents 2D translation as a matrix.
Scale Matrix:
Represents 2D scaling as a matrix.
3D Rotation, Translation, Scale Representation as Matrices:
Se billedet
Homogeneous Coordinates:
Definition:
Extended representation of Euclidean coordinates, including an additional coordinate (w).
2D Representation:
In 2D, a point is represented as (x, y, w), where w is typically set to 1 for points and 0 for vectors.
3D Representation:
In 3D, a point is represented as (x, y, z, w), with w typically set to 1 for points and 0 for vectors.
Euler Angles:
Definition:
A set of three angles (pitch, yaw, roll) representing the orientation of an object in 3D space, describing rotations around the X, Y, and Z axes.
Pros:
Intuitive:
Euler angles are intuitive, representing rotations around principal axes.
Simple Visualization:
Easier for humans to visualize and work with.
Cons:
Gimbal Lock:
Euler angles suffer from gimbal lock, resulting in the loss of one degree of freedom, making certain rotations impossible.
Use in Unity:
Unity employs Euler angles for representing rotations in the Transform component, using Transform.eulerAngles property. Caution is advised about gimbal lock during interpolation.
Sequence of Use:
In Unity, the sequence of Euler angles is typically specified as rotation around X, Y, and Z axes (pitch, yaw, roll).
Gimbal Lock:
Gimbal lock occurs when rotation axes of a 3D object become aligned, leading to a loss of one degree of freedom and making certain orientations challenging to represent.
Quaternions:
Four-dimensional mathematical representation of rotations, consisting of a scalar part and a vector part.
Why Do We Need Them?
No Gimbal Lock:
Quaternions do not suffer from gimbal lock, providing more flexibility in representing rotations.
Efficient Interpolation:
Efficient for interpolation between rotations, essential for animations and smooth camera movements.
Numerical Stability:
Quaternions are numerically stable and avoid certain computational issues associated with Euler angles.
Use in Unity:
Unity employs quaternions in the Quaternion class for rotations. Transform.rotation property in Unity is used to set and retrieve rotations, represented as quaternions.