namespace geode

Overview

namespace geode {

// namespaces

namespace geode::detail;

// typedefs

typedef std::pair<EdgeMapping, bool> OrientedEdgeMapping;
typedef std::pair<EdgeMultiMapping, bool> OrientedEdgeMultiMapping;
typedef std::pair<Position, Position> SegmentSegmentIntersection;
typedef std::pair<Position, Position> SegmentTriangleIntersection;
typedef Side Sign;
typedef Mapping<index_t> VertexMapping;
typedef Mapping<index_t> EdgeMapping;
typedef Mapping<index_t> FacetMapping;
typedef Mapping<index_t> TriangleMapping;
typedef Mapping<index_t> TetrahedronMapping;
typedef MultiMapping<index_t> VertexMultiMapping;
typedef MultiMapping<index_t> EdgeMultiMapping;
typedef MultiMapping<index_t> FacetMultiMapping;
typedef MultiMapping<index_t> TetrahedronMultiMapping;
typedef Mapping<PolyhedronFacet> PolyhedronFacetMapping;
typedef SplitInfo SplitTetrahedron;
typedef SplitInfo SplitFacet;
typedef SplitInfo SplitTriangle;
typedef Mapping<PolygonEdge> PolygonEdgeMapping;
typedef MultiMapping<PolygonEdge> PolygonEdgeMultiMapping;

// enums

enum IntersectionType;
enum SplitSide;

// structs

struct AlongSolidSplitEdgeInfo;
struct BRepCollapsePolygonEdgeInfo;
struct BRepSplitPolygonEdgeInfo;
struct CollapseEdgeInfo;
struct CollapsePolygonEdgeInfo;

template <typename Intersection>
struct CorrectnessInfo;

struct CutPatchException;
struct CutPathException;
struct EdgeSplit;
struct FacetSplit;

template <index_t dimension>
struct GeometricSurfacePath;

template <typename Intersection>
struct IntersectionResult;

template <typename Type>
struct Mapping;

template <>
struct Mapping<index_t>;

struct ModelCollapsePolygonEdgeInfo;
struct ModelSplitPolygonEdgeInfo;

template <>
struct MultiMapping<index_t>;

template <typename Type>
struct MultiMapping;

template <index_t dimension>
struct PolygonData;

template <index_t dimension>
struct PolygonEdgeData;

struct PolygonEdgeInfo;
struct SectionCollapsePolygonEdgeInfo;
struct SectionSplitPolygonEdgeInfo;
struct SidedSolidSplitEdgeInfo;
struct SidedSurface;
struct SolidCollapseEdgeInfo;
struct SolidCutPatchInfo;
struct SolidCutPathInfo;
struct SolidPatch;
struct SolidPath;
struct SolidSplitEdgeInfo;
struct SolidSplitInfo;
struct SolidSwapFacetInfo;
struct SortedSurfaces;
struct SplitInfo;
struct SplitPolygonEdgeInfo;
struct SplitTriangleInfo;
struct SurfaceCollapseInfo;
struct SurfaceCutPathInfo;
struct SurfacePath;

// classes

class BRepGeometricModifier;

template <index_t dimension>
class EdgedCurveModifier;

class LicensedModule;
class PropagationSettings;
class RayTracing3D;

template <index_t dimension>
class RegularGridPointFunction;

template <index_t dimension>
class RegularGridScalarFunction;

class SectionGeometricModifier;
class SolidPathFinder;

template <index_t dimension>
class SurfacePathFinder;

template <index_t dimension>
class SurfaceSegmentFinder;

class SurfaceSegmentFinder2D;
class TetrahedraClosestThan;
class TetrahedralSolidEpsilonModifier;
class TetrahedralSolidModifier;

template <index_t dimension>
class TetrahedralSolidPointFunction;

template <index_t dimension>
class TetrahedralSolidScalarFunction;

template <index_t dimension>
class TrianglesClosestThan;

template <index_t dimension>
class TriangulatedSurfaceEpsilonModifier;

template <index_t dimension>
class TriangulatedSurfaceModifier;

class VertexSetModifier;

// global functions

void geode_common_core_api initialize_common_core();
void geode_common_cutter_solid_api initialize_cutter_solid();
FORWARD_DECLARATION_DIMENSION_CLASS(TetrahedralSolid);
FORWARD_DECLARATION_DIMENSION_CLASS(TetrahedralSolidBuilder);
FORWARD_DECLARATION_DIMENSION_CLASS(TriangulatedSurface);
FORWARD_DECLARATION_DIMENSION_CLASS(Triangle);
ALIAS_3D(TetrahedralSolid);
ALIAS_3D(TetrahedralSolidBuilder);
ALIAS_3D(TriangulatedSurface);
ALIAS_3D(Triangle);

SolidCutPatchInfo geode_common_cutter_solid_api cut_along_patch(
    const TetrahedralSolid3D& solid,
    TetrahedralSolidBuilder3D& builder,
    const Triangle3D& triangle,
    TriangulatedSurface3D& patch
    );

SolidCutPatchInfo geode_common_cutter_solid_api cut_along_patch(
    const TetrahedralSolid3D& solid,
    TetrahedralSolidBuilder3D& builder,
    absl::Span<const PatchFrontEdge> boundary_edges,
    const Triangle3D& triangle
    );

SolidCutPathInfo geode_common_cutter_solid_api cut_along_path(
    const TetrahedralSolid3D& solid,
    TetrahedralSolidBuilder3D& builder,
    index_t begin,
    index_t end,
    absl::Span<const SolidPath> path_splits
    );

SolidCutPathInfo geode_common_cutter_solid_api cut_along_path(
    const TetrahedralSolid3D& solid,
    TetrahedralSolidBuilder3D& builder,
    index_t begin,
    index_t end
    );

void geode_common_cutter_surface_api initialize_cutter_surface();
ALIAS_2D_AND_3D(TriangulatedSurface);
ALIAS_2D_AND_3D(TriangulatedSurfaceBuilder);

template <index_t dimension>
SurfaceCutPathInfo cut_along_path(
    const TriangulatedSurface<dimension>& surface,
    TriangulatedSurfaceBuilder<dimension>& builder,
    index_t begin,
    index_t end,
    absl::Span<const GeometricSurfacePath<dimension>> path_splits
    );

SurfaceCutPathInfo geode_common_cutter_surface_api cut_along_path(
    const TriangulatedSurface2D& surface,
    TriangulatedSurfaceBuilder2D& builder,
    index_t begin,
    index_t end
    );

ALIAS_2D_AND_3D(GeometricSurfacePath);

std::vector<GeometricSurfacePath2D> geode_common_cutter_surface_api determine_cuts(
    const TriangulatedSurface2D& surface,
    index_t begin,
    index_t end,
    absl::Span<const geode::SurfacePath> path_splits
    );

std::vector<GeometricSurfacePath3D> geode_common_cutter_surface_api determine_cuts(
    const TriangulatedSurface3D& surface,
    index_t begin,
    index_t end,
    const Plane& plane,
    absl::Span<const geode::SurfacePath> path_splits
    );

ALIAS_2D(TriangulatedSurface);
FORWARD_DECLARATION_DIMENSION_CLASS(InfiniteLine);
FORWARD_DECLARATION_DIMENSION_CLASS(Point);
FORWARD_DECLARATION_DIMENSION_CLASS(Segment);
FORWARD_DECLARATION_DIMENSION_CLASS(Sphere);
ALIAS_2D_AND_3D(InfiniteLine);
ALIAS_2D_AND_3D(Point);
ALIAS_2D_AND_3D(Segment);

IntersectionResult<Point3D> geode_common_geometry_api line_plane_intersection(
    const InfiniteLine3D& line,
    const Plane& plane
    );

template <index_t dimension>
IntersectionResult<absl::InlinedVector<Point<dimension>, 2>> line_sphere_intersection(
    const InfiniteLine<dimension>& line,
    const Sphere<dimension>& sphere
    );

template <index_t dimension>
IntersectionResult<absl::InlinedVector<Point<dimension>, 2>> segment_sphere_intersection(
    const Segment<dimension>& segment,
    const Sphere<dimension>& sphere
    );

IntersectionResult<Point3D> geode_common_geometry_api segment_plane_intersection(
    const Segment3D& segment,
    const Plane& plane
    );

IntersectionResult<Point3D> geode_common_geometry_api segment_triangle_intersection(
    const Segment3D& segment,
    const Triangle3D& triangle
    );

IntersectionResult<Point3D> geode_common_geometry_api line_triangle_intersection(
    const InfiniteLine3D& line,
    const Triangle3D& triangle
    );

IntersectionResult<Point2D> geode_common_geometry_api line_line_intersection(
    const InfiniteLine2D& line0,
    const InfiniteLine2D& line1
    );

IntersectionResult<Point2D> geode_common_geometry_api segment_segment_intersection(
    const Segment2D& segment0,
    const Segment2D& segment1
    );

IntersectionResult<Point2D> geode_common_geometry_api segment_line_intersection(
    const Segment2D& segment,
    const InfiniteLine2D& line
    );

SegmentSegmentIntersection geode_common_geometry_api segment_segment_intersection_detection(
    const Segment2D& segment0,
    const Segment2D& segment1
    );

SegmentSegmentIntersection geode_common_geometry_api colinear_segment_segment_intersection_detection(
    const Segment2D& segment0,
    const Segment2D& segment1
    );

Position geode_common_geometry_api segment_line_intersection_detection(
    const Segment2D& segment,
    const InfiniteLine2D& line
    );

Position geode_common_geometry_api line_triangle_intersection_detection(
    const InfiniteLine3D& line,
    const Triangle3D& triangle
    );

SegmentTriangleIntersection geode_common_geometry_api segment_triangle_intersection_detection(
    const Segment3D& segment,
    const Triangle3D& triangle
    );

Position geode_common_geometry_api segment_plane_intersection_detection(
    const Segment3D& segment,
    const Plane& plane
    );

ALIAS_2D(InfiniteLine);

Side geode_common_geometry_api point_side_to_segment(
    const Point2D& point,
    const Segment2D& segment
    );

Side geode_common_geometry_api point_side_to_line(
    const Point2D& point,
    const InfiniteLine2D& line
    );

Side geode_common_geometry_api point_side_to_plane(
    const Point3D& point,
    const Plane& plane
    );

Side geode_common_geometry_api point_side_to_triangle(
    const Point3D& point,
    const Triangle3D& triangle
    );

template <index_t dimension>
Position point_segment_position(
    const Point<dimension>& point,
    const Segment<dimension>& segment
    );

template <index_t dimension>
Position point_triangle_position(
    const Point<dimension>& point,
    const Triangle<dimension>& triangle
    );

Position geode_common_geometry_api point_tetra_position(
    const Point3D& point,
    const Tetra& tetra
    );

absl::FixedArray<index_t> geode_common_geometry_api radial_sort(
    const Segment3D& segment,
    absl::Span<const Point3D> points
    );

ALIAS_2D_AND_3D(Triangle);
Sign geode_common_geometry_api tetrahedron_volume_sign(const Tetra& tetra);
Sign geode_common_geometry_api triangle_area_sign(const Triangle2D& triangle);

Sign geode_common_geometry_api triangle_area_sign(
    const Triangle3D& triangle,
    local_index_t axis
    );

void geode_common_helpers_api initialize_helpers();
FORWARD_DECLARATION_DIMENSION_CLASS(Line);
ALIAS_3D(Line);

SortedSurfaces geode_common_helpers_api surface_radial_sort(
    const BRep& brep,
    const Line3D& line
    );

std::vector<std::pair<MeshComponentVertex, MeshComponentVertex>> geode_common_helpers_api common_vertices(
    absl::Span<const MeshComponentVertex> vertex0,
    absl::Span<const MeshComponentVertex> vertex1
    );

template <index_t dimension>
std::vector<GridCellIndices<dimension>> rasterize_segment(
    const RegularGrid<dimension>& grid,
    const Segment<dimension>& segment
    );

template <index_t dimension>
std::vector<GridCellIndices<dimension>> conservative_rasterize_segment(
    const RegularGrid<dimension>& grid,
    const Segment<dimension>& segment
    );

template <index_t dimension>
std::vector<GridCellIndices<dimension>> rasterize_triangle(
    const RegularGrid<dimension>& grid,
    const Triangle<dimension>& triangle
    );

FORWARD_DECLARATION_DIMENSION_CLASS(SurfaceMesh);
ALIAS_3D(SurfaceMesh);

void geode_common_helpers_api perform_propagation(
    const TetrahedralSolid3D& solid,
    PropagationSettings& settings
    );

ALIAS_2D_AND_3D(TrianglesClosestThan);

template <index_t dimension>
void perform_propagation(
    const TriangulatedSurface<dimension>& surface,
    PropagationSettings& settings
    );

void geode_common_interpolation_api initialize_interpolation();
ALIAS_2D_AND_3D(RegularGridPointFunction);
ALIAS_2D_AND_3D(RegularGridScalarFunction);
ALIAS_3D(TetrahedralSolidPointFunction);
ALIAS_3D(TetrahedralSolidScalarFunction);
void geode_common_mesh_repair_api initialize_mesh_repair();

template <index_t dimension>
void repair_polygon_bad_orientations(SurfaceMesh<dimension>& mesh);

absl::FixedArray<Mapping<index_t>> geode_common_modifier_common_api extract_mappings_from_split_info(absl::Span<const SplitInfo> split_info);

void geode_common_modifier_common_api update_vertex_mappings(
    std::vector<geode::VertexMultiMapping>& vertex_multi_mappings,
    const geode::VertexMultiMapping& collapse_mapping
    );

template <typename T>
void add_mappings_in_multi_mappings(
    std::vector<MultiMapping<T>>& multi_mappings,
    absl::Span<const Mapping<T>> new_mappings
    );

template <typename T>
void process_mapping_element(
    const geode::Mapping<T>& element,
    absl::flat_hash_set<T>& to_remove,
    absl::flat_hash_map<T, T>& new_to_old,
    const T&
    );

template <typename T>
void process_mapping_element(
    geode::MultiMapping<T>& element,
    absl::flat_hash_set<T>& to_remove,
    absl::flat_hash_map<T, absl::InlinedVector<T, 1>>& new_to_olds,
    const T& no_value
    );

template <typename T, typename MappingType, typename NewToOldMap>
void update_mappings(
    std::vector<MappingType>& mappings,
    NewToOldMap& new_to_old,
    const T& no_value
    );

template <typename T>
void update_mappings(
    std::vector<geode::Mapping<T>>& mappings,
    const T& no_value
    );

template <typename T>
void update_multi_mappings(
    std::vector<geode::MultiMapping<T>>& multi_mappings,
    const T& no_value
    );

void geode_common_modifier_edged_curve_api initialize_modifier_edged_curve();
FORWARD_DECLARATION_DIMENSION_CLASS(EdgedCurve);
FORWARD_DECLARATION_DIMENSION_CLASS(EdgedCurveBuilder);
ALIAS_2D_AND_3D(EdgedCurveModifier);
FORWARD_DECLARATION_DIMENSION_CLASS(Block);
FORWARD_DECLARATION_DIMENSION_CLASS(Surface);
ALIAS_3D(Block);
ALIAS_3D(Point);
ALIAS_3D(Surface);
void geode_common_modifier_model_api initialize_modifier_model();
ALIAS_2D(Line);
ALIAS_2D(Point);
ALIAS_2D(Surface);
void geode_common_modifier_solid_api initialize_modifier_solid();
FORWARD_DECLARATION_DIMENSION_CLASS(SolidMesh);
ALIAS_3D(SolidMesh);
void geode_common_modifier_surface_api initialize_modifier_surface();
FORWARD_DECLARATION_DIMENSION_CLASS(TriangulatedSurfaceBuilder);
ALIAS_2D_AND_3D(TriangulatedSurfaceEpsilonModifier);
ALIAS_2D_AND_3D(TriangulatedSurfaceModifier);

} // namespace geode

