NLMech  0.1.0
util::Point3 Struct Reference

A structure to represent 3d vectors. More...

#include <point.h>

Collaboration diagram for util::Point3:
Collaboration graph

Public Member Functions

double angle (Point3 b) const
 Computes the angle between vector given by this and the vector b. More...
 
Point3 cross (const Point3 &b) const
 Computes the cross product between this vector and given vector. More...
 
double dist (const Point3 &b) const
 Computes the distance between a given point from this point. More...
 
double dot (const Point3 &b) const
 Computes the dot product of this vector with another point. More...
 
double length () const
 Computes the Euclidean length of the vector. More...
 
double lengthSq () const
 Computes the Euclidean length of the vector. More...
 
 Point3 ()
 Constructor.
 
 Point3 (const Point3 &p)
 Copy constructor. More...
 
 Point3 (const std::vector< double > &p)
 Constructor. More...
 
template<class T >
 Point3 (T x, T y, T z)
 Constructor. More...
 
template<class T >
 Point3 (T x[3])
 Constructor. More...
 
void print (int nt=0, int lvl=0) const
 Prints the information. More...
 
std::string printStr (int nt=0, int lvl=0) const
 Prints the information. More...
 
Point3 project (const Point3 &b, bool is_unit=false) const
 Computes projection of vector on this vector. More...
 
Point3 projectNormal (const Point3 &b, bool is_unit=false) const
 Computes projection of vector on plane with normal as this vector. More...
 
util::Matrix33 toMatrix ()
 Computes the dot product of the vector and its transpose. More...
 
util::Matrix33 toMatrix (const util::Point3 b)
 Computes the dot product of the vector x and the transpose of y. More...
 
util::Vector3 toVector ()
 Converts the point to an blaze vector. More...
 
Point3 unit ()
 Returns the unit vector. More...
 
Point3 unit () const
 Returns the unit vector. More...
 

Data Fields

double d_x
 the x coordinate
 
double d_y
 the y coordinate
 
double d_z
 the z coordinate
 

Group operators

Point3operator+= (const double b)
 Add a scalar to the point. More...
 
Point3operator-= (const double b)
 Subtracts a scalar to the point. More...
 
Point3operator*= (const double b)
 Multiplies a scalar to the point. More...
 
Point3operator+= (const Point3 &b)
 Adds a point. More...
 
Point3operator-= (const Point3 &b)
 Subtracts a point. More...
 
Point3operator*= (const Point3 &b)
 Multiplies a point. More...
 
Point3operator/= (const double b)
 Divides a point by a scalar. More...
 
double & operator[] (size_t i)
 Access the 0th component of a point. More...
 
const double & operator[] (size_t i) const
 Access the 0th component of a point. More...
 
Point3 operator+ (Point3 lhs, const Point3 &rhs)
 Adds two points. More...
 
Point3 operator- (Point3 lhs, const Point3 &rhs)
 Substracts two points. More...
 
double operator* (Point3 lhs, const Point3 rhs)
 Multiplies a constant to the point. More...
 
Point3 operator* (Point3 lhs, const double rhs)
 Adds two points. More...
 
Point3 operator+ (Point3 lhs, const double rhs)
 Adds a scalar to the point. More...
 
Point3 operator+ (const double lhs, Point3 rhs)
 Adds two points. More...
 
Point3 operator- (Point3 lhs, const double rhs)
 Subtracts a scalar to the point. More...
 
Point3 operator- (const double lhs, Point3 rhs)
 Subtracts a scalar to the point. More...
 
Point3 operator* (const double lhs, Point3 rhs)
 Subtracts a scalar to the point. More...
 
Point3 operator/ (Point3 lhs, const double rhs)
 Divides a scalar to the point. More...
 
std::ostream & operator<< (std::ostream &os, const Point3 p)
 Print the point's value to the standard output stream. More...
 

Detailed Description

A structure to represent 3d vectors.

Constructor & Destructor Documentation

◆ Point3() [1/4]

template<class T >
util::Point3::Point3 ( x,
y,
z 
)
inline

Constructor.

Parameters
xThe x coordinate
yThe y coordinate
zThe z coordinate

◆ Point3() [2/4]

