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"
23 using namespace Shapes
;
27 Helpers::shapesFormat( double scalar
)
29 std::ostringstream oss
;
36 sprintf( buf
, "%.5f", fabs( scalar
) );
42 Helpers::shapesFormat( Concrete::Length length
)
44 std::ostringstream oss
;
46 double val
= Concrete::Length::offtype( length
);
53 sprintf( buf
, "%.5fbp", fabs( val
) );
59 Helpers::shapesFormat( Concrete::Coords2D coords
)
61 std::ostringstream oss
;
63 oss
<< "(" << Helpers::shapesFormat( coords
.x_
) << "," << Helpers::shapesFormat( coords
.y_
) << ")" ;
69 Helpers::shapesFormat( Concrete::Coords3D coords
)
71 std::ostringstream oss
;
73 oss
<< "(" << Helpers::shapesFormat( coords
.x_
) << "," << Helpers::shapesFormat( coords
.y_
) << "," << Helpers::shapesFormat( coords
.z_
) << ")" ;
79 Helpers::shapesFormat( Concrete::UnitFloatPair coords
)
81 std::ostringstream oss
;
83 oss
<< "(" << Helpers::shapesFormat( coords
.x_
) << "," << Helpers::shapesFormat( coords
.y_
) << ")" ;
89 Helpers::shapesFormat( Concrete::UnitFloatTriple coords
)
91 std::ostringstream oss
;
93 oss
<< "(" << Helpers::shapesFormat( coords
.x_
) << "," << Helpers::shapesFormat( coords
.y_
) << "," << Helpers::shapesFormat( coords
.z_
) << ")" ;