Detailed Documentation

Global Functions

SolidCutPatchInfo geode_common_cutter_solid_api cut_along_patch(
    const TetrahedralSolid3D& solid,
    TetrahedralSolidBuilder3D& builder,
    const Triangle3D& triangle,
    TriangulatedSurface3D& patch
    )

Perform a TetrahedralSolid3D planar cut along a triangle given the patch cut information.

Parameters:

solid

TetrahedralSolid to cut

builder

Builder of the Solid

triangle

The triangle corresponding to the patch to insert in solid

patch

Patch cut information @warn Cut tetrahedra are set as inactive but not deleted.

SolidCutPatchInfo geode_common_cutter_solid_api cut_along_patch(
    const TetrahedralSolid3D& solid,
    TetrahedralSolidBuilder3D& builder,
    absl::Span<const PatchFrontEdge> boundary_edges,
    const Triangle3D& triangle
    )

Perform a TetrahedralSolid3D planar cut along a triangle given its boundary edges. These boundary edges are oriented solid edges.

Parameters:

solid

TetrahedralSolid to cut

builder

Builder of the Solid

boundary_edges

List of oriented Patch boundary as solid edges

triangle

The triangle corresponding to the patch to insert in solid @warn Cut tetrahedra are set as inactive but not deleted.

SolidCutPathInfo geode_common_cutter_solid_api cut_along_path(
    const TetrahedralSolid3D& solid,
    TetrahedralSolidBuilder3D& builder,
    index_t begin,
    index_t end,
    absl::Span<const SolidPath> path_splits
    )

