MEPP2 Project
Geometry API

The Geometry API is provided by the Geometry concept detailed below.

See also:

  • Concepts for a general picture on MEPP2 concepts.


Geometry concept

Introduction

The Geometry concept provides an abstraction layer to manipulate the geometry of the real datastructures. For example the Point type of the CGAL Surface_mesh datastructure is different from the Point type of the AIF datastructure. So we need this abstraction layer to define a common interface that is supported by all datastructures. This allow to write an algorithm in a generic way.

The interface implementing the Geometry concept for a datastructure is defined by the specialization of the FEVV::Geometry_traits< > class for this datastructure. The various Geometry_traits specializations are defined in the Wrappings/Geometry_traits_....h files.

Notations

  • G    A FEVV::Geometry_traits< > type.
  • gt    An object of type G.
  • p,q, r    Objects of type Point.
  • x, y, z    Objects of type Scalar.
  • v, u    Objects of type Vector.

Associated types

Type Reference Description
G::Scalar Affine coordinates A type used to represent the coordinate of a Point.
G::Point Point of affine space The type "aggregating" Scalar coordinates.
G::Vector Affine "substraction" The type of an element of the associated vector space.

Valid expressions

Expression Returns Description
Point(x, y, z) Point Constructor of the Point defined its respective given coordinates.
q(p) Point Point copy constructor.
q = p Point Point assignement operator.
ORIGIN Point The point at the origin.
gt.get_x(p) Scalar Returns the 1st coordinate of point p.
gt.get_y(p) Scalar Returns the 2nd coordinate of point p.
gt.get_z(p) Scalar Returns the 3rd coordinate of point p.
Vector(x, y, z) Vector Constructor of the Vector defined its respective given coordinates.
u(v) Vector Vector copy constructor.
u = v Vector Vector assignement operator.
NULL_VECTOR Vector The zero length vector.
v[0] Scalar Returns the 1st coordinate of vector v (read only).
v[1] Scalar Returns the 2nd coordinate of vector v (read only).
v[2] Scalar Returns the 3rd coordinate of vector v (read only).
gt.normalize(v) Vector Returns the normalization of vector 'v'.
gt.length2(v) Scalar Returns the square of the length of vector v.
gt.length(v) Scalar Returns the length of vector v.
gt.length(p, q) Scalar Returns the distance between points p and q.
gt.normal(p, q, r) Vector Returns a vector that is normal to the plane passing through points p, q and r.
gt.unit_normal(p, q, r) Vector Returns a unit vector that is normal to the plane passing through points p, q and r.
gt.add_v(u, v) Vector Returns the sum of vectors u and v.
gt.add_pv(p, v) Point Returns the sum of point p and vector v.
gt.sub_v(u, v) Vector Returns the sum of vector u and the opposite of vector v.
gt.sub_pv(p, v) Point Returns the sum of point p and the opposite of vector v.
gt.sub_p(p, q) Vector Returns the vector from point q to point p.
gt.scalar_mult(v, s) Vector Returns the multiplication of vector v by scalar s.
gt.dot_product(u, v) Scalar Returns the dot product of vectors u and v.
gt.cross_product(u, v) Vector Returns the cross product of vectors u and v.


Notes:

  • the concept checking test GeometryConceptCheck.h illustrate all above expressions
  • the current implementation misses to enable the following expressions

    • p + q which returns a Point
    • p - q which returns a Vector
    • p + v which returns a Point

    because they are not supported by the Point and Vector types of all datastructures.