I want to intersect two Surfaces of the Protocol surfaces. Some Objects like a plane implement this protocol. Normally I want to call a general function, but to solve the intersection faster between to Planes I want to call a different function. I could make a master func wich Type checks and then calls the right functions. But I am sure there is a better way, where the complete does this for me. I would be much more readable.
func intersect(a: Surface, b: Surface) -> Curve3D {
// general implementation
}
func intersect(a: Plane, b: Plane) -> Curve3D {
// special implementation
}
I tried this, but does not work. When I mark the varsity as Surface but they are still plane Strukts and then intersect them the general implement is chosen.
I hope everything is clear. Thanks for the Help 🙏🏻