Point3#
- 
class Point3#
- Represents a 3D point in space with floating-point coordinates. - The Point3 class provides a complete set of operations for working with 3D points, including arithmetic operations, conversions, and validation. Points are distinct from vectors in that they represent positions rather than directions or displacements. - Public Functions - 
inline Point3()#
- Default constructor that initializes the point to the origin (0, 0, 0). 
 - 
inline Point3(float a)#
- Constructor that initializes all components to the same value. - Parameters:
- a – [in] The value to set for all three components (x, y, z). 
 
 - 
inline Point3(const float *p)#
- Constructor that initializes from a float array. - Warning - The caller must ensure the array has at least 3 elements. - Parameters:
- p – [in] Pointer to an array of at least 3 floats [x, y, z]. 
 
 - 
inline Point3(float x_, float y_, float z_)#
- Constructor that initializes from individual component values. - Parameters:
- x_ – [in] The x-coordinate of the point. 
- y_ – [in] The y-coordinate of the point. 
- z_ – [in] The z-coordinate of the point. 
 
 
 - 
inline explicit Point3(const Vec3 &v)#
- Explicit constructor from a Vec3 vector. - This conversion treats the vector components as position coordinates. - Parameters:
- v – [in] The vector to convert to a point. 
 
 - 
inline operator float*()#
- Conversion operator to a mutable float pointer. - Returns:
- Pointer to the first component (x) for array-style access. 
 
 - 
inline operator const float*() const#
- Conversion operator to a const float pointer. - Returns:
- Const pointer to the first component (x) for array-style access. 
 
 - 
inline operator Vec4() const#
- Conversion operator to a homogeneous Vec4. - Returns:
- Vec4 with (x, y, z, 1.0) representing the point in homogeneous coordinates. 
 
 - 
inline void Set(float x_, float y_, float z_)#
- Sets the coordinates of the point. - Parameters:
- x_ – [in] The new x-coordinate. 
- y_ – [in] The new y-coordinate. 
- z_ – [in] The new z-coordinate. 
 
 
 - 
inline Point3 operator*(float scale) const#
- Scales the point by a scalar value. - Parameters:
- scale – [in] The scaling factor to apply to all components. 
- Returns:
- A new Point3 representing the scaled point. 
 
 - 
inline Point3 operator/(float scale) const#
- Divides the point by a scalar value. - Warning - Division by zero will result in undefined behavior. - Parameters:
- scale – [in] The divisor to apply to all components. 
- Returns:
- A new Point3 representing the divided point. 
 
 - 
inline Point3 operator+(const Vec3 &v) const#
- Translates the point by a vector. - Parameters:
- v – [in] The translation vector to add. 
- Returns:
- A new Point3 representing the translated point. 
 
 - 
inline Point3 operator-(const Vec3 &v) const#
- Translates the point by the negative of a vector. - Parameters:
- v – [in] The translation vector to subtract. 
- Returns:
- A new Point3 representing the translated point. 
 
 - 
inline Point3 &operator*=(float scale)#
- Scales this point by a scalar value in-place. - Parameters:
- scale – [in] The scaling factor to apply to all components. 
- Returns:
- Reference to this point after scaling. 
 
 - 
inline Point3 &operator/=(float scale)#
- Divides this point by a scalar value in-place. - Warning - Division by zero will result in undefined behavior. - Parameters:
- scale – [in] The divisor to apply to all components. 
- Returns:
- Reference to this point after division. 
 
 - 
inline Point3 &operator+=(const Vec3 &v)#
- Translates this point by a vector in-place. - Parameters:
- v – [in] The translation vector to add. 
- Returns:
- Reference to this point after translation. 
 
 - 
inline Point3 &operator-=(const Vec3 &v)#
- Translates this point by the negative of a vector in-place. - Parameters:
- v – [in] The translation vector to subtract. 
- Returns:
- Reference to this point after translation. 
 
 - 
inline Point3 &operator=(const Vec3 &v)#
- Assigns a Vec3 to this point. - Parameters:
- v – [in] The vector whose components will be copied to this point. 
- Returns:
- Reference to this point after assignment. 
 
 - 
inline bool operator!=(const Point3 &v) const#
- Tests for inequality with another point. - Parameters:
- v – [in] The other point to compare against. 
- Returns:
- True if any component differs, false if all components are equal. 
 
 - 
inline Point3 operator-() const#
- Returns the negation of this point. - Returns:
- A new Point3 with all components negated. 
 
 - 
inline void Validate() const#
- Validates the point’s components for correctness. - Currently performs no validation but serves as a placeholder for future checks. 
 
- 
inline Point3()#