Skip to content

Commit

Permalink
getting back height parameter for linear_extrude in csg (#5113)
Browse files Browse the repository at this point in the history
Co-authored-by: Guenther Sohler <guenther.sohler@photeon.com>
Co-authored-by: Marius Kintel <marius@kintel.net>
  • Loading branch information
3 people committed May 9, 2024
1 parent 4bc1ae5 commit 6e993d3
Show file tree
Hide file tree
Showing 15 changed files with 117 additions and 110 deletions.
9 changes: 8 additions & 1 deletion src/core/LinearExtrudeNode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,14 @@ std::string LinearExtrudeNode::toString() const
<< "timestamp = " << (fs::exists(path) ? fs::last_write_time(path) : 0) << ", "
;
}
stream << "v = [ " << this->height[0] << ", " << this->height[1] << ", " << this->height[2] << "]" ;
double height=this->height.norm();
stream << "height = " << height;
if(height > 0) {
Vector3d v=this->height/height;
if(v[2] < 1) {
stream << ", v = [ " << v[0] << ", " << v[1] << ", " << v[2] << "]" ;
}
}
if (this->center) {
stream << ", center = true";
}
Expand Down
4 changes: 2 additions & 2 deletions tests/regression/dumptest/allmodules-expected.csg
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ group() {
union();
difference();
intersection();
linear_extrude(v = [ 0, 0, 100], $fn = 0, $fa = 12, $fs = 2);
linear_extrude(v = [ 0, 0, 100], $fn = 0, $fa = 12, $fs = 2);
linear_extrude(height = 100, $fn = 0, $fa = 12, $fs = 2);
linear_extrude(height = 100, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2);
import(file = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 0);
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/dumptest/include-tests-expected.csg
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ group() {
multmatrix([[0, 0, 1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]]) {
group() {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
linear_extrude(v = [ 0, 0, 12], $fn = 0, $fa = 12, $fs = 2) {
linear_extrude(height = 12, $fn = 0, $fa = 12, $fs = 2) {
polygon(points = [[0, 0], [18, 0], [0, 4]], paths = [[0, 1, 2]], convexity = 1);
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/dumptest/intersection-tests-expected.csg
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ multmatrix([[1, 0, 0, 0], [0, 1, 0, -12], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 1, 0, -12], [0, 0, 1, 0], [0, 0, 0, 1]]) {
intersection() {
cube(size = [4, 4, 4], center = true);
linear_extrude(v = [ 0, 0, 100], $fn = 0, $fa = 12, $fs = 2);
linear_extrude(height = 100, $fn = 0, $fa = 12, $fs = 2);
}
}
multmatrix([[1, 0, 0, 0], [0, 1, 0, -16], [0, 0, 1, 0], [0, 0, 0, 1]]) {
Expand Down

0 comments on commit 6e993d3

Please sign in to comment.