Shapes

class Point : public formo::Shape

Defines a 3D cartesian point.

Public Functions

Point(double x, double y, double z)

Creates a point with its 3 cartesian coordinates.

Parameters:
  • x – x-coordinate

  • y – y-coordinate

  • z – z-coordinate

double x() const

X-coordinate of this point.

double y() const

Y-coordinate of this point.

double z() const

Z-coordinate of this point.

double distance(const Point &pt) const

Computes the distance between two points.

Parameters:

ptPoint to measure distance to

Returns:

Distance between this point and pt

void mirror(const Point &pt)

Performs the symmetrical transformation of a point with respect to the point pt which is the center of the symmetry.

Parameters:

ptPoint of symmetry

void mirror(const Axis1 &ax1)

Performs the symmetrical transformation of a point with respect to an axis placement which is the axis of the symmetry.

Parameters:

ax1 – Axis placement

void mirror(const Axis2 &ax2)

Performs the symmetrical transformation of a point with respect to a plane.

Parameters:

ax2 – The axis placement ax2 locates the plane of the symmetry

Point mirrored(const Point &pt) const

Performs the symmetrical transformation of a point with respect to the point pt which is the center of the symmetry.

Parameters:

ptPoint of symmetry

Returns:

Mirrored point

Point mirrored(const Axis1 &ax1) const

Performs the symmetrical transformation of a point with respect to an axis placement which is the axis of the symmetry.

Parameters:

ax1 – Axis placement

Returns:

Mirrored point

Point mirrored(const Axis2 &ax2) const

Performs the symmetrical transformation of a point with respect to a plane.

Parameters:

ax2 – The axis placement ax2 locates the plane of the symmetry

Returns:

Mirrored point

void rotate(const Axis1 &ax1, double angle)

Rotate the point.

Parameters:
  • ax1 – The axis of the rotation.

  • angle – The angular value of the rotation in radians.

Point rotated(const Axis1 &ax1, double angle) const

Rotate the point.

Parameters:
  • ax1 – The axis of the rotation.

  • angle – The angular value of the rotation in radians.

Returns:

Rotate point

void scale(const Point &pt, double s)

Scales a point.

Parameters:
  • ptPoint that the scaling is relative to

  • s – The scaling value.

Point scaled(const Point &pt, double s) const

Scales a point.

Parameters:
  • ptPoint that the scaling is relative to

  • s – The scaling value.

Returns:

Scaled point

void translate(const Vector &vec)

Translates a point in the direction of the vector vec.

The magnitude of the translation is the vector’s magnitude.

Parameters:

vec – The vector of translation

void translate(const Point &p1, const Point &p2)

Translates a point from point p1 to point p2

Parameters:
  • p1 – First point

  • p2 – Second point

Point translated(const Vector &vec) const

Translates a point in the direction of the vector vec.

The magnitude of the translation is the vector’s magnitude.

Parameters:

vec – The vector of translation

Returns:

Translated point

Point translated(const Point &p1, const Point &p2) const

Translates a point from point p1 to point p2

Parameters:
  • p1 – First point

  • p2 – Second point

Returns:

Translated point

class Line : public formo::Edge
class Circle : public formo::Edge

Describes a circle in 3D space.

A circle is defined by its radius and positioned in space with a coordinate system.

Public Functions

Circle(const Axis2 &origin, double radius)

Construct a circle from an origin and a radius.

Parameters:
  • origin – Center point

  • radius – Radius

Circle(const Point &center, double radius, const Direction &normal = Direction(0., 0., 1.))

Construct a circle from a center point and a radius.

Parameters:
  • center – Center point

  • radius – Radius

  • norm – Normal of the plane

Circle(const Point &center, const Point &pt, const Direction &norm = Direction(0., 0., 1.))

Construct a circle from a center point and another point.

Parameters:
  • center – Center point

  • ptPoint that is part of the circle

  • norm – Normal of the plane

Circle(const Point &pt1, const Point &pt2, const Point &pt3)

Construct a circle from three points.

Parameters:
  • pt1 – First point

  • pt2 – Second point

  • pt3 – Third point

double area() const

Get circle area.

Returns:

Area of the circle

double radius() const

Get radius.

Returns:

Radius

Point location() const

Get circle location.

class ArcOfCircle : public formo::Edge

Describes an arc of a circle in 3D space.

Public Functions

ArcOfCircle(const Point &pt1, const Point &pt2, const Point &pt3)

Construct an arc of a circle from trhee points.

Parameters:
  • pt1 – First point

  • pt2 – Second point

  • pt3 – Third point

ArcOfCircle(const Circle &circ, const Point &pt1, const Point &pt2, bool sense = true)

Construct an arc of a circle from a circle and 2 points on the circle.

Parameters:
  • circCircle

  • pt1 – First point

  • pt2 – Second point

  • sense – Sense of the circle

ArcOfCircle(const Point &pt1, const Vector &tangent, const Point &pt2)

Construct an arc of a circle from a point, tangent at the point, and another point.

Parameters:
  • pt1 – First point

  • tangent – Tangent at point pt1

  • pt2 – Second point

Point start_point() const

Get the start point of the curve.

Point end_point() const

Get the end point of the curve.

class Polygon : public formo::Wire

Subclassed by formo::CircumscribedPolygon, formo::InscribedPolygon

class Spline : public formo::Edge

Public Functions

Spline(const std::vector<Point> &points)

Construct a B-spline that is passing through an array of points.

The continuity will be C2.

Parameters:

points – Array of points

Spline(const std::vector<Point> &points, const Vector &initial_tg, const Vector &final_tg)

Construct a B-spline that is passing through an array of points with specified tangency.

The continuity will be C1.

Parameters:
  • points – Array of points

  • initial_tg – Initial tangent

  • final_tg – Final tangent

class Box : public formo::Solid

Box.

class Cone : public formo::Solid
class Cylinder : public formo::Solid
class Sphere : public formo::Solid
class Shape

Subclassed by formo::Edge, formo::Face, formo::Point, formo::Prism, formo::Shell, formo::Solid, formo::Wire

Public Functions

std::string name() const

Get shape name.

Returns:

Shape name

void set_name(const std::string &name)

Set shape name.

Parameters:

name – New shape name

Color color() const

Get color.

void set_color(const Color &color)

Set color.

std::vector<Point> vertices() const

Get all vertices of this shape.

Returns:

All vertices of this shape

std::vector<Edge> edges() const

Get all edges of this shape.

Returns:

All edges of this shape

std::vector<Face> faces() const

Get all faces of this shape.

Returns:

All faces of this shape

std::vector<Solid> solids() const

Get all solids of this shape.

Returns:

All solid of this shape

class Edge : public formo::Shape

Subclassed by formo::ArcOfCircle, formo::Circle, formo::Helix, formo::Line, formo::Spline

Public Functions

double length() const

Compute the length of the edge.

Returns:

Length of the edge

class Wire : public formo::Shape

Subclassed by formo::Polygon

Public Functions

double length() const

Compute the length of the edge.

Returns:

Length of the edge

Shell draft(const Direction &dir, double angle, double length) const

Constructs the draft surface object defined by the wire, the direction, and the angle.

Parameters:
  • dirDirection

  • angle – Angle [radians]

  • length – Length of the draft

class Face : public formo::Shape

Public Functions

double area() const

Compute the area of the face.

Returns:

Area of the face

class Shell : public formo::Shape
class Solid : public formo::Shape

Subclassed by formo::Box, formo::Cone, formo::Cylinder, formo::Sphere

Public Functions

double volume() const

Compute the volume of the shape.

Returns:

Volume of the shape