PDA

View Full Version : Manipulate points in a polygonal object


pers
02-14-2008, 02:23 PM
Hi everybody,
I just began to play with coffee.
My goal is to be able to manipulate large number of points (originally from stl files that C4D triangulates) using algorithms. I leave the really complicated things for a bit later when I will have managed to do kind of simple things.
I already found out how to access points, one by one, and change their position (for example placing them on a circle).

Now my aim is to access all points in a loop (that's ok), and for each of them find its neighbors (using neighbor classe, but I did not manage to get the points yet, a bit stuck there) and moving the point to the barycentre of its neighbors.

I'll begin with that before going for more complicated stuff.
Any help is appreciated

Per-Anders
02-14-2008, 05:56 PM
The Neighbor class is only available in the C++ API, not COFFEE. To access Neighbors in COFFEE requires a search of the polygons using the point and then selecting the next points around in each polygons, or making use of selection tools to expand and remove selections quickly either way it's more or less building your own much slower Neighbor class.

To use the neighbor class in C++ you simply create a new Neighbor variable, Initialize it with Init and then call it's functions as you require, a few of them have example code in the docs so you can see how they might be used. You will have to understand and grasp the C++ basics involved in their use.

pers
02-14-2008, 08:48 PM
Thanks per-Anders to get back to me quickly. I was kind of afraid of what you said, that only C++ would recognize the neighbor class. I have absolutely no experience with C++, but if there are many more things like that not available in coffee I might end up going a bit for C++. I will do some research to find out how things work with C++.
I'll get back in this thread when I will have progressed a bit.

One more thing, suppose I want to snap points on a different polygonal object using polygon snaping: loop through all points in a polygonal object and snap them to the closest other polygonal object (not on the same one), can I do that in coffee or again is it C++ that will be necessary?

CGTalk Moderation
02-14-2008, 08:48 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.