1#ifndef included_AMP_GeometryHelpers
2#define included_AMP_GeometryHelpers
4#include "AMP/utils/MeshPoint.h"
251template<std::
size_t NDIM>
253 const std::array<double, NDIM> &ang,
254 const std::array<double, NDIM> &lb,
255 const std::array<double, NDIM> &ub );
457template<
int NP,
int NDIM>
458std::array<double, NP>
barycentric(
const std::array<std::array<double, NDIM>, NP> &x,
459 const std::array<double, NDIM> &p );
539std::vector<AMP::Mesh::Point>
subdivide(
const std::array<AMP::Mesh::Point, 3> &v,
double res );
551std::vector<Point3D>
sampleLine(
const std::array<Point3D, 2> &v,
double d0,
bool interior =
true );
563std::vector<Point3D>
sampleTri(
const std::array<Point3D, 3> &v,
double d0,
bool interior =
true );
575std::vector<Point3D>
sampleQuad(
const std::array<Point3D, 4> &v,
double d0,
bool interior =
true );
587std::vector<Point3D>
sampleTet(
const std::array<Point3D, 4> &v,
double d0,
bool interior =
true );
598std::vector<int>
assignRanks(
const std::vector<double> &x,
int N_ranks );
608std::vector<int>
assignRanks(
const std::vector<Point1D> &x,
int N_ranks );
618std::vector<int>
assignRanks(
const std::vector<Point2D> &x,
int N_ranks );
628std::vector<int>
assignRanks(
const std::vector<Point3D> &x,
int N_ranks );
std::vector< Point3D > sampleQuad(const std::array< Point3D, 4 > &v, double d0, bool interior=true)
Sample a line.
std::vector< int > assignRanks(const std::vector< double > &x, int N_ranks)
Assign ranks to a point cloud.
double distanceToTriangle(const std::array< Point2D, 3 > &tri, const Point2D &pos, const Point2D &ang)
Compute the intersection of a ray and triangle.
std::array< double, 2 > Point2D
double distanceToSphere(double r, const Point3D &pos, const Point3D &ang)
Compute the intersection of a ray and sphere.
Point3D map_logical_shell(double r1, double r2, double x, double y, double z)
Map logical coordinates to a shell.
std::array< double, 1 > Point1D
std::vector< Point3D > sampleTet(const std::array< Point3D, 4 > &v, double d0, bool interior=true)
Sample a line.
double distanceToQuadrilateral(const std::array< Point2D, 4 > &quad, const Point2D &pos, const Point2D &ang)
Compute the intersection of a ray and quadrilateral.
double distanceToCone(const Point3D &V, double theta, const Point3D &pos, const Point3D &ang)
Compute the intersection of a ray and cone.
double distanceToTube(double r1, double r2, double h, const Point3D &pos, const Point3D &ang)
Compute the intersection of a ray and tube.
Point3D map_logical_sphere(double R, double x, double y, double z)
Map logical coordinates to a sphere.
Point2D map_logical_poly(int N, double R, double x, double y)
Map logical coordinates to a regular polygon.
std::array< double, 3 > Point3D
double distanceToCylinder(double r, double h, const Point3D &pos, const Point3D &ang)
Compute the intersection of a ray and cylinder.
double distanceToCircularFrustum(double rb, double rt, double h, const Point3D &pos, const Point3D &ang)
Compute the intersection of a ray and circular frustum.
Point2D nearest(const Point2D &v1, const Point2D &v2, const Point2D &p)
Find the nearest point to a line segment.
double distanceToLine(const Point2D &pos, const Point2D &ang, const Point2D &v1, const Point2D &v2)
Compute the intersection of a ray and a line segment.
Point2D map_logical_circle(double R, int method, double x, double y)
Map logical coordinates to a circle.
double distanceToTetrahedron(const std::array< Point3D, 4 > &tet, const Point3D &pos, const Point3D &ang)
Compute the intersection of a ray and tetrahedron.
std::vector< Point3D > sampleTri(const std::array< Point3D, 3 > &v, double d0, bool interior=true)
Sample a line.
Point2D map_sphere_surface_logical(int method, double R, double x, double y, double z)
Map coordinates from the surface of a sphere to logical.
Point3D normalToQuadrilateral(const std::array< Point3D, 4 > &quad)
Compute the normal to a quadrilateral.
Point3D map_logical_sphere_surface(int method, double R, double x, double y)
Map logical coordinates to the surface of a sphere.
Point3D map_sphere_logical(double R, double x, double y, double z)
Map logical coordinates to a sphere.
Point2D map_poly_logical(int N, double R, double x, double y)
Map physical coordinates to the logical coordinates.
Point2D map_circle_logical(double R, int method, double x, double y)
Map physical coordinates to the logical coordinates.
double distanceToBox(const std::array< double, NDIM > &pos, const std::array< double, NDIM > &ang, const std::array< double, NDIM > &lb, const std::array< double, NDIM > &ub)
Compute the intersection of a ray and a box.
std::vector< Point2D > get_poly_vertices(int N, double R)
Get the Vertices of a regular polygon.
std::vector< Point3D > sampleLine(const std::array< Point3D, 2 > &v, double d0, bool interior=true)
Sample a line.
double distanceToCircle(double r, const Point2D &pos, const Point2D &ang)
Compute the intersection of a ray and circle (2D)
std::vector< AMP::Mesh::Point > subdivide(const std::array< AMP::Mesh::Point, 3 > &v, double res)
Subdivide a triangle.
double distance(const Point3D &x1, const Point3D &x2)
Compute the distance between two points.
Point2D normal(const Point2D &a, const Point2D &b)
Compute the normal to a line defined by 2 points.
double distanceToPlane(const Point3D &n, const Point3D &p0, const Point3D &pos, const Point3D &ang)
Compute the intersection of a ray and an infinite plane.
std::array< double, NP > barycentric(const std::array< std::array< double, NDIM >, NP > &x, const std::array< double, NDIM > &p)
Compute the barycentric coordinates.
Point3D map_shell_logical(double r1, double r2, double x, double y, double z)
Map a shell to logical coordinates.