@@ -54,24 +54,26 @@ abstract type CLibraryPlanarAlgorithm <: GeometryOpsCore.SingleManifoldAlgorithm
54
54
55
55
function (:: Type{T} )(; params... ) where {T <: CLibraryPlanarAlgorithm }
56
56
nt = NamedTuple (params)
57
- return T (Planar (), nt)
57
+ return T (nt)
58
58
end
59
59
(T:: Type{<: CLibraryPlanarAlgorithm} )(:: Planar , params:: NamedTuple ) = T (params)
60
60
61
61
manifold (alg:: CLibraryPlanarAlgorithm ) = Planar ()
62
62
best_manifold (alg:: CLibraryPlanarAlgorithm , input) = Planar ()
63
63
64
+ # Rebuild methods with manifolds are here.
64
65
function rebuild (alg:: T , m:: Planar ) where {T <: CLibraryPlanarAlgorithm }
65
- return T (m, alg. params)
66
+ return T (alg. params) # TODO : should this not rebuild at all, then, since nothing will change?
66
67
end
67
-
68
68
function rebuild (alg:: T , m:: AutoManifold ) where {T <: CLibraryPlanarAlgorithm }
69
- return T (Planar (), alg. params)
69
+ return T (alg. params) # "rebuild" as a planar algorithm.
70
70
end
71
-
72
71
function rebuild (alg:: T , m:: M ) where {T <: CLibraryPlanarAlgorithm , M <: Manifold }
73
72
throw (GeometryOpsCore. WrongManifoldException {M, Planar, T} (" The algorithm `$(typeof (alg)) ` is only compatible with planar manifolds." ))
74
73
end
74
+ # Rebuild methods for parameters are here. This ends up being quite useful really.
75
+ rebuild (alg:: T , params:: NamedTuple ) where {T <: CLibraryPlanarAlgorithm } = T (params)
76
+ rebuild (alg:: T ; params... ) where {T <: CLibraryPlanarAlgorithm } = T (NamedTuple (params))
75
77
76
78
# These are definitions for convenience, so we don't have to type out
77
79
# `alg.params` every time.
@@ -163,7 +165,6 @@ struct PROJ{M <: Manifold} <: Algorithm{M}
163
165
params:: NamedTuple
164
166
end
165
167
166
- PROJ () = PROJ (Planar (), NamedTuple ())
167
168
PROJ (; params... ) = PROJ (Planar (), NamedTuple (params))
168
169
PROJ (m:: Manifold ) = PROJ (m, NamedTuple ())
169
170
0 commit comments