Perform a TetrahedralSolid3D rectilinear cut between two vertices given where to split the tetrahedra.

Parameters:

begin

Index of the cut starting vertex

end

Index of the cut ending vertex

path_splits

Ordered list of Path splits @warn Cut tetrahedra are set as inactive but not deleted.

IntersectionResult<Point3D> geode_common_geometry_api line_plane_intersection(
    const InfiniteLine3D& line,
    const Plane& plane
    )

Compute the intersection between a plane and an infinite line

Returns:

an optional of the intersection.

template <index_t dimension>
IntersectionResult<absl::InlinedVector<Point<dimension>, 2>> line_sphere_intersection(
    const InfiniteLine<dimension>& line,
    const Sphere<dimension>& sphere
    )

Compute the intersection(s) between a sphere and an infinite line

Returns:

an optional of the intersection points.

template <index_t dimension>
IntersectionResult<absl::InlinedVector<Point<dimension>, 2>> segment_sphere_intersection(
    const Segment<dimension>& segment,
    const Sphere<dimension>& sphere
    )

Compute the intersection(s) between a (n-1)-sphere and a segment in n-dimension space.

Returns:

an optional of the intersection points.

IntersectionResult<Point3D> geode_common_geometry_api segment_plane_intersection(
    const Segment3D& segment,
    const Plane& plane
    )

