mirror of
https://github.com/OpenCMT/uLib.git
synced 2025-12-06 07:21:31 +01:00
Compare commits
2 Commits
b0240dc807
...
94bad596ed
| Author | SHA1 | Date | |
|---|---|---|---|
| 94bad596ed | |||
|
|
fc909da400 |
@@ -110,6 +110,17 @@ public:
|
|||||||
|
|
||||||
inline void Rotate(const Matrix3f &m) { this->m_T.rotate(m); }
|
inline void Rotate(const Matrix3f &m) { this->m_T.rotate(m); }
|
||||||
|
|
||||||
|
inline void Rotate(const float angle, Vector3f axis)
|
||||||
|
{
|
||||||
|
axis.normalize(); // prehaps not necessary ( see eigens )
|
||||||
|
Eigen::AngleAxisf ax(angle,axis);
|
||||||
|
this->m_T.rotate(Eigen::Quaternion<float>(ax));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Rotate(const Vector3f euler_axis) {
|
||||||
|
float angle = euler_axis.norm();
|
||||||
|
Rotate(angle,euler_axis);
|
||||||
|
}
|
||||||
|
|
||||||
inline void PreRotate(const Matrix3f &m) { this->m_T.prerotate(m); }
|
inline void PreRotate(const Matrix3f &m) { this->m_T.prerotate(m); }
|
||||||
|
|
||||||
|
|||||||
@@ -114,8 +114,11 @@ void Abstract::VoxImage::ExportToVti (const char *file, bool density_type, bool
|
|||||||
size_t npoints = nx*ny*nz;
|
size_t npoints = nx*ny*nz;
|
||||||
float *scalar = static_cast<float*>(image->GetScalarPointer());
|
float *scalar = static_cast<float*>(image->GetScalarPointer());
|
||||||
|
|
||||||
|
StructuredData unwrap(*voxels);
|
||||||
|
unwrap.SetDataOrder(StructuredData::XYZ); // move to XYZ order (VTK)
|
||||||
for (size_t i = 0; i < npoints; i++) {
|
for (size_t i = 0; i < npoints; i++) {
|
||||||
scalar[i] = static_cast<float>(voxels->GetValue(i) * norm);
|
Vector3i idx = unwrap.UnMap(i);
|
||||||
|
scalar[i] = static_cast<float>(voxels->GetValue(idx) * norm);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a custom string key
|
// Create a custom string key
|
||||||
@@ -170,8 +173,12 @@ int Abstract::VoxImage::ImportFromVti(const char *file, bool density_type) {
|
|||||||
|
|
||||||
size_t npoints = nx*ny*nz;
|
size_t npoints = nx*ny*nz;
|
||||||
float *scalar = static_cast<float*>(image->GetScalarPointer());
|
float *scalar = static_cast<float*>(image->GetScalarPointer());
|
||||||
|
|
||||||
|
StructuredData wrap(*voxels);
|
||||||
|
wrap.SetDataOrder(StructuredData::XYZ);
|
||||||
for (size_t i = 0; i < npoints; i++) {
|
for (size_t i = 0; i < npoints; i++) {
|
||||||
voxels->SetValue(i, scalar[i] / norm);
|
Vector3i idx = wrap.UnMap(i);
|
||||||
|
voxels->SetValue(idx, scalar[i] / norm);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user