Monday, July 7, 2008

Lots O' Fixes

Over the long weekend I started to take a look at some of the issues I have noticed creeping up.  First and foremost are the problems we were having properly recognizing complex sketch profile hierarchies.  This turns out to be almost completely a problem with two things:

  1. Crappy programming on my part.  Last week I put in place some code to make sure that the parametric values returned for all intersections are within [0,1].  This is accomplished wiht a simple bit of code -- STDMIN(1.0, STDMAX(0.0, value)).  Easy right, but I was stupid and put this code in before I finished checking for intersection.  Well if you do that then everything looks like an intersection!  D'oh.  Ok, easy fix once I figured it out.
  2. Still many issues on the GPU approach to intersection.  When I run an intersection through the GPU the result is a long output list of points.  -1 indicates no intersection at that point, anything else is a hit.  Because of tolerances an intersection is almost always indicated with a series of hits.  Just a few hits is probably a point, lots of hits is probably an overlap of some type.  Well, what is the cutoff between the two?  I don't yet have a great answer for this, but an slowly working towards a decent solution that will should scale well.
So at this point things are working better.  Topology models are being partially built for Pads, and GPU-based trimmed surface generation and intersection are mostly working.  Not too bad.  But still a long ways to go.

Just to let you know, I am going to be really busy with work (real work, not Wildcat work) this week so check-ins and blog postings might suffer a bit.  Hopefully I can still sneak some time here and there.

Cheers,
   Graham

3 comments:

Leav said...

I don't know how CAD code generally works, but wouldn't you want to first try and solve the problem mathematically instead of using a pixalized version of the 3d space objects live in?

is this wayyy to hard?

anyway keep up the good work you got at least one user waiting in line :)

GrahamH said...

Good point about a pixelated world. Within Wildcat all curves and surfaces are represented as 64-bit NURBS objects. These are not discretized in any way and are very very accurate. But, currently there exist no good explicit intersection algorithms (i.e. algorithms that use the native mathematical form of NURBS).

So the next best alternative is to discretize the objects (curves or surfaces) so that the error of the discretization is below some value. And then use the fastest possible algorithm to intersect these points. It turns out that this approach is way easier.

Now you do have the question to how fine of a discretization of the curve or surface do you make. Just to be on the safe side I am currently using a tolerance of 0.005mm. I figure that this should be sufficient for most applications. If someone needs even greater accuracy this value can be adjusted.

Thanks for the great question.
Cheers,
Graham

Lampbus said...

I have been searching for open source mechanical 3D CAD as a solution to the RepRap CAD debate.
It is early days for you & RepRap (www.reprap.org) but I think you could have an active enthusiastic community of users forming :)