Compute the intersection between a plane and a segment if the segment is included in the plane nothing is returned

Returns:

an optional of the intersection point.

IntersectionResult<Point3D> geode_common_geometry_api segment_triangle_intersection(
    const Segment3D& segment,
    const Triangle3D& triangle
    )

Compute the intersection of a segment and a triangle if the segment is included in the triangle plane nothing is returned

Returns:

an optional of the intersection point.

IntersectionResult<Point3D> geode_common_geometry_api line_triangle_intersection(
    const InfiniteLine3D& line,
    const Triangle3D& triangle
    )

Compute the intersection of a line and a triangle if the segment is included in the triangle plane nothing is returned

Returns:

an optional of the intersection point.

IntersectionResult<Point2D> geode_common_geometry_api line_line_intersection(
    const InfiniteLine2D& line0,
    const InfiniteLine2D& line1
    )

Compute the intersection between two infinite lines

Returns:

an optional of the intersection point.

IntersectionResult<Point2D> geode_common_geometry_api segment_segment_intersection(
    const Segment2D& segment0,
    const Segment2D& segment1
    )

Compute the intersection between two segments

Returns:

an optional of the intersection point.

IntersectionResult<Point2D> geode_common_geometry_api segment_line_intersection(
    const Segment2D& segment,
    const InfiniteLine2D& line
    )

