Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    TraceGeometry SDK requires clarification

    Scheduled Pinned Locked Moved SDK Help
    1 Posts 0 Posters 128 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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 you

      TraceGeometry( 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 air

      id = 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;);

      1 Reply Last reply Reply Quote 0
      • First post
        Last post