[Bf-python] Geometry Data
McCracken, Andrew
ajm87 at waikato.ac.nz
Tue Aug 1 01:00:14 CEST 2006
This sounds like a good idea.
There are many c/++ libraries out there for geometry, none of which I am familiar with.
www.cgal.org looks pretty awesome. Maybe too huge tho.
Would it be a better idea to choose a particular library to wrap, and distribute it as a recommended extension to the blender python api?
-----Original Message-----
From: bf-python-bounces at projects.blender.org on behalf of Gilbert, Joseph T.
Sent: Tue 8/1/2006 2:18 AM
To: cbarton at metavr.com; Blender Foundation Python list
Subject: RE: [Bf-python] Geometry Data
This should be divided into more logical groupings.
Geometry should be split into Line, polygon, etc. with associated
methods.
A Polygon object would be more appropriate I think then a VectorArray in
the Geometry module. Also a Line object, etc. for testing intersections.
Calculating bounds is only useful on something with a volume....
-----Original Message-----
From: bf-python-bounces at projects.blender.org
[mailto:bf-python-bounces at projects.blender.org] On Behalf Of Campbell
Barton
Sent: Sunday, July 30, 2006 9:47 PM
To: Blender Foundation Python list
Subject: [Bf-python] Geometry Data
Hi Guys,
Iv been thinking about having more abstract geometry data types.
I posted this before but here are some more details,
First, Id like to impliment a vector array type - basicly an iterator
that provides wrapped vector access to a C array. it would have the same
malloc problems ans Mesh but youd just need to define the size to begin
with.
once you had this data you could operate on it as a blob, apart from
being faster it would be easier to read and reuire a lot less looping in
python.
va= Geometry.VectorArray(200, 3) # 3d vec init as (0,0,0) 200 items
or it could be initialized from a a list of vectors
va=Geometry.VectorArray(me.verts)
now you could transform it just like a mesh
va.transform(matrix)
or get the bounds (annoying to do in Python)
bounds=va.bounds() # possibly have a function to intersect bounds also
Other functions could be
.removeDoubles() # remove points
.convexHull() # return indicies
.nearest(someVec) # finds the closest point to a vector
if Vector in VectorArray # would search for the point in the array.
It could also be used to define a poly line 2d or 3d
va_poly2d.area() #area of the poly
va_poly2d.PolyPoint(pt) #is the point inside the 2d poly
va_poly2d.PolySelfIntersec(pt) # does the poly intersect its self
va_poly2d.PolyIntersectPoly(poly2d)
and of course the existing poly fill ;)
I think this could also save memory too- how much memory does a BPy
vector take up by its self?
Theeth, respect your opinion (that this isnt a bottlenack) but Id like
to prove myself wrong before assuming these functions would not be much
faster in C /python
also depends on the scripts you write I suppose.
I could make some tests and use a Mesh as an example of a python array
(pretend of course) - then compare with a list of vectors.
Maybe we should look an numarray first?
Pygame had some examples of pixel operations in in numarray - Realtime
image distortion, that you could no way do in Python, so I think there
may be a use for this.
--
Campbell J Barton
133 Hope Street
Geelong West, Victoria 3218 Australia
URL: http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241
_______________________________________________
Bf-python mailing list
Bf-python at projects.blender.org
http://projects.blender.org/mailman/listinfo/bf-python
_______________________________________________
Bf-python mailing list
Bf-python at projects.blender.org
http://projects.blender.org/mailman/listinfo/bf-python
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 4506 bytes
Desc: not available
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20060801/434156a2/attachment.bin>
More information about the Bf-python
mailing list