ENH: OBJstream: output triPointRef

This commit is contained in:
mattijs
2012-11-13 12:17:41 +00:00
parent 37b873b051
commit 6bd16e1eef
2 changed files with 37 additions and 1 deletions

View File

@ -238,6 +238,38 @@ Foam::Ostream& Foam::OBJstream::write(const linePointRef& ln)
}
Foam::Ostream& Foam::OBJstream::write
(
const triPointRef& f,
const bool lines
)
{
label start = nVertices_;
write(f.a());
write(f.b());
write(f.c());
if (lines)
{
write('l');
for (int i = 0; i < 3; i++)
{
write(' ') << start+1+i;
}
write(' ') << start+1 << '\n';
}
else
{
write('f');
for (int i = 0; i < 3; i++)
{
write(' ') << start+1+i;
}
write('\n');
}
return *this;
}
Foam::Ostream& Foam::OBJstream::write
(
const face& f,

View File

@ -39,13 +39,14 @@ SourceFiles
#include "point.H"
#include "edge.H"
#include "face.H"
#include "triPointRef.H"
#include "linePointRef.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class OBJstream Declaration
\*---------------------------------------------------------------------------*/
@ -134,6 +135,9 @@ public:
//- Write line
Ostream& write(const linePointRef&);
//- Write triangle as points with lines or filled polygon
Ostream& write(const triPointRef&, const bool lines = true);
//- Write face as points with lines or filled polygon
Ostream& write
(