NLMech  0.1.0
util::geometry Namespace Reference

Provides geometrical methods such as point inside rectangle. More...

Functions

double angle (util::Point3 vec_1, util::Point3 vec_2, size_t dim, bool anticlock=false)
 Computes angle between two vectors. More...
 
int direction (util::Point3 A, util::Point3 B, util::Point3 C)
 Checks if the point C in on the line between A and B. More...
 
bool doLinesIntersect (util::Point3 A, util::Point3 B, util::Point3 C, util::Point3 D)
 Checks if the two lines between A and B and between C and C intersect. More...
 
util::Point3 getCenter (const std::vector< util::Point3 > &nodes, const size_t &elem_type)
 Computes the centroid of element. More...
 
std::pair< util::Point3, double > getCenterAndVol (const std::vector< util::Point3 > &nodes, const size_t &elem_type)
 Computes the centroid and volume of element. More...
 
std::vector< util::Point3getCornerPoints (size_t dim, const std::pair< util::Point3, util::Point3 > &box)
 Returns all corner points in the box. More...
 
double getTetVolume (const std::vector< util::Point3 > &nodes)
 Computes the volume of tetrahedron. More...
 
double getTriangleArea (const std::vector< util::Point3 > &nodes)
 Computes the area of triangle. More...
 
bool isPointinCircle (util::Point3 A, util::Point3 center, double radius)
 Checks if the point A is within the circle with the center and the radius. More...
 
bool isPointInsideAngledRectangle (util::Point3 x, double x_min, double x_max, double y_min, double y_max, double theta)
 Checks if point is inside an angled rectangle. More...
 
bool isPointInsideCuboid (size_t dim, util::Point3 x, util::Point3 x_lbb, util::Point3 x_rtf)
 Checks if point is inside a cuboid (rectangle in 2-d, line in 1-d) More...
 
bool isPointInsideRectangle (util::Point3 x, double x_min, double x_max, double y_min, double y_max)
 Checks if point is inside a rectangle. More...
 
bool isPointInsideRectangle (util::Point3 x, util::Point3 x_lb, util::Point3 x_rt)
 Checks if point is inside a rectangle. More...
 
bool onLine (util::Point3 A, util::Point3 B, util::Point3 C)
 Checks if the point C in on the between A and B. More...
 

Detailed Description

Provides geometrical methods such as point inside rectangle.

Function Documentation

◆ angle()

double util::geometry::angle ( util::Point3  vec_1,
util::Point3  vec_2,
size_t  dim,
bool  anticlock = false 
)

Computes angle between two vectors.

Parameters
vec_1Vector 1
vec_2Vector 2
dimDimension
anticlockAngle convention
Returns
angle Angle between vector 1 and 2

Referenced by angle().

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

◆ direction()

int util::geometry::direction ( util::Point3  A,
util::Point3  B,
util::Point3  C 
)

Checks if the point C in on the line between A and B.

Parameters
APoint 1
BPoint 2
CPoint 3
Returns
Direction

Referenced by doLinesIntersect().

Here is the caller graph for this function:

◆ doLinesIntersect()

bool util::geometry::doLinesIntersect ( util::Point3  A,
util::Point3  B,
util::Point3  C,
util::Point3  D 
)

Checks if the two lines between A and B and between C and C intersect.

Parameters
AStart point of the first line
BEnd point of the first line
CStart point of the second line
DEnd point of the second line
Returns
intersection

Referenced by model::FDModel< T >::is_reaction_force().

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

◆ getCenter()

util::Point3 util::geometry::getCenter ( const std::vector< util::Point3 > &  nodes,
const size_t &  elem_type 
)

Computes the centroid of element.

Parameters
nodesVertices of the element
elem_typeElement type
Returns
Point Centroid

◆ getCenterAndVol()

std::pair< util::Point3, double > util::geometry::getCenterAndVol ( const std::vector< util::Point3 > &  nodes,
const size_t &  elem_type 
)

Computes the centroid and volume of element.

Parameters
nodesVertices of the element
elem_typeElement type
Returns
Point-volume Pair of centroid and volume

Referenced by fe::Mesh::nodesAtCentroid().

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

◆ getCornerPoints()

