-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Add Support for loading mesh files
* Adds VTK as an optional depenency, if VTK_DIR is defined then Autoscoper will be compiled with mesh support
- Loading branch information
1 parent
8fe9748
commit 2fdded0
Showing
7 changed files
with
154 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "Mesh.hpp" | ||
#include <vtkSTLReader.h> | ||
#include <vtkSTLWriter.h> | ||
|
||
Mesh::Mesh(const std::string& filename) | ||
{ | ||
vtkSTLReader* reader = vtkSTLReader::New(); | ||
reader->SetFileName(filename.c_str()); | ||
reader->Update(); | ||
this->polyData = reader->GetOutput(); | ||
reader->Delete(); | ||
} | ||
|
||
Mesh::Mesh(const Mesh& other) | ||
{ | ||
this->polyData = vtkPolyData::New(); | ||
this->polyData->DeepCopy(other.polyData); | ||
} | ||
|
||
void Mesh::Write(const std::string& filename) const | ||
{ | ||
vtkSTLWriter* writer = vtkSTLWriter::New(); | ||
writer->SetFileName(filename.c_str()); | ||
writer->SetInputData(this->polyData); | ||
writer->Write(); | ||
writer->Delete(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
#include <string> | ||
#include <vtkPolyData.h> | ||
|
||
class Mesh | ||
{ | ||
public: | ||
Mesh(const std::string& filename); | ||
Mesh(const Mesh&); | ||
|
||
vtkPolyData* GetPolyData() const { return this->polyData; } | ||
|
||
void Write(const std::string& filename) const; | ||
|
||
private: | ||
vtkPolyData* polyData; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters