[Bf-committers] finding co-planer faces.
Campbell Barton
bf-committers@blender.org
Sun, 25 Jul 2004 00:35:39 +1000
I might be wrong here but these formulas dont detect weather faces are
on the same plane- IE Same faces could be offset but still facing the
same way.
The method your talking about I have done- is my normal the same as your
normal (within a given limit)
I was looking for a way of findinf objects that have the same normal and
are level with each other. kinda tricky to explain. hope you get it.
A solution would be to say.
=is my normal the same as yours.
=If so then rotate my centre point by the objects normal (where Im
currently stuck! how can I turn a normal into a rotation matrix???)
=having rotated the centre point of the face in question, is its X (or
any other axis depending onm the rotation) the same as mine (what I mean
by being on the same level.)
= if so themn its 'co-planer' and select it.
- Cam
Alexander Ewering wrote:
>
> On Sat, 24 Jul 2004, Campbell Barton wrote:
>
>> Alex, how did you detect co planer faces?
>> Id liek to know the formula.
>
>
> Uhm, the formula is
>
> if (VecCompare(evl->n, evl2->n, 0.01)) {
>
> :)
>
> Basically, I just do that for every adjacent face until
> I don't find any face anymore that fulfills the
> if statement.
>
> The code is here, for your enjoyment:
>
> void select_coplanar_mesh(void)
> {
> EditVlak *evl, *evl2;
> int count= 1;
>
> while (count) {
> evl= G.edvl.first;
> count= 0;
> while(evl) {
> if(vlakselectedAND(evl, 1)) {
> evl2= G.edvl.first;
> while(evl2) {
> if (ELEM4(evl2->v1, evl->v1, evl->v2, evl->v3,
> evl->v4) ||
> ELEM4(evl2->v2, evl->v1, evl->v2, evl->v3,
> evl->v4) ||
> ELEM4(evl2->v3, evl->v1, evl->v2, evl->v3,
> evl->v4) ||
> ELEM4(evl2->v4, evl->v1, evl->v2, evl->v3,
> evl->v4))
> if (VecCompare(evl->n, evl2->n, 0.01)) {
> if (!vlakselectedAND(evl2, 1)) {
> count++;
> evl2->v1->f |= 1;
> evl2->v2->f |= 1;
> evl2->v3->f |= 1;
> evl2->v4->f |= 1;
> }
> }
> evl2= evl2->next;
> }
> }
> evl= evl->next;
> }
> }
> }
>
>
> | alexander ewering instinctive mediaworks
> | ae[@]instinctive[.]de http://www[.]instinctive[.]de
> _______________________________________________
> Bf-committers mailing list
> Bf-committers@blender.org
> http://www.blender.org/mailman/listinfo/bf-committers
>
>
--
Campbell J Barton
133 Hope Street
Geelong West, Victoria 3218 Australia
URL: http://www.metavr.com
e-mail: cbarton@metavr.com
phone: AU (03) 5229 0241