Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Where is the function that normalizes a Vector_3?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Where is the function that normalizes a Vector_3?


Chronological Thread 
  • From: "Laurent Rineau (CGAL/GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Where is the function that normalizes a Vector_3?
  • Date: Thu, 07 Sep 2017 10:20:31 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:xNt4JBHydoLmgPFlTalvYp1GYnF86YWxBRYc798ds5kLTJ76rsywAkXT6L1XgUPTWs2DsrQf1LqQ7viocFdDyKjCmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TXhpQIVTx7wPA4wKuXuEZPJlOy20fqz8tvdeVZmnj24NPlWJQisoAPN/vMXh4ZrN+5x4TTghjxnduNTyH9yNHyalAr7/NbxttY39y1Nof8n64haUKP3drkQRrNRCHIhKW9jt56jjgXKUQbavihUaW4RiBcdWwU=
  • Organization: GeometryFactory

Le Wednesday, September 6, 2017 2:32:13 PM CEST Sebastien Loriot
(GeometryFactory) a écrit :
> On 09/05/2017 06:10 PM, Iasonm wrote:
> > I want to normalize a Vector_3 and I cant the function that does the job.
> >
> >
> >
> > --
> > Sent from: http://cgal-discuss.949826.n4.nabble.com/
>
> There is none (the main reason being that it is not an exact operation).
> You can use the squared_length() member function as below (provided you
> have a kernel with sqrt supported):
>
> v=v/std::sqrt(v.squared_length());

When the number type of the kernel is not `double`, use `CGAL::sqrt` instead
of `std::sqrt`. `CGAL::sqrt` works for example on
`Exact_predicates_esact_construction_with_sqrt_kernel::FT`, but not
`std::sqrt`.

--
Laurent Rineau, PhD
R&D Engineer at GeometryFactory http://www.geometryfactory.com/
Release Manager of the CGAL Project http://www.cgal.org/




Archive powered by MHonArc 2.6.18.

Top of Page