ENH: meshTools: Add functions to write lines and vectors to .obj files

This commit is contained in:
laurence
2012-04-20 09:18:46 +01:00
parent dfac320401
commit 8980559ecd
2 changed files with 51 additions and 0 deletions

View File

@ -215,6 +215,39 @@ void Foam::meshTools::writeOBJ
}
void Foam::meshTools::writeOBJ
(
Ostream& os,
const point& p1,
const point& p2,
label& count
)
{
os << "v" << ' ' << p1.x() << ' ' << p1.y() << ' ' << p1.z() << endl;
os << "v" << ' ' << p2.x() << ' ' << p2.y() << ' ' << p2.z() << endl;
os << "l" << " " << (count + 1) << " " << (count + 2) << endl;
count += 2;
}
void Foam::meshTools::writeOBJ
(
Ostream& os,
const point& p1,
const point& p2
)
{
os << "v" << ' ' << p1.x() << ' ' << p1.y() << ' ' << p1.z() << endl;
os << "vn"
<< ' ' << p2.x() - p1.x()
<< ' ' << p2.y() - p1.y()
<< ' ' << p2.z() - p1.z() << endl;
}
void Foam::meshTools::writeOBJ
(
Ostream& os,

View File

@ -107,6 +107,24 @@ namespace meshTools
const point& pt
);
//- Write obj representation of a line connecting two points
// Need to keep track of points that have been added. count starts at 0
void writeOBJ
(
Ostream& os,
const point& p1,
const point& p2,
label& count
);
//- Write obj representation of a point p1 with a vector from p1 to p2
void writeOBJ
(
Ostream& os,
const point& p1,
const point& p2
);
//- Write obj representation of faces subset
void writeOBJ
(