$extrastylesheet
libMesh::Plane Class Reference

#include <plane.h>

Inheritance diagram for libMesh::Plane:

List of all members.

Public Member Functions

 Plane ()
 Plane (const Point &p, const Point &n)
 Plane (const Point &p0, const Point &p1, const Point &p2)
 Plane (const Plane &other_plane)
 ~Plane ()
void create_from_point_normal (const Point &p, const Point &n)
void create_from_three_points (const Point &p0, const Point &p1, const Point &p2)
void xy_plane (const Real zpos=0.)
void xz_plane (const Real ypos=0.)
void yz_plane (const Real xpos=0.)
bool above_surface (const Point &p) const
bool below_surface (const Point &p) const
bool on_surface (const Point &p) const
Point closest_point (const Point &p) const
Point unit_normal (const Point &p) const
const Pointget_planar_point () const
virtual Point surface_coords (const Point &world_coords) const
virtual Point world_coords (const Point &surf_coords) const

Private Member Functions

const Pointnormal () const

Private Attributes

Point _point
Point _normal

Detailed Description

This class defines a plane.

Author:
Benjamin S. Kirk, 2002

Definition at line 37 of file plane.h.


Constructor & Destructor Documentation

Dummy Constructor.

Definition at line 32 of file plane.C.

{
}
libMesh::Plane::Plane ( const Point p,
const Point n 
)

Constructs a plane containing point p with normal n.

Definition at line 38 of file plane.C.

References create_from_point_normal().

{
  this->create_from_point_normal (p, n);
}
libMesh::Plane::Plane ( const Point p0,
const Point p1,
const Point p2 
)

Constructs a plane containing the three points. The normal is determined in a counter-clockwise sense. See the create_from_three_points method for more details.

Definition at line 46 of file plane.C.

References create_from_three_points().

{
  this->create_from_three_points (p0, p1, p2);
}
libMesh::Plane::Plane ( const Plane other_plane)

Copy-constructor.

Definition at line 55 of file plane.C.

References _normal, _point, and create_from_point_normal().

                                      :
  Surface()
{
  this->create_from_point_normal(other_plane._point,
                                 other_plane._normal);
}

Destructor. Does nothing at the moment.

Definition at line 64 of file plane.C.

{
}

Member Function Documentation

bool libMesh::Plane::above_surface ( const Point p) const [virtual]
Returns:
true if the point p is above the surface, false otherwise.

Implements libMesh::Surface.

Definition at line 127 of file plane.C.

References _point, normal(), and libMesh::Real.

Referenced by below_surface().

{
  // Create a vector from the surface to point p;
  const Point w = p - _point;

  // The point is above the surface if the projection
  // of that vector onto the normal is positive
  const Real proj = w*this->normal();

  if (proj > 0.)
    return true;

  return false;
}
bool libMesh::Plane::below_surface ( const Point p) const [virtual]
Returns:
true if the point p is below the surface, false otherwise.

Implements libMesh::Surface.

Definition at line 144 of file plane.C.

References above_surface().

{
  return ( !this->above_surface (p) );
}
Point libMesh::Plane::closest_point ( const Point p) const [virtual]
Returns:
the closest point on the surface to point p.

Implements libMesh::Surface.

Definition at line 169 of file plane.C.

References _point, and normal().

{
  // Create a vector from the surface to point p;
  const Point w = p - _point;

  // The closest point in the plane to point p
  // is in the negative normal direction
  // a distance w (dot) p.
  const Point cp = p - this->normal()*(w*this->normal());

  return cp;
}
void libMesh::Plane::create_from_point_normal ( const Point p,
const Point n 
)

Defines a plane containing point p with normal n.

Definition at line 70 of file plane.C.

References _normal, _point, and libMesh::TypeVector< T >::unit().

Referenced by Plane().

{
  _normal = n.unit();
  _point  = p;
}
void libMesh::Plane::create_from_three_points ( const Point p0,
const Point p1,
const Point p2 
)

