本文整理汇总了C++中TriangleMesh::read方法的典型用法代码示例。如果您正苦于以下问题:C++ TriangleMesh::read方法的具体用法?C++ TriangleMesh::read怎么用?C++ TriangleMesh::read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TriangleMesh
的用法示例。
在下文中一共展示了TriangleMesh::read方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, const char * argv[])
{
Electrostatics e;
TriangleMesh *teststl = new TriangleMesh();
teststl->read("/Users/phaedon/github/bem-laplace-simple/meshes/sphere5120.stl", MeshFileFormat::MFF_STL);
teststl->write("/Users/phaedon/github/bem-laplace-simple/meshes/sphere5120.obj", MeshFileFormat::MFF_OBJ);
TriangleMesh *s = new TriangleMesh();
s->read("/Users/phaedon/github/bem-laplace-simple/meshes/sphere_5mm_h0cm_s3.obj", MeshFileFormat::MFF_OBJ);
e.addBubble(s);
s = new TriangleMesh();
s->read("/Users/phaedon/github/bem-laplace-simple/meshes/sphere_5mm_h10cm.obj", MeshFileFormat::MFF_OBJ);
e.addBubble(s);
s = new TriangleMesh();
s->read("/Users/phaedon/github/bem-laplace-simple/meshes/sphere_5mm_h30cm.obj", MeshFileFormat::MFF_OBJ);
e.addBubble(s);
s = new TriangleMesh();
s->read("/Users/phaedon/github/bem-laplace-simple/meshes/sphere_5mm_h50cm.obj", MeshFileFormat::MFF_OBJ);
e.addBubble(s);
s = new TriangleMesh();
s->read("/Users/phaedon/github/bem-laplace-simple/meshes/sphere_5mm_h80cm.obj", MeshFileFormat::MFF_OBJ);
e.addBubble(s);
s = new TriangleMesh();
s->read("/Users/phaedon/github/bem-laplace-simple/meshes/sphere_5mm_h90cm.obj", MeshFileFormat::MFF_OBJ);
e.addBubble(s);
s = new TriangleMesh();
s->read("/Users/phaedon/github/bem-laplace-simple/meshes/sphere_5mm_h95cm.obj", MeshFileFormat::MFF_OBJ);
e.addBubble(s);
s = new TriangleMesh();
s->read("/Users/phaedon/github/bem-laplace-simple/meshes/sphere_5mm_h995mm_s3.obj", MeshFileFormat::MFF_OBJ);
e.addBubble(s);
TriangleMesh *plane = new TriangleMesh();
plane->read("/Users/phaedon/github/bem-laplace-simple/meshes/plane_h1_s50mm_t128.obj", MeshFileFormat::MFF_OBJ);
e.setSurface(plane);
std::vector<double> caps;
e.capacitance(caps);
for (size_t i = 0; i < caps.size(); i++) {
std::cout << "capacitance of " << i << "th bubble: " << caps[i] << std::endl;
}
std::cout << "Finished!" << std::endl;
return 0;
}
示例2: bpressurefiletester
// Let's make sure I'm parsing the boundary pressure outputs from bem++ correctly
void bpressurefiletester() {
TriangleMesh combined;
combined.read("/Users/phaedon/github/aletler/meshes/geometrySim/air_000000.obj", MFF_OBJ);
combined.read("/Users/phaedon/github/aletler/meshes/geometrySim/solid_000000.obj", MFF_OBJ);
std::string filename = "/Users/phaedon/fakebemout.dat";
BoundaryPressure bp;
bp.read(filename);
bp.visualize(combined);
}
示例3: simulateGeometry
void simulateGeometry(size_t frameRate,
double minRadius, // in mm
double maxRadius, // in mm
double simDuration, // in seconds
size_t numBubbles, // over lifetime of simulation
const std::string &outputDir) {
std::vector<FakeBubbleStats> bubbleStats(numBubbles);
std::vector<Bubble *> bubbles(numBubbles);
size_t numFrames = ceil(frameRate * simDuration);
double dt = 1.0 / double(frameRate);
// initialize random bubble stats
for (size_t i = 0; i < numBubbles; i++) {
bubbleStats[i].bubbleBirthtime = random_double(0.02, simDuration * 0.95);
bubbleStats[i].bubbleRadius = random_double(minRadius, maxRadius);
std::cout << "bubbleRadius: " << bubbleStats[i].bubbleRadius << std::endl;
bubbleStats[i].isBubbleBorn = false;
bubbleStats[i].isBubbleDead = false;
}
// initialize bubble objects
for (size_t i = 0; i < numBubbles; i++) {
bubbles[i] = new Bubble();
TriangleMesh *currBubble = new TriangleMesh;
// yep, for now a different copy of each
currBubble->read(baseDir + "bubble_lr.obj", MFF_OBJ);
// constant is here because starting size of bubbles is 5mm radius
double ds = bubbleStats[i].bubbleRadius / 5.0;
currBubble->scale(Vector3d(ds, ds, ds));
double dx = random_double(-0.05, +0.05);
double dz = random_double(-0.05, +0.05);
Vector3d dpos(dx,0,dz);
//currBubble->translate(dpos); // TODO: uncomment this line to randomizing starting position
bubbles[i]->setBubbleMesh(currBubble);
}
std::string solidPrefix = "solid_";
std::string airPrefix = "air_";
std::string bubblePrefix = "bubble_";
for (size_t f = 0; f < numFrames; f++) {
double currTime = f * dt;
std::string zeropadFrameNum = ZeroPadNumber(f, 6);
// add a bit of random vertical motion to the fluid surface
//airMesh->jitter(Vector3d(0,0.0005,0));
solidMesh->write(outputDir + solidPrefix + zeropadFrameNum + ".obj", MFF_OBJ);
airMesh->write(outputDir + airPrefix + zeropadFrameNum + ".obj", MFF_OBJ);
// advect all the bubbles for each timestep
for (size_t b = 0; b < numBubbles; b++) {
if (bubbleStats[b].bubbleBirthtime <= currTime) {
bubbleStats[b].isBubbleBorn = true;
}
// check whether bubble has peeked above the surface
if (bubbleStats[b].isBubbleBorn && !bubbleStats[b].isBubbleDead) {
BoundingBox airbbox, bubbbox;
airMesh->getBoundingBox(airbbox);
bubbles[b]->getBubbleMesh()->getBoundingBox(bubbbox);
// rough crappy rule of thumb
if (bubbbox.GetBoxmax().y() > airbbox.GetBoxmax().y()) {
// KILL THE BUBBLE!
bubbleStats[b].isBubbleDead = true;
}
}
if (bubbleStats[b].isBubbleBorn && !bubbleStats[b].isBubbleDead) {
std::string zeropadBubbleNum = ZeroPadNumber(b, 6);
bubbles[b]->getBubbleMesh()->write(outputDir + bubblePrefix + zeropadBubbleNum + "_" + zeropadFrameNum + ".obj", MFF_OBJ);
bubbles[b]->timestep(dt);
}
}
}
}