Enmesh
Loading...
Searching...
No Matches
Enmesh::Point Struct Reference

A struct representing a point in 3D space. More...

#include <point.h>

Public Member Functions

 Point ()
 Construct a new Point object at the origin.
 Point (float x_, float y_)
 Construct a new Point object at the specified coordinates (z defaults to 0)
 Point (float x_, float y_, float z_)
 Construct a new Point object at the specified coordinates.
float length () const
 Calculate the length of the vector from the origin to this point.
float distance (const Point &other) const
 Calculate the distance between this point and another point.
Point operator- (const Point &other) const
Point operator+ (const Point &other) const
Point operator* (float scalar) const
Point operator/ (float scalar) const
bool operator== (const Point &other) const
void operator+= (const Point &other)
void operator/= (float scalar)
void operator*= (float scalar)
float dot (const Point &other) const
Point cross (const Point &other) const

Public Attributes

float x
float y
float z
 Coordinates of the point.

Friends

std::ostream & operator<< (std::ostream &os, const Point &point)
 Overload the << operator to print the point's coordinates.

Detailed Description

A struct representing a point in 3D space.

Constructor & Destructor Documentation

◆ Point() [1/2]

Enmesh::Point::Point ( float x_,
float y_ )
inline

Construct a new Point object at the specified coordinates (z defaults to 0)

Parameters
x_
y_

◆ Point() [2/2]

Enmesh::Point::Point ( float x_,
float y_,
float z_ )
inline

Construct a new Point object at the specified coordinates.

Parameters
x_
y_
z_

Member Function Documentation

◆ distance()

float Enmesh::Point::distance ( const Point & other) const

Calculate the distance between this point and another point.

Parameters
other
Returns
float distance between the points

◆ length()

float Enmesh::Point::length ( ) const

Calculate the length of the vector from the origin to this point.

Returns
float length of the vector

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const Point & point )
friend

Overload the << operator to print the point's coordinates.

Parameters
os
point
Returns
std::ostream&

The documentation for this struct was generated from the following files: