Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] squared_distance and to_double producing NaN

Subject: CGAL users discussion list

List archive

[cgal-discuss] squared_distance and to_double producing NaN


Chronological Thread 
  • From: Martin Mörth <>
  • To:
  • Subject: [cgal-discuss] squared_distance and to_double producing NaN
  • Date: Thu, 1 Oct 2009 09:31:15 -0700 (PDT)


Hello Everybody!

I am calculating distances between points and segments. I isolated a
case where the computation seems to be returning a bad value (double
that is not a number).

] typedef CGAL::Simple_homogeneous< double > CgKernel;
]
] typedef CgKernel::FT CgFieldNumber;
] typedef CgKernel::Point_2 CgPoint;
] typedef CgKernel::Segment_2 CgSegment;
]
] std::stringstream text
] (
] "-2.0527819641170391e+142 1.5399153216416277e+142 1.2075326642268196e+139
" // p
] "-1.3832287034884996e+069 9.6657090977844965e+068 7.5794164096585707e+065
" // s.min
] "2509.7485796014098 1275.2576940874201 1.0" // s.max
] );
]
] CgPoint p;
] CgSegment s;
]
] text >> p;
] text >> s;
]
] CgFieldNumber field_number_dist = CGAL::squared_distance( p, s );
] double dist = CGAL::to_double( field_number_dist );
]
] assert( _fpclass( dist ) == _FPCLASS_QNAN /* Quiet NaN */ );

Approximate cartesian coordinates for the objects involved are:

] p -1699.9804849431803 1275.2576946873996
] s.min -1824.9804849431800 1275.2576947042162
] s.max 2509.7485796014098 1275.2576940874201

The point is very close to the segment. I am not sure whether
producing a NaN is the behaviour one would have to expect given
the kernel I use. Maybe someone with more insight into the
distance calculation implementation can shed some light on this.

I am using CGAL 3.4 and VS 8.0 on Windows XP.

Thanks in advance for any help!

Martin
--
View this message in context:
http://www.nabble.com/squared_distance-and-to_double-producing-NaN-tp25700793p25700793.html
Sent from the cgal-discuss mailing list archive at Nabble.com.




Archive powered by MHonArc 2.6.16.

Top of Page