Design > Engineering board

Best approach to equally spaced points on a contour

(1/3) > >>

Larry Cunningham:
I'm not talking about a CAD method, I'm referring to a mathematical approach.

Suppose I have a contour, defined by a polynomial equation, e.g. y = A*x^1/2 + B*x + C*x^2 + D*x^3 + E*x^4. What I'd like to do is sample it at x values where the distances between points on the contour are the same distance.

What's a good approach?

It's pretty easy to take the derivative of the equation to get the instantaneous slope at any point. And I can do a fine sampling and sum distances between points for approximate length of the surface.

Suggestions for the best way to approach this problem?

Thanks in advance.

L.

Q. When you pat a dog on its head he will wag his tail. What will a goose do?
A. Paul Lynde: "Make him bark?"



Alan Hahn:
This is thinking out loud.

let ds=sqrt(dy^2+dx^2)--->where ds is an infinitesimal of s, the path length.

dy = (1/2A/sqrt(x)+B+2Cx+3Dx^2+4Ex^3)dx, (just the derivative of y(x) ---I don't vouch for mistakes!)

so ds =sqrt{(1/2A/sqrt(x)+B+2Cx+3Dx^2+4Ex^3)^2 +1} dx

s=integral of ds from x=0 to end, then if you want N points total, delta_s=s/N (+- 1 point, always get that wrong).

So now numerically integrate step by step (delta_s) from s=0 to s=end.

Not sure if there is an easier way or not.

Piece of cake!

Larry Cunningham:
Wow, Alan what service! Thanks kindly.

Below are plots of the representative NACA00nn curve I was dealing with, and its slope.

The only thing I see is that the integration involves a lot of tiny steps of x, it's a bit iterative, which is what
I was trying to avoid. However, I have this very fast computer with dual Xeon quad CPUs, so it's not a real problem.

Essentially, we are moving x in tiny steps, and measuring distance to the previous point, until we have the distance we
want. I might take the last x step, and adjust it based on the distance error, so it converges to the proper value. I could
set a practical tolerance on the error. This would leave out the slope, I'd just be calculating a hypotenuse of a dx and dy
right triangle, square root of sum of squares.

What do you think? Iterative solutions may not be so pure mathematically, but why not? That's what we have computers for.

Thanks,

L.

"The learned is happy, nature to explore; The fool is happy, that he knows no more." -Alexander Pope

Alan Hahn:
Larry,
I'm kind of an iterative guy, and you are right that cpu power is cheap!

Analytically you could try to solve the integral equation for x(s) (and for y once you have x), but that looks pretty complicated to me, so that's why I think the iterative approach is faster (in "real" time), and plenty "good enough".

Larry Cunningham:
Alan,

I believe we are thinking much alike here. I once told my computer science professor that
I despised computers (from working on them) and liked to write programs to punish them as
much as possible. My term for that was making it "Compute the Moon".. ;->

Although I have the NACA00nn equation for the airfoil that I always use for my own models, it
would be nice to read in a set of coordinates for any contour (perhaps interpolate using some
reasonable spline fit) and find equidistant points on the contour. I could implement a plug-in
"contour generator" which returns points on the contour for a normalized horizontal x position;
my crude iterative convergent method could be generic.

I already have people pointing out the obvious - I'm reinventing wheels, when I could simply
use a commercial program like Compufoil or Profili or Winfoil, or even model the wing panel in
3D and cut cross section slices to create rib templates. Yes, that might be the Easy Way, but
it ain't necessarily the Cowboy Way, the way that Roy or Gene or Hoppy would do it - or even
the way Sky King would do it!

Well, I'm sure you understand, this is a way for me to play with Visual BASIC and perhaps write
the next iteration of StuntRib. I'll likely call it StuntRib - the Movie! ;->

Thanks again for your thoughts and comments.

L.

"You should hammer your iron when it is glowing hot." -Publius Syrus

Navigation

[0] Message Index

[#] Next page

Go to full version