1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008 Henrik Tidefelt
19 #include "constructorrepresentation.h"
24 using namespace Shapes
;
28 Helpers::shapesFormat( double scalar
)
30 std::ostringstream oss
;
37 std::sprintf( buf
, "%.5f", fabs( scalar
) );
43 Helpers::shapesFormat( Concrete::Length length
)
45 std::ostringstream oss
;
47 double val
= Concrete::Length::offtype( length
);
54 sprintf( buf
, "%.5fbp", fabs( val
) );
60 Helpers::shapesFormat( Concrete::Coords2D coords
)
62 std::ostringstream oss
;
64 oss
<< "(" << Helpers::shapesFormat( coords
.x_
) << "," << Helpers::shapesFormat( coords
.y_
) << ")" ;
70 Helpers::shapesFormat( Concrete::Coords3D coords
)
72 std::ostringstream oss
;
74 oss
<< "(" << Helpers::shapesFormat( coords
.x_
) << "," << Helpers::shapesFormat( coords
.y_
) << "," << Helpers::shapesFormat( coords
.z_
) << ")" ;
80 Helpers::shapesFormat( Concrete::UnitFloatPair coords
)
82 std::ostringstream oss
;
84 oss
<< "(" << Helpers::shapesFormat( coords
.x_
) << "," << Helpers::shapesFormat( coords
.y_
) << ")" ;
90 Helpers::shapesFormat( Concrete::UnitFloatTriple coords
)
92 std::ostringstream oss
;
94 oss
<< "(" << Helpers::shapesFormat( coords
.x_
) << "," << Helpers::shapesFormat( coords
.y_
) << "," << Helpers::shapesFormat( coords
.z_
) << ")" ;