Point.h¶
Note
The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded.
-
class
Point
¶ A Point represents a point in \(\mathbb{R}^3\) with coordinates \(x, y, z,\) or alternatively, a vector in \(\mathbb{R}^3\), supporting standard operations like the norm, distances, scalar and vector products etc.
-
explicit
Point
(const double x = 0.0, const double y = 0.0, const double z = 0.0)¶ Create a point at (x, y, z). Default value (0, 0, 0).
- @param x (double)
- The x-coordinate.
- @param y (double)
- The y-coordinate.
- @param z (double)
- The z-coordinate.
-
Point
(std::size_t dim, const double *x)¶ Create point from array
- @param dim (std::size_t)
- Dimension of the array.
- @param x (double)
- The array to create a Point from.
-
Point
(const Array<double> &x)¶ Create point from Array
- @param x (Array<double>)
- Array of coordinates.
-
double &
operator[]
(std::size_t i)¶ Return address of coordinate in direction i
- @param i (std::size_t)
- Direction.
Returns @return double
Address of coordinate in the given direction.
-
double
operator[]
(std::size_t i) const¶ Return coordinate in direction i
- @param i (std::size_t)
- Direction.
- @return double
- The coordinate in the given direction.
-
double
x
() const¶ Return x-coordinate
- @return double
- The x-coordinate.
-
double
y
() const¶ Return y-coordinate
- @return double
- The y-coordinate.
-
double
z
() const¶ Return z-coordinate
- @return double
- The z-coordinate.
-
double *
coordinates
()¶ Return coordinate array
- @return double*
- The coordinates.
-
const double *
coordinates
() const¶ Return coordinate array (const. version)
- @return double*
- The coordinates.
-
std::array<double, 3>
array
() const¶ Return copy of coordinate array
- Returns
- list of double
- The coordinates.
-
Point
operator-
(const Point &p) const¶ Compute difference of two points @param p (Point) @return Point
-
double
squared_distance
(const Point &p) const¶ Compute squared distance to given point
- @param p (Point)
- The point to compute distance to.
- @return double
- The squared distance.
-
double
distance
(const Point &p) const¶ Compute distance to given point
- @param p (Point)
- The point to compute distance to.
- @return double
- The distance.
@code{.cpp}
Point p1(0, 4, 0); Point p2(2, 0, 4); info(“%g”, p1.distance(p2));@endcode
-
double
norm
() const¶ Compute norm of point representing a vector from the origin
- @return double
- The (Euclidean) norm of the vector from the origin to the point.
@code{.cpp}
Point p(1.0, 2.0, 2.0); info(“%g”, p.norm());@endcode
-
double
squared_norm
() const¶ Compute norm of point representing a vector from the origin
- @return double
- The squared (Euclidean) norm of the vector from the origin of the point.
@code{.cpp}
Point p(1.0, 2.0, 2.0); info(“%g”, p.squared_norm());@endcode
-
const Point
cross
(const Point &p) const¶ Compute cross product with given vector
- @param p (
Point
) - Another point.
- @return Point
- The cross product.
- @param p (
-
double
dot
(const Point &p) const¶ Compute dot product with given vector
- @param p (Point)
- Another point.
- @return double
- The dot product.
@code{.cpp}
Point p1(1.0, 4.0, 8.0); Point p2(2.0, 0.0, 0.0); info(“%g”, p1.dot(p2));@endcode
-
Point
rotate
(const Point &a, double theta) const¶ Rotate around a given axis
- @param a (Point)
- The axis to rotate around. Must be unit length.
- @param theta (double)
- The rotation angle.
- @return Point
- The rotated point.
-
std::string
str
(bool verbose = false) const¶ Return informal string representation (pretty-print)
- @param verbose (bool)
- Flag to turn on additional output.
- @return std::string
- An informal representation of the function space.
-
explicit