On 27/06/2014 at 12:35, xxxxxxxx wrote:
Cinema 4D Version: 13
Platform: Windows ;
Language(s) : C++ ;
Does anyone know the code for the Grow Selection command?
I often want to grow selections in only one direction. But the one in C4D grows in all directions. And that's very annoying.
On 27/06/2014 at 14:52, xxxxxxxx wrote:
Just had a look and the Neighbor class says:
To get poly- >edge connections use [GetPolyInfo()](file:///C:/Users/Tangerine/Desktop/C++%20Docs/help/pages/c4d_baseobject/class_Neighbor1083.html#getpolyinfo7), which additionally allows you to retrieve neighbor polygons directly
Prob possible to then deselect the newly selected polygons which either aren`t positioned in a specific direction in local coordinates or use the edges of original selection and determine which edges are mostly in the desired direction/position-offset in local space and only select the polys which share that edge..
On 27/06/2014 at 15:29, xxxxxxxx wrote:
I probably should have specified that I'm trying to grow selected points in one direction.
I know how to use the Neighbor class. But that's mainly for getting the neighboring polygons of selected points/or edges. And I don't know how I would get the next point in a specific direction using the neighboring polygons.
On 27/06/2014 at 15:34, xxxxxxxx wrote:
What do you mean by direction in this case? A more specific explanation would help us answer your question.
On 27/06/2014 at 15:43, xxxxxxxx wrote:
I would use polygons and the Neighbor class ie find out which polies the selected point/points belong to ( GetPointPolys ), then look at each of these polygons individually, and for each one find out the normal orientation, and using that as a reference for direction find out which points from the polygon lie in a specific direction and which dont..
Unless you`re talking about rings or loops of course - there might be easier ways
On 27/06/2014 at 15:47, xxxxxxxx wrote:
Divide space by a plane perpendicular to the direction in which you want to select (the plane normal is the vector pointing in the direction you want to grow) and use neighbor to find the points on the 'good' side of the plane. There is math available for point and plane distance and side of plane/triangle.
On 27/06/2014 at 17:11, xxxxxxxx wrote:
Trying to picture it in my head guys. But having troubles.
I'll try to give a better example for clarity:
-Create a Capsule
-Make it editable
-In points mode. Select one or more of the lower points
What I would like to happen is every time I execute the code. The point directly above the selected
points is selected.
I guess you could think of it as a clamped loop selection.
Sort of like the runway lights on a landing strip at the airport.
The problem I'm having is how do I intelligently find the next point to select from all of the points in the neighboring polygons?
Because instead of selecting the next point above the selected point. I might want to select the point to the right or left. Or the maybe even the point below the selected points.
On 28/06/2014 at 06:05, xxxxxxxx wrote:
Where can I send you some zipped up code (PM me)? My Unfurl plugin deals with this using polygons instead of points, but the same idea basically. Maybe that might help you get started.
On 28/06/2014 at 07:36, xxxxxxxx wrote:
My e-mail is:[email protected]
On 29/06/2014 at 10:00, xxxxxxxx wrote:
After examining my Unfurl code, probably not useful as it uses Neighbor but follows certain criteria for unfolding neighboring polygons. Directions are predetermined by gradients not vectors. Would not be helpful in your case.
I think that you are going to need to start with the simplest case scenario: one selected point and a direction vector for determining the next point or points to 'grow' into the selection. That could involve finding the polygon that matches the vector best and getting the nearest point to the line created by the selected point and the end of the direction vector (normalized would work here). You are almost going to need to do ray-triangle collision or find some interesting method to match 'direction' with a point's relationship to its containing polygons.
On 29/06/2014 at 11:22, xxxxxxxx wrote:
OK. Thanks anyway Robert.
It's not so much the code. But what are the proper questions I need to ask and answer to pull this off.
Computers are so freakin' dumb.
Sometimes the simplest things like: select the point to your left, right, top, or bottom. Can be the hardest ones to do.
I'll keep looking for a solution.
On 29/06/2014 at 18:10, xxxxxxxx wrote:
Yes, computers are stupid. It is the human telling the computer what to do that makes them appear magical (or intelligent). You need to, as Denzel said in 'Philadelphia', talk to it like it's a two year old. Break down the problem into its most infinitesimal parts and work out each one in turn to form a system that systematically solves the problem.
In this case, you have to apply some mathematical and logical approaches. What information do you have (constants and known data) and what variables are there and how do you use them to solve your problem. You know the point (for simplicity) from which to start. Then you should have some vector or rotational vector/matrix to describe the direction. Now you have to determine what other information can be pooled or calculated to make the solution reasonable. For instance, I would surmise that, no matter which direction the vector points, the next level of selection would be in the scope of the point's nearest point neighbor. So, you must determine how to remove the n number of points directly surrounding the point in question to satisfy the direction condition best. For this simplistic example, it could be as easy as elimination first by half-plane, then by quadrant, then by some angular tolerance of the vector (+/-22.5 degrees) until you find the best candidate. Or it could come done to a simple distance of the next point to the selected one by minima. My thinking seems to be that there are multiple solutions and you either have to allow for differents ones or chose among them for the one that satisfies your expectations the best.