Compute the intersection between a segment and an infinite line

Returns:

an optional of the intersection point.

SegmentSegmentIntersection geode_common_geometry_api segment_segment_intersection_detection(
    const Segment2D& segment0,
    const Segment2D& segment1
    )

Detect if there is an intersection between two 2D segments

Returns:

the position of the intersection on the two segments. Returns outside-outside if there is no intersection or parallel-pallel if all points are colinear

SegmentSegmentIntersection geode_common_geometry_api colinear_segment_segment_intersection_detection(
    const Segment2D& segment0,
    const Segment2D& segment1
    )

Detect the configuration between two 2D colinear segments

Returns:

the position of the intersection on the two segments. Returns parallel-pallel if there is segment overlap

Position geode_common_geometry_api segment_line_intersection_detection(
    const Segment2D& segment,
    const InfiniteLine2D& line
    )

Detect if there is an intersection between a line and a segment

Returns:

the position of the intersection on the segment. Returns outside if there is no intersection or all points are colinear

Position geode_common_geometry_api line_triangle_intersection_detection(
    const InfiniteLine3D& line,
    const Triangle3D& triangle
    )

Detect if there is an intersection between a line and a triangle

Returns:

the position of the intersection on the triangle. Returns outside if there is no intersection or the line is coplanar with the triangle

SegmentTriangleIntersection geode_common_geometry_api segment_triangle_intersection_detection(
    const Segment3D& segment,
    const Triangle3D& triangle
    )

Detect if there is an intersection between a segment and a triangle

Returns:

the position of the intersection on the segment and on the triangle. Returns outside if there is no intersection or the segment is coplanar with the triangle

Position geode_common_geometry_api segment_plane_intersection_detection(
    const Segment3D& segment,
    const Plane& plane
    )

Detect if there is an intersection between a segment and a plane

Returns:

the position of the intersection on the segment. Returns outside if there is no intersection or the segment is coplanar with the plane

Side geode_common_geometry_api point_side_to_segment(
    const Point2D& point,
    const Segment2D& segment
    )

Return the point side to a segment.

Side geode_common_geometry_api point_side_to_line(
    const Point2D& point,
    const InfiniteLine2D& line
    )

Return the point side to a line.

Side geode_common_geometry_api point_side_to_plane(
    const Point3D& point,
    const Plane& plane
    )

Return the point side to a plane.

Side geode_common_geometry_api point_side_to_triangle(
    const Point3D& point,
    const Triangle3D& triangle
    )

Return the point side to a 3D triangle.

template <index_t dimension>
Position point_segment_position(
    const Point<dimension>& point,
    const Segment<dimension>& segment
    )

Return the position of a point on a segment: inside, outside or on segment vertex.

template <index_t dimension>
Position point_triangle_position(
    const Point<dimension>& point,
    const Triangle<dimension>& triangle
    )

Return the position of a point in a triangle: inside, outside, on a triangle vertex or an edge.

Position geode_common_geometry_api point_tetra_position(
    const Point3D& point,
    const Tetra& tetra
    )

Return the position of a point in a tetrahedron: inside, outside, on a tetra vertex, an edge or a facet.

Sign geode_common_geometry_api tetrahedron_volume_sign(const Tetra& tetra)

Return the sign of a tetrahedron volume.

Sign geode_common_geometry_api triangle_area_sign(const Triangle2D& triangle)

Return the sign of a 2D triangle area.

Sign geode_common_geometry_api triangle_area_sign(
    const Triangle3D& triangle,
    local_index_t axis
    )

Return the sign of a 3D triangle area aligned on X- Y- or Z-axis.