template<class T >
util::Point3::Point3 ( x[3])
inlineexplicit

Constructor.

Parameters
xThe coordinate vector

◆ Point3() [3/4]

util::Point3::Point3 ( const std::vector< double > &  p)
inlineexplicit

Constructor.

Parameters
pPoint

◆ Point3() [4/4]

util::Point3::Point3 ( const Point3 p)
inline

Copy constructor.

Parameters
pPoint

Member Function Documentation

◆ angle()

double util::Point3::angle ( Point3  b) const
inline

Computes the angle between vector given by this and the vector b.

Parameters
bAnother vector
Returns
Value a dot product
Here is the call graph for this function:

◆ cross()

Point3 util::Point3::cross ( const Point3 b) const
inline

Computes the cross product between this vector and given vector.

Parameters
bAnother vector
Returns
Vector Cross product

◆ dist()

double util::Point3::dist ( const Point3 b) const
inline

Computes the distance between a given point from this point.

Parameters
bAnother point
Returns
Value Distance between the two points

Referenced by util::function::doubleGaussian2d(), tools::pp::Compute::findNode(), util::function::gaussian2d(), tools::pp::Compute::interpolateUV(), and inp::Input::setFractureDeck().

Here is the caller graph for this function:

◆ dot()

double util::Point3::dot ( const Point3 b) const
inline

Computes the dot product of this vector with another point.

Parameters
bAnother vector
Returns
Value a dot product

Referenced by util::geometry::angle(), tools::pp::Compute::getContourContribJInt(), material::pd::RNPBond::getS(), project(), and projectNormal().

Here is the caller graph for this function:

◆ length()

double util::Point3::length ( ) const
inline

◆ lengthSq()

double util::Point3::lengthSq ( ) const
inline

Computes the Euclidean length of the vector.

Returns
Length Euclidean length of the vector

◆ operator*=() [1/2]

Point3& util::Point3::operator*= ( const double  b)
inline

Multiplies a scalar to the point.

Parameters
bScalar factor
Returns
Scaled point

◆ operator*=() [2/2]

Point3& util::Point3::operator*= ( const Point3 b)
inline

Multiplies a point.

Parameters
bPoint
Returns
Point-wise product of the two points

◆ operator+=() [1/2]

Point3& util::Point3::operator+= ( const double  b)
inline

Add a scalar to the point.

Parameters
bScalar factor
Returns
Scaled point

◆ operator+=() [2/2]

Point3& util::Point3::operator+= ( const Point3 b)
inline

Adds a point.

Parameters
bPoint
Returns
Sum of the two points

◆ operator-=() [1/2]

Point3& util::Point3::operator-= ( const double  b)
inline

Subtracts a scalar to the point.

Parameters
bScalar factor
Returns
Shifted point

◆ operator-=() [2/2]

Point3& util::Point3::operator-= ( const Point3 b)
inline

Subtracts a point.

Parameters
bPoint
Returns
Difference of the two points

◆ operator/=()

Point3& util::Point3::operator/= ( const double  b)
inline

Divides a point by a scalar.

Parameters
bScalar factor
Returns
Scaled point

◆ operator[]() [1/2]

double& util::Point3::operator[] ( size_t  i)
inline

Access the 0th component of a point.

Parameters
iIndex
Returns
The i-th index of the point

◆ operator[]() [2/2]

const double& util::Point3::operator[] ( size_t  i) const
inline

Access the 0th component of a point.

Parameters
iIndex
Returns
The i-th index of the point

◆ print()

void util::Point3::print ( int  nt = 0,
int  lvl = 0 
) const
inline

Prints the information.

Parameters
ntNumber of tabs to append before printing
lvlInformation level (higher means more information)
Here is the call graph for this function:

◆ printStr()

std::string util::Point3::printStr ( int  nt = 0,
int  lvl = 0 
) const
inline

Prints the information.

Parameters
ntNumber of tabs to append before printing
lvlInformation level (higher means more information)
Returns
Manipulated string

Referenced by tools::pp::Compute::computeJIntegral(), print(), and fe::QuadData::printStr().

Here is the caller graph for this function:

◆ project()

