Subject: CGAL users discussion list
List archive
- From: pratihast22089 <>
- To:
- Subject: Re: [cgal-discuss] error regarding file stream
- Date: Thu, 5 Nov 2009 01:29:19 -0800 (PST)
Thank you Andreas.
Andreas Fabri wrote:
>
>
> Hello,
>
> what you observe is not CGAL specific. You would also have it with
>
> #include <iostream>
> int main()
> {
> double x;
> std:cin >> x;
> std::cout << x << std::endl;
> return 0;
> }
>
> You have to increase the precison.
> http://www.cplusplus.com/reference/iostream/ios_base/precision/
>
> #include <iostream>
> int main()
> {
> double x;
> std:cin >> x;
> std::cout.precision(20);
> std::cout << x << std::endl;
> return 0;
> }
>
> best regards,
>
> andreas
>
>
> pratihast22089 wrote:
>>
>>
>> Sebastien Loriot wrote:
>>> pratihast22089 wrote:
>>>> hi,
>>>>
>>>> I am facing one simple problem regarding file stream.
>>>> I have the data file like this:
>>>>
>>>> 257507.75 471326.93 44.51
>>>> 257507.77 471326.90 44.49
>>>> 257507.89 471326.93 44.04
>>>> 257507.81 471326.81 44.51
>>>> 257507.89 471326.87 44.10
>>>>
>>>>
>>>> While Reading and writing file stream, it truncate the number behind
>>>> point
>>>> of first two columns but not for the third column.
>>>>
>>>> output:
>>>>
>>>> 257507 471326 44.51
>>>> 257507 471326 44.49
>>>> 257507 471326 44.04
>>>> 257507 471326 44.51
>>>> 257507 471326 44.10
>>>>
>>>>
>>>> I had included the #include <CGAL/double.h> header file.
>>>>
>>>> Could you please help me in this regrads.
>>>> Thank you in advance.
>>>>
>>>> Regards,
>>>> Arun K Pratihast
>>>>
>>>>
>>>>
>>>>
>>> Hello,
>>>
>>> Could you please post a minimal example so that we can reproduce the
>>> problem encountered.
>>>
>>>
>>> S.
>>>
>>> --
>>> You are currently subscribed to cgal-discuss.
>>> To unsubscribe or access the archives, go to
>>> https://lists-sop.inria.fr/wws/info/cgal-discuss
>>>
>>>
>>>
>>
>> hi,
>> Here is my code:
>> #include "stdafx.h"
>>
>> #include <cassert>
>> #include <vector>
>> #include <fstream>
>>
>> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
>>
>> #include <CGAL/Weighted_alpha_shape_euclidean_traits_3.h>
>> #include <CGAL/Regular_triangulation_3.h>
>> #include <CGAL/Alpha_shape_3.h>
>> #include <CGAL/double.h>
>>
>> #include <list>
>> #include <cassert>
>> #include <vector>
>> #include <fstream>
>> #include <utility>
>>
>> typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
>>
>> typedef CGAL::Weighted_alpha_shape_euclidean_traits_3<K> Gt;
>>
>> typedef CGAL::Alpha_shape_vertex_base_3<Gt> Vb;
>> typedef CGAL::Alpha_shape_cell_base_3<Gt> Fb;
>> typedef CGAL::Triangulation_data_structure_3<Vb,Fb> Tds;
>> typedef CGAL::Regular_triangulation_3<Gt,Tds> Triangulation_3;
>> typedef CGAL::Alpha_shape_3<Triangulation_3> Alpha_shape_3;
>>
>> typedef Alpha_shape_3::Alpha_iterator Alpha_iterator;
>> typedef Alpha_shape_3::Cell_handle Cell_handle;
>> typedef Alpha_shape_3::Vertex_handle Vertex_handle;
>> typedef Alpha_shape_3::Facet Facet;
>> typedef Alpha_shape_3::Edge Edge;
>> typedef Gt::Weighted_point Weighted_point;
>> typedef Gt::Bare_point Bare_point;
>> typedef K::Point_3 Point;
>> typedef std::list<Vertex_handle>::const_iterator Vl_it;
>>
>>
>> int main()
>> {
>> std::list<Weighted_point> lwp;
>>
>> //read input
>> std::ifstream is("D:/Cgalcode/Polyhedronification/Debug/demo.xyz");
>> int n;
>> is >> n;
>> std::cout << "Point Reading Start:" << n << " points " << std::endl;
>>
>> Bare_point p;
>> for( ; n>0 ; n--) {
>> is >> p;
>> std::cout<< p<<std::endl;
>> lwp.push_back(p);
>> }
>> std::cout << "Point Reading End:" << std::endl;
>>
>> Alpha_shape_3 as(lwp.begin(), lwp.end(), 0.5,
>> Alpha_shape_3::GENERAL);
>> //Alpha_shape_3 as(lwp.begin(), lwp.end(),
>> Alpha_shape_3::GENERAL);;
>> Alpha_iterator aa = as.alpha_upper_bound(1);
>> as.set_alpha(*aa);
>>
>>
>> //build alpha_shape in GENERAL mode and set alpha=0.15
>> //Alpha_shape_3 as(lwp.begin(), lwp.end(), 0.015,
>> Alpha_shape_3::GENERAL);
>>
>> //explore the 0.15-shape - It is dual to the boundary of the union.
>> std::list<Cell_handle> cells;
>> std::list<Facet> facets;
>> std::list<Edge> edges;
>>
>>
>> as.get_alpha_shape_cells(std::back_inserter(cells),Alpha_shape_3::INTERIOR);
>> as.get_alpha_shape_facets(std::back_inserter(facets),
>> Alpha_shape_3::REGULAR);
>> as.get_alpha_shape_facets(std::back_inserter(facets),
>> Alpha_shape_3::SINGULAR);
>> as.get_alpha_shape_edges(std::back_inserter(edges),
>> Alpha_shape_3::SINGULAR);
>> std::cout << " The 0.15-shape has : " << std::endl;
>> std::cout << cells.size() << " interior tetrahedra" << std::endl;
>> std::cout << facets.size() << " boundary facets" << std::endl;
>> std::cout << edges.size() << " singular edges" << std::endl;
>>
>>
>> std::list<Vertex_handle> al_vs;
>> as.get_alpha_shape_vertices(back_inserter(al_vs),Alpha_shape_3::REGULAR);
>> //as.get_alpha_shape_vertices(back_inserter(al_vs),Alpha_shape_3::SINGULAR);
>> std::cout << al_vs.size() << " Vertex Size" << std::endl;
>>
>>
>> //Appending my code
>> std::cout << " My alpha point " << std::endl;
>> std::ofstream of;
>> of.open("D:/Cgalcode/Polyhedronification/data/arun/out_test1.xyz" );
>>
>> for(Vl_it it=al_vs.begin();it!=al_vs.end(); it++) {
>>
>> std::cout <<(*it)->point()<< std::endl;
>> of<<(*it)->point()<<"\n";
>>
>> }
>>
>>
>> return 0;
>> }
>>
>>
>
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>
>
>
--
View this message in context:
http://old.nabble.com/error-regarding-file-stream-tp26195935p26208645.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] error regarding file stream, pratihast22089, 11/04/2009
- Re: [cgal-discuss] error regarding file stream, Sebastien Loriot, 11/04/2009
- Re: [cgal-discuss] error regarding file stream, pratihast22089, 11/04/2009
- Re: [cgal-discuss] error regarding file stream, Sebastien Loriot, 11/04/2009
- Re: [cgal-discuss] error regarding file stream, Andreas Fabri, 11/04/2009
- Re: [cgal-discuss] error regarding file stream, pratihast22089, 11/05/2009
- Re: [cgal-discuss] error regarding file stream, pratihast22089, 11/04/2009
- Re: [cgal-discuss] error regarding file stream, Ariel Baez, 11/04/2009
- Re: [cgal-discuss] error regarding file stream, pratihast22089, 11/04/2009
- Re: [cgal-discuss] error regarding file stream, Olivier Devillers, 11/04/2009
- Re: [cgal-discuss] error regarding file stream, Sebastien Loriot, 11/04/2009
Archive powered by MHonArc 2.6.16.