Defines a plane intersecting the three points p0, p1, and p2. The normal is constructed in a counter-clockwise sense, i.e. (p1-p0)x(p2-p0);

Definition at line 78 of file plane.C.

References _normal, _point, libMesh::TypeVector< T >::cross(), and libMesh::TypeVector< T >::unit().

Referenced by Plane().

{
  // Just use p0 for the point.
  _point = p0;

  const Point e0 = p1 - p0;
  const Point e1 = p2 - p0;
  const Point n  = e0.cross(e1);

  _normal = n.unit();
}
Returns:
a point on the plane useful for determining position

Definition at line 189 of file plane.C.

References _point.

{
  return _point;
}
const Point & libMesh::Plane::normal ( ) const [inline, private]

Returns the normal for the plane.

Definition at line 155 of file plane.h.

References _normal.

Referenced by above_surface(), closest_point(), and on_surface().

{
  return _normal;
}
bool libMesh::Plane::on_surface ( const Point p) const [virtual]
Returns:
true if the point p is on the surface, false otherwise. Note that the definition of on the surface really means "very close" to account for roundoff error.

Implements libMesh::Surface.

Definition at line 151 of file plane.C.

References _point, std::abs(), normal(), and libMesh::Real.

{
  // Create a vector from the surface to point p;
  const Point w = p - _point;

  // If the projection of that vector onto the
  // plane's normal is 0 then the point is in
  // the plane.
  const Real proj = w * this->normal();

  if (std::abs(proj) < 1.e-10)
    return true;

  return false;
}
Point libMesh::Surface::surface_coords ( const Point world_coords) const [inline, virtual, inherited]
Returns:
the Point world_coords in the surface's coordinate system. world_coords is in the world coordinate system. This method is not purely virtual, because there may be surfaces that do not have an own coordinate system. These simply do not have to overload this method.

Reimplemented in libMesh::Sphere.

Definition at line 118 of file surface.h.

{
  Point p (from_world_coords);
  return p;
}
Point libMesh::Plane::unit_normal ( const Point p) const [virtual]
Returns:
a unit vector normal to the surface at point p.

Implements libMesh::Surface.

Definition at line 184 of file plane.C.

References _normal.

{
  return _normal;
}
Point libMesh::Surface::world_coords ( const Point surf_coords) const [inline, virtual, inherited]
Returns:
the world (cartesian) coordinates for the surface coordinates surf_coords. This method is not purely virtual, because there may be surfaces that do not have an own coordinate system. These simply do not have to overload this method.

Reimplemented in libMesh::Sphere.

Definition at line 127 of file surface.h.

{
  Point p (surf_coords);
  return p;
}
void libMesh::Plane::xy_plane ( const Real  zpos = 0.)

Creates an XY plane located at z=zpos,

Definition at line 94 of file plane.C.

References _normal, and _point.

{
  const Point p (0., 0., zpos);
  const Point n (0., 0., 1.);

  _point  = p;
  _normal = n;
}
void libMesh::Plane::xz_plane ( const Real  ypos = 0.)

Creates an XZ plane located at y=ypos,

Definition at line 105 of file plane.C.

References _normal, and _point.

{
  const Point p (0., ypos, 0.);
  const Point n (0., 1., 0.);

  _point  = p;
  _normal = n;
}
void libMesh::Plane::yz_plane ( const Real  xpos = 0.)

Creates an YZ plane located at x=xpos,

Definition at line 116 of file plane.C.

References _normal, and _point.

{
  const Point p (xpos, 0., 0.);
  const Point n (1., 0., 0.);

  _point  = p;
  _normal = n;
}

Member Data Documentation

The plane is defined by a point and a normal.

Definition at line 146 of file plane.h.

Referenced by above_surface(), closest_point(), create_from_point_normal(), create_from_three_points(), get_planar_point(), on_surface(), Plane(), xy_plane(), xz_plane(), and yz_plane().


The documentation for this class was generated from the following files: