Lagrange
Loading...
Searching...
No Matches
GeodesicEngineFlip.h
1/*
2 * Copyright 2026 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#ifndef LAGRANGE_GEODESIC_WITH_GEOMETRYCENTRAL
15 #error "GeodesicEngineFlip requires the lagrange::geodesic::geometrycentral component"
16#endif
17
18#include <lagrange/geodesic/GeodesicEngine.h>
19
20namespace lagrange::geodesic {
21
35template <typename Scalar, typename Index>
36class GeodesicEngineFlip : public GeodesicEngine<Scalar, Index>
37{
38public:
40 using Mesh = typename Super::Mesh;
41
43 struct Options
44 {
47 size_t max_iterations = 0;
48
52 };
53
54public:
61 explicit GeodesicEngineFlip(Mesh& mesh, const Options& options = {});
62
63 virtual ~GeodesicEngineFlip();
67 GeodesicEngineFlip& operator=(const GeodesicEngineFlip&) = delete;
68
76 const SingleSourceGeodesicOptions& options) override;
77
89
106 const PointToPointGeodesicPathOptions& options) override;
107
108protected:
109 struct Impl;
111};
112
124template <typename Scalar, typename Index>
125GeodesicEngineFlip<Scalar, Index> make_flip_engine(
127 const typename GeodesicEngineFlip<Scalar, Index>::Options& options = {})
128{
129 return GeodesicEngineFlip<Scalar, Index>(mesh, options);
130}
131
132} // namespace lagrange::geodesic
A general purpose polygonal mesh class.
Definition SurfaceMesh.h:73
Computes surface geodesics using the edge-flip method.
Definition GeodesicEngineFlip.h:37
GeodesicEngineFlip(Mesh &mesh, const Options &options={})
Precompute any data required for repeated geodesic path computation.
Definition GeodesicEngineFlip.cpp:45
typename Super::Mesh Mesh
The mesh type.
Definition GeodesicEngineFlip.h:40
Scalar point_to_point_geodesic(const PointToPointGeodesicOptions &options) override
Compute the geodesic distance between two points using the edge-flip method.
Definition GeodesicEngineFlip.cpp:90
SingleSourceGeodesicResult single_source_geodesic(const SingleSourceGeodesicOptions &options) override
Definition GeodesicEngineFlip.cpp:67
GeodesicPathResult< Scalar, Index > point_to_point_geodesic_path(const PointToPointGeodesicPathOptions &options) override
Compute the geodesic path between two points using the edge-flip method.
Definition GeodesicEngineFlip.cpp:119
GeodesicEngine< Scalar, Index > Super
Parent class type.
Definition GeodesicEngineFlip.h:39
GeodesicEngine(Mesh &mesh)
Base class constructor.
Definition GeodesicEngine.cpp:21
SurfaceMesh< Scalar, Index > Mesh
The mesh type.
Definition GeodesicEngine.h:150
Smart pointer with value semantics.
Definition value_ptr.h:133
@ Scalar
Mesh attribute must have exactly 1 channel.
Definition AttributeFwd.h:56
Options for the flip geodesic engine.
Definition GeodesicEngineFlip.h:44
double max_relative_length_decrease
Fraction of the initial path length below which shortening stops.
Definition GeodesicEngineFlip.h:51
size_t max_iterations
Maximum number of iterations for the iterative shortening procedure.
Definition GeodesicEngineFlip.h:47
Result of a point-to-point geodesic path computation.
Definition GeodesicEngine.h:128
General options for point-to-point geodesic computations.
Definition GeodesicEngine.h:79
Options for point-to-point geodesic path computation.
Definition GeodesicEngine.h:101
General options for one-to-many geodesic computations.
Definition GeodesicEngine.h:27
Result of a single source geodesic computation.
Definition GeodesicEngine.h:67