Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Wrong unit normal with CGAL::unit_normal

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Wrong unit normal with CGAL::unit_normal


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Wrong unit normal with CGAL::unit_normal
  • Date: Tue, 13 Sep 2016 10:34:15 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:FHWxbB/it8FVt/9uRHKM819IXTAuvvDOBiVQ1KB92+gcTK2v8tzYMVDF4r011RmSDNydtKoP07Ge8/i5HzdRudDZ6DFKWacPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3BPAZ4bt74BpTVx5zukbvjotuMO04Q33L9Oeo0d0Tu612J94E/ushLEu4J0BzHo39FKax95FhDAhatpSv6/dq655V58i5d6LoL/s9EVrjmLexjFeQLRGduD2dg78LisVzPTBCE+2AHemQQiBtBRQbfvz/gWZKk+BD3vONmxCiXO4XSSqo1Xijqr4hmTxrllD0WGTcy7GbNm406xPZApBW7phtjhYvQSI6QPft6OKjaeIVJFiJ6Qs9NWnkZUcuHZIwVAr9ZMA==
  • Organization: GeometryFactory

I think everything is fine.
I even did the computation with intervals to get bounds on the error and it is not that bad

[0.52614566421975906;0.52614566421975928] [0.85039325614585848;0.85039325614585892] [0.0014317557027606011;0.0014317557027606021]


Using this code:

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <iostream>
#include <vector>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Simple_cartesian<CGAL::Interval_nt<> > EK;

int main()
{
CGAL::Cartesian_converter<K,EK> to_exact;

K::Point_3 p1(-119.452959304302,54.727712609640498,888);
K::Point_3 p2(-119.27352872835201,54.731184848162897,820);
K::Point_3 p3(-119.369047730614,55.029360094556502,678);



EK::Vector_3 vi = CGAL::cross_product(to_exact(p2-p1), to_exact(p3-p1) );
K::Vector_3 v = CGAL::unit_normal(p1, p2, p3);

std::cout << v << "\n";
std::cout << std::setprecision(17) << vi/CGAL::sqrt(vi*vi) << "\n";

std::cout << v * v << std::endl;
}

Sebastien.



On 09/12/2016 06:56 PM, chrism wrote:
Agreed, that produces 1. However, the plane that unit normal corresponds to
is an almost vertical plane. There is only 200m of elevation change between
the min and max points, and it is not vertical.

https://www.wolframalpha.com/input/?i=plane+through+(-119.452959304302,54.727712609640498,888)+and+normal+%5B0.52614566421975917,0.8503932561458587,0.0014317557027606017%5D

This is what I don't understand.



--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Wrong-unit-normal-with-CGAL-unit-normal-tp4662261p4662270.html
Sent from the cgal-discuss mailing list archive at Nabble.com.





Archive powered by MHonArc 2.6.18.

Top of Page