Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: [cgal-discuss] Re: Random_points_on_sphere_3
- Date: Thu, 07 Oct 2010 09:30:21 +0200
Be careful to send your messages to the list and not to only one person,
questions you have may be useful to others.
wrote:
It is working after inserting following two lines.
CGAL::Random default_random;
CGAL::Random rnd = default_random;
But why 'Random_points_on_sphere_3' always returns the points inside a sphere
not onside ??
I guess the points are not on the sphere because you are using a
floating point number type (see http://www.cgal.org/FAQ.html#inexact_NT)
Unfortunately, if you need to have points that are exactly on a sphere
you need to use a number type able to handle square roots exactly.
You may try CORE::Expr that directly handle square root exactly or
have a look at Sqrt_extension (which represents algebraic number of
degree 2).
http://www.cgal.org/Manual/beta/doc_html/cgal_manual/NumberTypeSupport_ref/Class_Sqrt_extension.html
Note that I think CORE::Expr should work directly with the random point
generator, while for Sqrt_extension it may require some modifications in
the generator.
S.
<quote author='Sebastien Loriot (GeometryFactory)'>
It is hard to answer to a question without seeing a line of your code.
Anyway, this is working on my machine with CGAL 3.7 beta1
#include <CGAL/Simple_cartesian.h>
#include <CGAL/point_generators_3.h>
#include <CGAL/random_selection.h>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point_3;
typedef CGAL::Creator_uniform_3<double,Point_3> Creator;
int main()
{
CGAL::Random_points_on_sphere_3<Point_3,Creator> g( 100.0);
return 0;
}
sbdk11 wrote:
Why I am getting following errors for the line
CGAL::Random_points_on_sphere_3<Point_3,Creator> g(20,Random&
rnd=default_random);
/cpp/test1/test3.cpp: In function ‘int main()’:
/cpp/test1/test3.cpp:75: error: ‘Random’ was not declared in this scope
/cpp/test1/test3.cpp:75: error: ‘rnd’ was not declared in this scope
/cpp/test1/test3.cpp:75: error: ‘default_random’ was not declared in this
scope
- [cgal-discuss] Re: Random_points_on_sphere_3, Sebastien Loriot (GeometryFactory), 10/07/2010
Archive powered by MHonArc 2.6.16.