这是个好东西 是来自TDM这个大佬的代码
out p;
float tm=0.0;float tx=1000.0;
float hx=map(o+d*tx);
if(hx>0.0)return;
float hm=map(o+d*tm);
for(int i=0;i<STEP;i++)
{
float tmid=mix(tm,tx,hm/(hm-hx));
p=o+d*tmid;
float hmid=map(p);
if(hmid<0.0)
{
tx=tmid;hx=hmid;
}
else
{
tm=tmid;hm=hmid;
}
}