https://mooseframework.inl.gov
GeometryUtils.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "Moose.h"
13 #include "libmesh/point.h"
14 #include "libmesh/mesh_tools.h"
15 
16 namespace geom_utils
17 {
23 bool isPointZero(const libMesh::Point & pt);
24 
30 libMesh::Point unitVector(const libMesh::Point & pt, const std::string & name);
31 
40  const libMesh::Real angle,
41  const libMesh::Point & axis);
42 
52  const std::vector<libMesh::Point> & candidates,
53  const unsigned int axis);
54 
63 std::vector<libMesh::Point>
64 polygonCorners(const unsigned int num_sides, const libMesh::Real radius, const unsigned int axis);
65 
74 std::pair<unsigned int, unsigned int> projectedIndices(const unsigned int axis);
75 
85 projectPoint(const libMesh::Real x0, const libMesh::Real x1, const unsigned int axis);
86 
96 libMesh::Point projectedUnitNormal(libMesh::Point pt1, libMesh::Point pt2, const unsigned int axis);
97 
106  const libMesh::Point & line0,
107  const libMesh::Point & line1);
108 
120  libMesh::Point line0,
121  libMesh::Point line1,
122  const unsigned int axis);
123 
135  libMesh::Point pt2,
136  libMesh::Point pt3,
137  const unsigned int axis);
138 
147 bool pointInPolygon(const libMesh::Point & point,
148  const std::vector<libMesh::Point> & corners,
149  const unsigned int axis);
150 
159 bool pointOnEdge(const libMesh::Point & point,
160  const std::vector<libMesh::Point> & corners,
161  const unsigned int axis);
162 
168 std::vector<libMesh::Point> boxCorners(const libMesh::BoundingBox & box,
169  const libMesh::Real factor);
170 } // end of namespace geom_utils
std::string name(const ElemQuality q)
const Real radius
libMesh::Point projectPoint(const libMesh::Real x0, const libMesh::Real x1, const unsigned int axis)
Given two coordinates, construct a point in the 2-D plane perpendicular to the specified axis...
libMesh::Real projectedDistanceFromLine(libMesh::Point pt, libMesh::Point line0, libMesh::Point line1, const unsigned int axis)
Compute the distance from a 3-D line, provided in terms of two points on the line.
libMesh::Real projectedLineHalfSpace(libMesh::Point pt1, libMesh::Point pt2, libMesh::Point pt3, const unsigned int axis)
If positive, point is on the positive side of the half space (and vice versa).
libMesh::Point projectedUnitNormal(libMesh::Point pt1, libMesh::Point pt2, const unsigned int axis)
Get the unit normal vector between two points (which are first projected onto the plane perpendicular...
libMesh::Point rotatePointAboutAxis(const libMesh::Point &p, const libMesh::Real angle, const libMesh::Point &axis)
Rotate point about an axis.
std::vector< libMesh::Point > polygonCorners(const unsigned int num_sides, const libMesh::Real radius, const unsigned int axis)
Get the corner coordinates of a regular 2-D polygon, assuming a face of the polygon is parallel to th...
bool pointOnEdge(const libMesh::Point &point, const std::vector< libMesh::Point > &corners, const unsigned int axis)
Whether a point is on the edge of a 2-D polygon in the plane perpendicular to the specified axis...
libMesh::Point unitVector(const libMesh::Point &pt, const std::string &name)
Get the unit vector for a point parameter.
bool isPointZero(const libMesh::Point &pt)
Check whether a point is equal to zero.
std::pair< unsigned int, unsigned int > projectedIndices(const unsigned int axis)
Get the indices of the plane perpendicular to the specified axis.
libMesh::Real distanceFromLine(const libMesh::Point &pt, const libMesh::Point &line0, const libMesh::Point &line1)
Compute the distance from a 3-D line, provided in terms of two points on the line.
libMesh::Real minDistanceToPoints(const libMesh::Point &pt, const std::vector< libMesh::Point > &candidates, const unsigned int axis)
Get the minimum distance from a point to another set of points, in the plane perpendicular to the spe...
std::vector< libMesh::Point > boxCorners(const libMesh::BoundingBox &box, const libMesh::Real factor)
Get corner points of a bounding box, with side length re-scaled.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool pointInPolygon(const libMesh::Point &point, const std::vector< libMesh::Point > &corners, const unsigned int axis)
Whether a point is in 2-D a polygon in the plane perpendicular to the specified axis, given by corner points.