Using the API to extend the geometry types

The solver handles hole and face (plane) features that are either IsPrimitive or IsFreeForm. A few basic types are defined like SimpleHole and MeshHole, but new ones can be also defined. For example for point clouds, that don't have faces, like a mesh, only points.

This capability is properly documented, as a major API rewrite is going on in #3.

Defining a new geometry

Defining a new geometry is pretty easy:

An example

Let's assume that we want to define a new holelike type: MyDisk, which has a featurepoint, a normal, and a radius.

using BlankLocalizationCore

struct MyDisk <: AbstractHoleGeometry

GeometryStyle(::Type{MyDisk}) = IsPrimitive()

It is an IsPrimitive and holelike feature, therefore we need to define the:

  • featurepoint
  • featureradius
  • visualizationgeometry

functions. These look like as follows:

featurepoint(::IsPrimitive, x::MyDisk) = x.point
featureradius(::IsPrimitive, x::MyDisk) = x.diameter/2

using Meshes

function visualizationgeometry(geom::MyDisk)
    plane = Plane(Point3(geom.point), Vec3(geom.normal))
    return Disk(plane, geom.diameter/2)