std::vector< util::Point3 > util::geometry::getCornerPoints ( size_t  dim,
const std::pair< util::Point3, util::Point3 > &  box 
)

Returns all corner points in the box.

Parameters
dimDimension of the box
boxPair of points representing cuboid (rectangle in 2d)
Returns
Vector Vector of corner points

◆ getTetVolume()

double util::geometry::getTetVolume ( const std::vector< util::Point3 > &  nodes)

Computes the volume of tetrahedron.

Parameters
nodesVertices of the tetrahedron
Returns
area Area of tetrahedron

Referenced by getCenterAndVol().

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

◆ getTriangleArea()

double util::geometry::getTriangleArea ( const std::vector< util::Point3 > &  nodes)

Computes the area of triangle.

Parameters
nodesVertices of the triangle
Returns
area Area of triangle

Referenced by getCenterAndVol().

Here is the caller graph for this function:

◆ isPointinCircle()

bool util::geometry::isPointinCircle ( util::Point3  A,
util::Point3  center,
double  radius 
)

Checks if the point A is within the circle with the center and the radius.

Parameters
APoint 1
centerCenter of the circle
radiusRadius of the circle
Returns
Direction

Referenced by loading::ULoading::ULoading().

Here is the caller graph for this function:

◆ isPointInsideAngledRectangle()

bool util::geometry::isPointInsideAngledRectangle ( util::Point3  x,
double  x_min,
double  x_max,
double  y_min,
double  y_max,
double  theta 
)

Checks if point is inside an angled rectangle.

Parameters
xPoint
x_minX coordinate of left-bottom corner point
x_maxX coordinate of right-top corner point
y_minY coordinate of left-bottom corner point
y_maxY coordinate of right-top corner point
thetaAngle of orientation of rectangle from x-axis
Returns
bool True if point inside rectangle, else false

Referenced by loading::FLoading::FLoading(), and loading::ULoading::ULoading().

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

◆ isPointInsideCuboid()

bool util::geometry::isPointInsideCuboid ( size_t  dim,
util::Point3  x,
util::Point3  x_lbb,
util::Point3  x_rtf 
)

Checks if point is inside a cuboid (rectangle in 2-d, line in 1-d)

Parameters
dimDimension
xPoint
x_lbbCoordinate of left-bottom-back corner point
x_rtfCoordinate of right-top-front corner point
Returns
bool True if point inside cuboid, else false

Referenced by geometry::DampingGeom::computeDampingCoefficient(), and loading::FLoading::FLoading().

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

◆ isPointInsideRectangle() [1/2]

bool util::geometry::isPointInsideRectangle ( util::Point3  x,
double  x_min,
double  x_max,
double  y_min,
double  y_max 
)

Checks if point is inside a rectangle.

Parameters
xPoint
x_minX coordinate of left-bottom corner point
x_maxX coordinate of right-top corner point
y_minY coordinate of left-bottom corner point
y_maxY coordinate of right-top corner point
Returns
bool True if point inside rectangle, else false

Referenced by model::FDModel< T >::checkOutputCriteria(), geometry::DataInterior::DataInterior(), tools::pp::Compute::decomposeSearchNodes(), loading::FLoading::FLoading(), geometry::ComputeInterior::getInteriorFlag(), tools::pp::Compute::getRectsAndNodesForCrackTip(), tools::pp::Compute::init(), tools::pp::Compute::listElemsAndNodesInDomain(), and loading::ULoading::ULoading().

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

◆ isPointInsideRectangle() [2/2]

bool util::geometry::isPointInsideRectangle ( util::Point3  x,
util::Point3  x_lb,
util::Point3  x_rt 
)

Checks if point is inside a rectangle.

Parameters
xPoint
x_lbCoordinate of left-bottom corner point
x_rtCoordinate of right-top corner point
Returns
bool True if point inside rectangle, else false
Here is the call graph for this function:

◆ onLine()

bool util::geometry::onLine ( util::Point3  A,
util::Point3  B,
util::Point3  C 
)

Checks if the point C in on the between A and B.

Parameters
AStart point of the first line
BEnd point of the first line
CPoint to test
Returns
intersection

Referenced by doLinesIntersect().

Here is the caller graph for this function: