Post

Replies

Boosts

Views

Activity

Different implementations for the same function
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 🙏🏻
4
0
450
Oct ’22
Solve a set of equations
In my app I need to solve a set of 3 equations. But I really struggle, because these 3 equations contain 4 unknown. So the result would be some function of a fith variable. Very simple Example: u = cos(s) v = sin(s) 1 = t I really don‘t know a method how to solve it. I think it can‘t be solved numerically ,because the result is a function. I thought about to convert the this functions into Fourier series and solve than the set of equations. But I am not sure if this works either. Does anyone know any framework for this. I have looked on the the internet but found nothing.
7
0
1.4k
Apr ’22