Point3 util::Point3::project ( const Point3 b,
bool  is_unit = false 
) const
inline

Computes projection of vector on this vector.

Parameters
bAnother vector
is_unitIs a unit vector
Returns
Vector Projection vector
Here is the call graph for this function:

◆ projectNormal()

Point3 util::Point3::projectNormal ( const Point3 b,
bool  is_unit = false 
) const
inline

Computes projection of vector on plane with normal as this vector.

Parameters
bAnother vector
is_unitIs a unit vector
Returns
Vector Projection vector
Here is the call graph for this function:

◆ toMatrix() [1/2]

util::Matrix33 util::Point3::toMatrix ( )
inline

Computes the dot product of the vector and its transpose.

Returns
dot(x,x.T)

Referenced by material::pd::ElasticState::deformation_gradient(), material::pd::ElasticState::K_modulus_tensor(), and material::pd::ElasticState::K_shape_tensor().

Here is the caller graph for this function:

◆ toMatrix() [2/2]

util::Matrix33 util::Point3::toMatrix ( const util::Point3  b)
inline

Computes the dot product of the vector x and the transpose of y.

Parameters
bThe node b
Returns
dot(x,y.T)

◆ toVector()

util::Vector3 util::Point3::toVector ( )
inline

Converts the point to an blaze vector.

Returns
Point as blaze vector 3D

Referenced by material::pd::ElasticState::getStress().

Here is the caller graph for this function:

◆ unit() [1/2]

Point3 util::Point3::unit ( )
inline

Returns the unit vector.

Returns
Vector Unit vector

Referenced by angle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unit() [2/2]

Point3 util::Point3::unit ( ) const
inline

Returns the unit vector.

Returns
Vector Unit vector
Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator* [1/3]

Point3 operator* ( const double  lhs,
Point3  rhs 
)
friend

Subtracts a scalar to the point.

Parameters
lhsLeft-hand side
rhsLeft-hand side
Returns
Shifted point

◆ operator* [2/3]

Point3 operator* ( Point3  lhs,
const double  rhs 
)
friend

Adds two points.

Parameters
lhsLeft-hand side
rhsLeft-hand side
Returns
Sum of the two points

◆ operator* [3/3]

double operator* ( Point3  lhs,
const Point3  rhs 
)
friend

Multiplies a constant to the point.

Parameters
lhsLeft-hand side
rhsLeft-hand side
Returns
Scaled point

◆ operator+ [1/3]

Point3 operator+ ( const double  lhs,
Point3  rhs 
)
friend

Adds two points.

Parameters
lhsLeft-hand side
rhsLeft-hand side
Returns
Sum of the two points

◆ operator+ [2/3]

Point3 operator+ ( Point3  lhs,
const double  rhs 
)
friend

Adds a scalar to the point.

Parameters
lhsLeft-hand side
rhsLeft-hand side
Returns
Shifted point

◆ operator+ [3/3]

Point3 operator+ ( Point3  lhs,
const Point3 rhs 
)
friend

Adds two points.

Parameters
lhsLeft-hand side
rhsLeft-hand side
Returns
Sum of the two points

◆ operator- [1/3]

Point3 operator- ( const double  lhs,
Point3  rhs 
)
friend

Subtracts a scalar to the point.

Parameters
lhsLeft-hand side
rhsLeft-hand side
Returns
Shifted point

◆ operator- [2/3]

Point3 operator- ( Point3  lhs,
const double  rhs 
)
friend

Subtracts a scalar to the point.

Parameters
lhsLeft-hand side
rhsLeft-hand side
Returns
Shifted point

◆ operator- [3/3]

Point3 operator- ( Point3  lhs,
const Point3 rhs 
)
friend

Substracts two points.

Parameters
lhsLeft-hand side
rhsLeft-hand side
Returns
Difference of the two points

◆ operator/

Point3 operator/ ( Point3  lhs,
const double  rhs 
)
friend

Divides a scalar to the point.

Parameters
lhsLeft-hand side
rhsLeft-hand side
Returns
Scaled point

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Point3  p 
)
friend

Print the point's value to the standard output stream.

Parameters
osStandard output stream
pPoint
Returns
The standard out stream

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