Subject: CGAL users discussion list
List archive
- From: Ramin H <>
- To:
- Subject: Re: [cgal-discuss] normal vector of a facet
- Date: Fri, 12 Mar 2010 12:46:44 -0500
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=dtum15Rhrr1h8TBtEvro0LcwET25nOI8rRbgvOCMwi8YeAkfhY9KWIf9n7msqD0GVV lsI0JGh1FZ7WBKQ/1ZQ4rCOyWPqDxQTYLyXNdR2j4HD8nQkIGVZIkdBG3iFzKH7GcuLF sU9W+ft8x0+/uBZAHwdgBmnz/UirIL8pADGZo=
Hi,
f.first returns a "cell handle" and f.second is the facet index in that cell. So f.first->vertex((f.second)&3) should be the vertex opposite to facet f, right?
Say p0 is the point opposite to the facet and p1, p2, p3 are on the facet, then:
- We find "v1", the vector from p0 to p1
- We find "n", the facet normal vector
- To get a coherent direction for all normal vectors, we find the inner product of "n" and "v1" vectors. Only if the inner product is negative, we change the direction of the normal vector.
I have included the pseudocode below. Does this make sense?
Regards,
-Ramin
// ---- pseudocode ----
// the point opposite to facet
const Point_3& p0 = f.first->vertex((f.second)&3)->point();
// points on the facet
const Point_3& p1 = f.first->vertex((f.second+1)&3)->point();
const Point_3& p2 = f.first->vertex((f.second+2)&3)->point();
const Point_3& p3 = f.first->vertex((f.second+3)&3)->point();
Vector_3 v1 = p1 - p0;
Vector_3 n = CGAL::normal(p1, p2, p3);
const Point_3& p3 = f.first->vertex((f.second+3)&3)->point();
Vector_3 v1 = p1 - p0;
Vector_3 n = CGAL::normal(p1, p2, p3);
if ( n * v1 < 0 ) { n = -n; }
// ---> At this point we should have the correct direction for normal vector?
On Thu, Mar 11, 2010 at 6:18 PM, Ramin H <> wrote:
Hi,
I read the manual and it mentions positive and negative permutations for cells.
I am computing the normals for facets that are on the surface of a C3T3. Is there any way to find the facet normals so that all normals have a coherent direction?
Regards,
-RaminOn Tue, Mar 9, 2010 at 2:57 AM, Monique Teillaud <> wrote:
Hi,
Be careful that the order in which vertices must be taken on the facet depends on the parity of its index f.second.
This is due to the fact that cyclic permutations of (0,1,2,3) are not all positive. As far as I can remember, I documented this in the user manual of the 3d triangulation data structure chapter.
Best regards,
Monique Teillaud--
Ramin H wrote:
Hi everyone,
I have the handle to a facet of a 3D triangulation and would like to find the normal vector of the facet. This is how I am doing it but it looks like the normal is incorrect.
// const Facet& f is passed to this function in the function argument ...
const Point_3& p1 = f.first->vertex((f.second+1)&3)->point();
const Point_3& p2 = f.first->vertex((f.second+2)&3)->point();
const Point_3& p3 = f.first->vertex((f.second+3)&3)->point();
Vector_3 v1 = CGAL::normal(p1, p2, p3);
Am I missing something?
-Ramin
Monique Teillaud
INRIA Sophia Antipolis - Méditerranée
http://www.inria.fr/sophia/members/Monique.Teillaud/
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
- [cgal-discuss] normal vector of a facet, Ramin H, 03/05/2010
- Re: [cgal-discuss] normal vector of a facet, Laurent Rineau (GeometryFactory), 03/05/2010
- Re: [cgal-discuss] normal vector of a facet, Ramin H, 03/05/2010
- Re: [cgal-discuss] normal vector of a facet, Daniel Duque, 03/06/2010
- Re: [cgal-discuss] normal vector of a facet, Laurent Rineau (GeometryFactory), 03/06/2010
- Re: [cgal-discuss] normal vector of a facet, Monique Teillaud, 03/09/2010
- Re: [cgal-discuss] normal vector of a facet, Ramin H, 03/12/2010
- Re: [cgal-discuss] normal vector of a facet, Ramin H, 03/12/2010
- Re: [cgal-discuss] normal vector of a facet, Laurent Rineau (GeometryFactory), 03/12/2010
- Re: [cgal-discuss] normal vector of a facet, Ramin H, 03/12/2010
- Re: [cgal-discuss] normal vector of a facet, Ramin H, 03/12/2010
- Re: [cgal-discuss] normal vector of a facet, Laurent Rineau (GeometryFactory), 03/05/2010
Archive powered by MHonArc 2.6.16.