fixing support head disapperance on linux
This commit is contained in:
parent
5813ec08c9
commit
1a8d98302e
1 changed files with 9 additions and 8 deletions
|
@ -98,7 +98,7 @@ Contour3D sphere(double rho, Portion portion = make_portion(0.0, 2.0*PI),
|
||||||
const auto send = size_t(2*std::get<1>(portion)/angle);
|
const auto send = size_t(2*std::get<1>(portion)/angle);
|
||||||
|
|
||||||
const size_t steps = ring.size();
|
const size_t steps = ring.size();
|
||||||
const double increment = (double)(1.0 / (double)steps);
|
const double increment = 1.0 / double(steps);
|
||||||
|
|
||||||
// special case: first ring connects to 0,0,0
|
// special case: first ring connects to 0,0,0
|
||||||
// insert and form facets.
|
// insert and form facets.
|
||||||
|
@ -110,7 +110,7 @@ Contour3D sphere(double rho, Portion portion = make_portion(0.0, 2.0*PI),
|
||||||
// Fixed scaling
|
// Fixed scaling
|
||||||
const double z = -rho + increment*rho*2.0 * (sbegin + 1.0);
|
const double z = -rho + increment*rho*2.0 * (sbegin + 1.0);
|
||||||
// radius of the circle for this step.
|
// radius of the circle for this step.
|
||||||
const double r = sqrt(abs(rho*rho - z*z));
|
const double r = std::sqrt(std::abs(rho*rho - z*z));
|
||||||
Vec2d b = Eigen::Rotation2Dd(ring[i]) * Eigen::Vector2d(0, r);
|
Vec2d b = Eigen::Rotation2Dd(ring[i]) * Eigen::Vector2d(0, r);
|
||||||
vertices.emplace_back(Vec3d(b(0), b(1), z));
|
vertices.emplace_back(Vec3d(b(0), b(1), z));
|
||||||
|
|
||||||
|
@ -123,13 +123,13 @@ Contour3D sphere(double rho, Portion portion = make_portion(0.0, 2.0*PI),
|
||||||
// General case: insert and form facets for each step,
|
// General case: insert and form facets for each step,
|
||||||
// joining it to the ring below it.
|
// joining it to the ring below it.
|
||||||
for (size_t s = sbegin + 2; s < send - 1; s++) {
|
for (size_t s = sbegin + 2; s < send - 1; s++) {
|
||||||
const double z = -rho + increment*(double)s*2.0*rho;
|
const double z = -rho + increment*double(s*2.0*rho);
|
||||||
const double r = sqrt(abs(rho*rho - z*z));
|
const double r = std::sqrt(std::abs(rho*rho - z*z));
|
||||||
|
|
||||||
for (size_t i = 0; i < ring.size(); i++) {
|
for (size_t i = 0; i < ring.size(); i++) {
|
||||||
Vec2d b = Eigen::Rotation2Dd(ring[i]) * Eigen::Vector2d(0, r);
|
Vec2d b = Eigen::Rotation2Dd(ring[i]) * Eigen::Vector2d(0, r);
|
||||||
vertices.emplace_back(Vec3d(b(0), b(1), z));
|
vertices.emplace_back(Vec3d(b(0), b(1), z));
|
||||||
auto id_ringsize = coord_t(id - ring.size());
|
auto id_ringsize = coord_t(id - int(ring.size()));
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
// wrap around
|
// wrap around
|
||||||
facets.emplace_back(Vec3crd(id - 1, id,
|
facets.emplace_back(Vec3crd(id - 1, id,
|
||||||
|
@ -148,12 +148,12 @@ Contour3D sphere(double rho, Portion portion = make_portion(0.0, 2.0*PI),
|
||||||
if(send >= size_t(2*PI / angle)) {
|
if(send >= size_t(2*PI / angle)) {
|
||||||
vertices.emplace_back(Vec3d(0.0, 0.0, -rho + increment*send*2.0*rho));
|
vertices.emplace_back(Vec3d(0.0, 0.0, -rho + increment*send*2.0*rho));
|
||||||
for (size_t i = 0; i < ring.size(); i++) {
|
for (size_t i = 0; i < ring.size(); i++) {
|
||||||
auto id_ringsize = coord_t(id - ring.size());
|
auto id_ringsize = coord_t(id - int(ring.size()));
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
// third vertex is on the other side of the ring.
|
// third vertex is on the other side of the ring.
|
||||||
facets.emplace_back(Vec3crd(id - 1, id_ringsize, id));
|
facets.emplace_back(Vec3crd(id - 1, id_ringsize, id));
|
||||||
} else {
|
} else {
|
||||||
auto ci = coord_t(id_ringsize + i);
|
auto ci = coord_t(id_ringsize + coord_t(i));
|
||||||
facets.emplace_back(Vec3crd(ci - 1, ci, id));
|
facets.emplace_back(Vec3crd(ci - 1, ci, id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -710,7 +710,8 @@ public:
|
||||||
meshcache = TriangleMesh();
|
meshcache = TriangleMesh();
|
||||||
|
|
||||||
for(auto& head : heads()) {
|
for(auto& head : heads()) {
|
||||||
meshcache.merge(mesh(head.mesh));
|
auto&& m = mesh(head.mesh);
|
||||||
|
meshcache.merge(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto& stick : pillars()) {
|
for(auto& stick : pillars()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue