How does C4D calculate pos of selected objects?
-
On 17/06/2015 at 11:15, xxxxxxxx wrote:
Should simply be the centroid of all of their positions. Loop through all of the selected lights, get their positions (you may need to consider global vs. local - global is recommended), sum the position vectors (sum += pos), and after the loop divide the vector (sum) by the number of lights.
PseudoCode:
Vector sum = Vector(0.0); Int32 nlights = number of selected lights; for (All selected lights) { sum += light->GetMg().off; } // This will be the centroid between the light positions sum = sum / nlights;
-
On 17/06/2015 at 12:34, xxxxxxxx wrote:
Hi Robert!
Well, I think C4D does it another way.
With 2 objects it works fine, but as soon as there are more, it tends to give problems.Still thanks for your answer!
With kind regards,
Casimir Smets -
On 17/06/2015 at 12:43, xxxxxxxx wrote:
Let me run some tests on my end and get back with results and code.
-
On 17/06/2015 at 12:56, xxxxxxxx wrote:
AFAIK it's the bounding box of the selected objects' axes.
MinMax mm; for (All selected lights) { mm.AddPoint(light->GetMg().off); } Vector min = mm.GetMin(); Vector max = mm.GetMax();
-
On 17/06/2015 at 14:53, xxxxxxxx wrote:
Hi Niklas!
Thanks for your answer!!
That did it, apparentally that's the way C4D handles multi-selection of objects.
(You can mark this as solved)
With kind regards,
Casimir Smets -
On 18/06/2015 at 06:22, xxxxxxxx wrote:
Hello,
to get the axis of a multi-selection one can use BaseDocument::GetHelperAxis().
Best wishes,
Sebastian -
On 18/06/2015 at 06:32, xxxxxxxx wrote:
Hi Sebastian,
Thanks for your answer!!
GetHelperAxis is faster than the solution Niklas gave me.You can mark this as solved!
With kind regards,
Casimir Smets -
On 18/06/2015 at 11:01, xxxxxxxx wrote:
Hi,
Is there also such a function as GetHelperAxis for point/edge/polygon selection?
And what about pointselections from multiple objects? Or should I do this manually if I want to support that? (Because C4D doesn't seem to calculate that position...)Thanks in advance for your help and time!
Greetings,
Casimir Smets -
-
On 19/06/2015 at 06:18, xxxxxxxx wrote:
Hi Sebastian,
Thanks for your answer!!
That indeed also works for multi-object pointselections.You can mark this as solved!
With kind regards,
Casimir Smets