Mesh_analyzer
Loading...
Searching...
No Matches
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
bool operator== (const Point &other) const
void operator+= (const Point &other)
void operator/= (float scalar)
void operator*= (float scalar)

Public Attributes

float x
float y
float z
 Coordinates of the point.

Friends

std::ostream & operator<< (std::ostream &os, const Point &p)
 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]

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]

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 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 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 & p )
friend

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

Parameters
os
p
Returns
std::ostream&

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