13#include "../../Utils/Math/Plane.h"
14#include "../../Scene/Objects/Object3D.h"
Represents a 3D object with geometry, material, and transformation data.
Handles aligning and transforming 3D objects to fit within specified 2D camera bounds.
void SetEdgeMargin(float edgeMargin)
Sets the margin to keep from the edges when aligning objects.
void AlignObjectNoScale(Object3D *obj)
Aligns a single Object3D within the camera bounds without applying the object's scaling factor.
void SetForwardVector(Vector3D forwardVector)
Sets the forward vector, i.e., which axis is considered "forward" for the alignment logic.
float scaleY
Scaling factor on the Y-axis.
float GetObjectPlanarityRatio(Object3D *obj)
Computes how planar (flat) a single object is, typically as a ratio (0.0 = not planar,...
float offsetPlaneAngle
Additional rotation offset (plane offset angle in degrees or radians).
Vector3D GetObjectSize(Object3D *obj)
Retrieves the bounding box size (width, height, depth) of a single object.
Quaternion GetPlaneNormal(Object3D *obj)
Determines the plane normal (as a Quaternion) of the object based on its geometry.
void NormalizeObjectCenter(Object3D **objs, uint8_t numObjects, Vector3D center)
Translates the center of multiple objects so that their average center matches the specified center.
Justification
Describes how the object(s) should be justified within the bounding box.
@ MiddleLeft
Justify to the middle-left side of the bounding area.
@ LowerMiddle
Align to the bottom center of the bounding area.
@ MiddleRight
Align to the middle-right side of the bounding area.
@ UpperLeft
Justify to the upper-left corner of the bounding area.
@ Stretch
Attempt to scale the object(s) to fill the entire area.
@ UpperRight
Justify to the upper-right corner of the bounding area.
@ Middle
Center the object within the bounding area.
@ UpperMiddle
Justify to the top center of the bounding area.
@ LowerRight
Justify to the lower-right corner of the bounding area.
@ LowerLeft
Justify to the lower-left corner of the bounding area.
Transform GetTransform(Object3D *obj)
Computes the final Transform for aligning a single Object3D within the camera bounds.
Quaternion targetOrientation
Target orientation for aligning the object(s).
void SetJustification(Justification jst)
Sets the justification mode for alignment.
void NormalizeObjectPlane(Object3D **objs, uint8_t numObjects, Vector3D center, Quaternion planeOrientation)
Normalizes the orientation of multiple objects onto a plane.
Vector2D camMin
Minimum 2D camera bounds (lower-left).
Vector3D GetCentroid(Object3D *obj)
Computes the centroid of the given object's geometry.
bool mirrorX
Whether to mirror objects along the X-axis.
Justification jst
Current justification mode.
Vector2D cameraCenter
Computed center between camMin and camMax.
float edgeMargin
Margin from the bounding edges, in screen-space units.
void SetPlaneOffsetAngle(float offsetPlaneAngle)
Sets the additional rotation offset (plane offset angle), in degrees or radians, that will be applied...
Vector3D GetObjectCenter(Object3D *obj)
Computes the "center" of a single object. Generally the same as centroid, but could be defined differ...
void AlignObjectsNoScale(Object3D **objs, uint8_t numObjects)
Aligns multiple objects without applying the object's scaling factor.
void AlignObject(Object3D *obj)
Aligns a single Object3D within the camera bounds, including applying scale factors as necessary.
Quaternion GetPlaneOrientation(Object3D *obj, Vector3D centroid)
Calculates the orientation needed to make the object's plane face the camera or align with a given ce...
void SetCameraMax(Vector2D camMax)
Updates the maximum bounds for the 2D camera region.
void AlignObjects(Object3D **objs, uint8_t numObjects)
Aligns multiple objects within the camera bounds, including scale factors.
bool mirrorY
Whether to mirror objects along the Y-axis.
void SetMirrorX(bool mirrorX)
Enables or disables mirroring along the X-axis for the aligned objects.
Vector3D forwardVector
Default "forward" axis.
float scaleX
Scaling factor on the X-axis.
void SetMirrorY(bool mirrorY)
Enables or disables mirroring along the Y-axis for the aligned objects.
Vector2D camMax
Maximum 2D camera bounds (upper-right).
void SetCameraMin(Vector2D camMin)
Updates the minimum bounds for the 2D camera region.
void SetScale(float scaleX, float scaleY)
Sets the scaling factors that will be applied to objects during alignment.
A mathematical construct representing a rotation in 3D space.
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.