class HalfSpace : public feasst::Shape

A half space divides space by a plane (or line in 2D). If you are on the “right” side of this divding surface, then you are inside. Otherwise, you are not.

The current implementation is optimized such that the dividing surface is assumed perpendicular to one of the coordinate axes. For a more arbitrarily-oriented plane, see HalfSpaceTilted.

Thus, there are only three variables required to specify the half space.

  1. The dimension of the axis which is perpendicular to the dividing surface

  2. The coordinate value of the intersection of the dividing surface with this axis.

  3. The direction along this axis which is ‘inside’ the shape.

Public Functions

HalfSpace(const argtype &args = argtype())

  • args: dimension : Set the dimension of the axis which is perpendicular to the divider.

    intersection : Set the value where this axis intersects the dividing surface.

    direction : Set the direction at the intersection which is inside. The only accepted values are “1” or “-1”.

int dimension() const

Return dimension argument.

double intersection() const

Return the intersection argument.

int direction() const

Return dimension argument.

double nearest_distance(const Position &point) const

Return the distance from the point to the nearest point on the surface. The distance is negative if the point is inside of the shape and positive if it is outside.