Point

class dolfin.cpp.mesh.Point(*args)

Bases: object

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.

Copy constructor

Parameters:Point & p (const) – (Point ) The object to be copied.
array()

Return copy of coordinate array Returns list of double The coordinates.

Return type:std::array< double, 3 >
cross()

Compute cross product with given vector

Parameters:Point & p (const) – (Point ) Another point.
Return type:const Point
Returns:Point The cross product.
distance()

Compute distance to given point

Point p1(0, 4, 0);
Point p2(2, 0, 4);
info("%g", p1.distance(p2));
Parameters:Point & p (const) – (Point ) The point to compute distance to.
Return type:double
Returns:double The distance.
dot()

Compute dot product with given vector

Point p1(1.0, 4.0, 8.0);
Point p2(2.0, 0.0, 0.0);
info("%g", p1.dot(p2));
Parameters:Point & p (const) – (Point ) Another point.
Return type:double
Returns:double The dot product.
norm()

Compute norm of point representing a vector from the origin

Point p(1.0, 2.0, 2.0);
info("%g", p.norm());
Return type:double
Returns:double The (Euclidean) norm of the vector from the origin to the point.
rotate()

Rotate around a given axis

Parameters:
  • Point & a (const) – (Point ) The axis to rotate around. Must be unit length.
  • theta (double) – (double) The rotation angle.
Return type:

Point

Returns:

Point The rotated point.

squared_distance()

Compute squared distance to given point

Parameters:Point & p (const) – (Point ) The point to compute distance to.
Return type:double
Returns:double The squared distance.
squared_norm()

Compute norm of point representing a vector from the origin

Point p(1.0, 2.0, 2.0);
info("%g", p.squared_norm());
Return type:double
Returns:double The squared (Euclidean) norm of the vector from the origin of the point.
str()

Return informal string representation (pretty-print)

Parameters:verbose (bool) – (bool) Flag to turn on additional output.
Return type:std::string
Returns:std::string An informal representation of the function space.
thisown

The membership flag

x()

Return x-coordinate

Return type:double
Returns:double The x-coordinate.
y()

Return y-coordinate

Return type:double
Returns:double The y-coordinate.
z()

Return z-coordinate

Return type:double
Returns:double The z-coordinate.