[Bf-python] points in a curve

Stephen Swaney sswaney at swbell.net
Mon Sep 8 04:06:32 CEST 2003


Gentlemen:

Lately, I've been fussing the Curve interface. Since we have a
getControlPoint( curve_num, point_num ) method, it would be nice to have
methods to get the number of curves in the Curve and the number of
points in each curve.

note: since the phrase "number of curves in a Curve" is rather awkward,
I'm going to refer to the individual curves that make up a Curve as
splines. Each spline is either a nurb or bezier curve. So a Curve has 0
to N splines, ok? If you have a better name for this, please speak up.

So our first problem is getting the number of splines and a point count
for each spline. I can think of a couple of ways of doing this.

1) Someone who has brain damage from prolonged exposure to FORTRAN at a
young age might code an int curve.getNumSplines() to return the total
number of splines in the Curve. To go along with this, we need
int curve.getNumPoints( spline_num ) to return the number of points in a
given spline.

2) A more pythonic way would be to return a list. Each element of the
list is the number of points for a spline. This has a rather geeky
elegance to it in that the length of the list is the number of splines
total and the number of points in spline 0 is list[0].

I don't really see much difference between the two approaches. Both are
equally easy to code and similar in terms of performance. Being a geek,
I would tend toward the elegant geeky approach. However...

In my opinion, there are two groups of target users for the python
interface. The first is obviously programmers, people who are completely
at ease with concepts like loops and lists. The second groups is artists
who have just enough programming background to use a scripting language
to extend their abilities. Artists tend to think differently than
programmers. I don't know which style makes more sense to them.

There's no reason we can't have both interfaces, I suppose. Except
perhaps for the confusion of two completely different ways of getting at
the same information.

What do *you* think?
-- 
Stephen Swaney			
sswaney at swbell.net



More information about the Bf-python mailing list