TraceGeometry SDK requires clarification
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/01/2008 at 02:50, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10.1.1
Platform: Mac OSX ;
Language(s) : C.O.F.F.E.E ;---------
Can someone with experience please post a functional example of TraceGeometry? The SDK version conflicts with itself as many archived postings have mentioned, yet none of the threads resolves the issue for public viewing. Where does lhit belong, in position 2 or 4, and more importantly, I see and have experienced that TraceGeometry in the example provided does not refer to anything. I presume it needs some geometry from which to derive a polygon that will fill "id", e.g.,
id=PolygonObject1->TraceGeometry(ray,lhit,&p;,&n;) Also, I see that in a previous posting, the author had 5 parameters filled in his TraceGeometry call. What is the limit, and if its more than 4, what are they? What is 'vd' in his example?
Thank youTraceGeometry( ray, lhit, &p;, &n; )
[int] TraceGeometry([Ray] ray, [int] lhit, [vector] &p;, [vector] &n;);
calculates an intersection for ray 'ray'. The face ID is returned or 0 if there is no intersection. 'lhit' is the last intersection (to avoid self-intersections). If you're not starting off a surface, you can pass 0. Please note that 'p' and 'n' are called by reference! A call would look like this:var id,p,n;
var ray = new(Ray);ray->p = vector(0.0);
ray->v = vector(1.0,0.0,0.0); // ray travels from world origin along the X axis
ray->pp0 = ray->pp1 = ray->pp2 = ray->p;
ray->vv0 = ray->vv1 = ray->vv2 = ray->v; // fill mip variables
ray->ior = 1.0; // refraction index for airid = TraceGeometry(ray,&p;,&n;,0);
if (id)
{
println("Ray intersects at point ",p," with normal ",n," and face ID ",id);
}
else
println("No intersection found");var id = vd->tracegeometry(myray, 10000, 0, &resultp;, &resultn;);