From 0a6b9a36d66e831ccd9e70b99d6d259bd6091bba Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 10 May 2013 16:17:24 +0100 Subject: [PATCH] ENH: OBJstream: add line with normals --- src/surfMesh/surfaceFormats/obj/OBJstream.C | 16 +++++++++++++++- src/surfMesh/surfaceFormats/obj/OBJstream.H | 12 ++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/surfMesh/surfaceFormats/obj/OBJstream.C b/src/surfMesh/surfaceFormats/obj/OBJstream.C index ce0eb2721b..46a6b7e0c0 100644 --- a/src/surfMesh/surfaceFormats/obj/OBJstream.C +++ b/src/surfMesh/surfaceFormats/obj/OBJstream.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -241,6 +241,20 @@ Foam::Ostream& Foam::OBJstream::write(const linePointRef& ln) } +Foam::Ostream& Foam::OBJstream::write +( + const linePointRef& ln, + const vector& n0, + const vector& n1 +) +{ + write(ln.start(), n0); + write(ln.end(), n1); + write("l ") << nVertices_-1 << ' ' << nVertices_ << nl; + return *this; +} + + Foam::Ostream& Foam::OBJstream::write ( const triPointRef& f, diff --git a/src/surfMesh/surfaceFormats/obj/OBJstream.H b/src/surfMesh/surfaceFormats/obj/OBJstream.H index ec7e93d24e..ee6ae58143 100644 --- a/src/surfMesh/surfaceFormats/obj/OBJstream.H +++ b/src/surfMesh/surfaceFormats/obj/OBJstream.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -92,7 +92,7 @@ public: // Access - //- Return the name of the stream + //- Return the number of vertices written label nVertices() const { return nVertices_; @@ -135,6 +135,14 @@ public: //- Write line Ostream& write(const linePointRef&); + //- Write line with points and vector normals ('vn') + Ostream& write + ( + const linePointRef&, + const vector& n0, + const vector& n1 + ); + //- Write triangle as points with lines or filled polygon Ostream& write(const triPointRef&, const bool lines = true);