https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
16namespace geom_utils
17{
23bool isPointZero(const libMesh::Point & pt);
24
30libMesh::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
63std::vector<libMesh::Point>
64polygonCorners(const unsigned int num_sides, const libMesh::Real radius, const unsigned int axis);
65
74std::pair<unsigned int, unsigned int> projectedIndices(const unsigned int axis);
75
85projectPoint(const libMesh::Real x0, const libMesh::Real x1, const unsigned int axis);
86
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
148 const std::vector<libMesh::Point> & corners,
149 const unsigned int axis);
150
159bool pointOnEdge(const libMesh::Point & point,
160 const std::vector<libMesh::Point> & corners,
161 const unsigned int axis);
162
168std::vector<libMesh::Point> boxCorners(const libMesh::BoundingBox & box,
169 const libMesh::Real factor);
170
178bool arePointsColinear(const Point & p1, const Point & p2, const Point & p3);
179
189bool segmentsIntersect(const Point & p1, const Point & p2, const Point & p3, const Point & p4);
190
198Real pointSegmentDistanceSq(const Point & point, const Point & a, const Point & b);
199
208Real
209pointTriangleDistanceSq(const Point & point, const Point & v0, const Point & v1, const Point & v2);
210
219Real solidAngle(const Point & point, const Point & v0, const Point & v1, const Point & v2);
220} // end of namespace geom_utils
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.
Real pointSegmentDistanceSq(const Point &point, const Point &a, const Point &b)
Compute the squared distance from a point to a 3-D line segment.
std::pair< unsigned int, unsigned int > projectedIndices(const unsigned int axis)
Get the indices of the plane perpendicular to the specified axis.
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,...
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.
bool isPointZero(const libMesh::Point &pt)
Check whether a point is equal to zero.
bool segmentsIntersect(const Point &p1, const Point &p2, const Point &p3, const Point &p4)
Check if the line segment p1-p2 intersects with line segment p3-p4 (only working in 2D (x-y plane)).
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...
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::Point unitVector(const libMesh::Point &pt, const std::string &name)
Get the unit vector for a point parameter.
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).
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,...
Real solidAngle(const Point &point, const Point &v0, const Point &v1, const Point &v2)
Compute the signed solid angle subtended by one oriented triangle at the query point.
libMesh::Point rotatePointAboutAxis(const libMesh::Point &p, const libMesh::Real angle, const libMesh::Point &axis)
Rotate point about an axis.
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.
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...
Real pointTriangleDistanceSq(const Point &point, const Point &v0, const Point &v1, const Point &v2)
Compute the squared distance from a point to a 3-D triangle.
bool arePointsColinear(const Point &p1, const Point &p2, const Point &p3)
Check if three points are colinear.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real