|
|
"IGM" <iar### [at] gmailcom> wrote:
> This is my poor-man solution:
>
> // root(s) of function F = Y(X)-thr
>...
If your function is strictly monotone you can just define another linear spline
with the values switched at each index, like this:
#version 3.7;
#declare NoOfPoints = 10;
#declare X =
array [NoOfPoints] {
0,
10,
20,
30,
40,
50,
60,
70,
80,
90
}
;
#declare Y =
array [NoOfPoints] {
0.0,
21.0,
44.0,
69.0,
97.0,
124.0,
158.0,
181.0,
206.0,
232.0
}
;
#declare Spline =
spline {
linear_spline
#for (I, 0, NoOfPoints-1)
X[I], Y[I]*y
#end // for
}
#declare ReverseSpline =
spline {
linear_spline
#for (I, 0, NoOfPoints-1)
Y[I], X[I]*x
#end // for
}
#declare Thr = 35;
#declare Root = ReverseSpline(Thr).x;
#debug "\n\n"
#debug concat("Root: ", str(Root, 0, -1))
#debug "\n\n"
#error "To stop text output and prevent render window"
--
Tor Olav
http://subcube.com
https://github.com/t-o-k
Post a reply to this message
|
|