Merge branch 'master' of github.com:openscad/openscad
|
@ -48,9 +48,10 @@ typedef CGAL::Exact_predicates_exact_constructions_kernel CGAL_ExactKernel2;
|
|||
typedef CGAL::Polygon_2<CGAL_ExactKernel2> CGAL_Poly2;
|
||||
typedef CGAL::Polygon_with_holes_2<CGAL_ExactKernel2> CGAL_Poly2h;
|
||||
|
||||
//typedef CGAL::Cartesian<NT> CGAL_Kernel3;
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel CGAL_Kernel3;
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel::FT NT3;
|
||||
typedef CGAL::Gmpq NT3;
|
||||
typedef CGAL::Cartesian<NT3> CGAL_Kernel3;
|
||||
//typedef CGAL::Exact_predicates_exact_constructions_kernel::FT NT3;
|
||||
//typedef CGAL::Exact_predicates_exact_constructions_kernel CGAL_Kernel3;
|
||||
typedef CGAL::Nef_polyhedron_3<CGAL_Kernel3> CGAL_Nef_polyhedron3;
|
||||
typedef CGAL_Nef_polyhedron3::Aff_transformation_3 CGAL_Aff_transformation;
|
||||
|
||||
|
|
|
@ -108,3 +108,17 @@ void Editor::wheelEvent ( QWheelEvent * event )
|
|||
}
|
||||
}
|
||||
|
||||
void Editor::setPlainText(const QString &text)
|
||||
{
|
||||
int y = verticalScrollBar()->sliderPosition();
|
||||
// Save current cursor position
|
||||
QTextCursor cursor = textCursor();
|
||||
int n = cursor.position();
|
||||
QTextEdit::setPlainText(text);
|
||||
// Restore cursor position
|
||||
if (n < text.length()) {
|
||||
cursor.setPosition(n);
|
||||
setTextCursor(cursor);
|
||||
verticalScrollBar()->setSliderPosition(y);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <QString>
|
||||
#include <QWidget>
|
||||
#include <QWheelEvent>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include <QTextEdit>
|
||||
class Editor : public QTextEdit
|
||||
|
@ -9,6 +10,7 @@ class Editor : public QTextEdit
|
|||
Q_OBJECT
|
||||
public:
|
||||
Editor(QWidget *parent) : QTextEdit(parent) { setAcceptRichText(false); }
|
||||
void setPlainText(const QString &text);
|
||||
public slots:
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
|
|
|
@ -504,6 +504,7 @@ MainWindow::openFile(const QString &new_filename)
|
|||
}
|
||||
#endif
|
||||
setFileName(actual_filename);
|
||||
editor->setPlainText("");
|
||||
|
||||
fileChangedOnDisk(); // force cached autoReloadId to update
|
||||
refreshDocument();
|
||||
|
|
|
@ -15,4 +15,10 @@ translate([-2,0,0]) polygon(points);
|
|||
translate([-2,-2,0]) polygon(points=points, paths=[[0,1,2,3], [4,5,6,7]]);
|
||||
translate([2,-4,0]) polygon([[0,0], [1,0], [1,1], [0,0]]);
|
||||
|
||||
// With hole
|
||||
translate([-2,-4,0])
|
||||
polygon(points=[[0,0], [1,0], [1,1], [0,1], [0.2,0.2], [0.8,0.2], [0.8,0.8], [0.2,0.8]],
|
||||
paths=[[0,1,2,3],[4,5,6,7]]
|
||||
);
|
||||
|
||||
// FIXME: convexity
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
// 2D child
|
||||
projection(cut=true) { square(); }
|
||||
|
||||
projection(cut=true) translate([20,0,0]) cube(10, center=true);
|
||||
|
||||
// Boundary case: clipping the top of a cube
|
||||
translate([0,20,0]) projection(cut=true) translate([0,0,-4.999999]) cube(10, center=true);
|
||||
|
||||
// holes
|
||||
translate([0,-10,0]) projection(cut=true) {
|
||||
union() {
|
||||
difference() { cube(5,center=true); cube(4,center=true); }
|
||||
translate([2.1,2.1]) difference() { cube(5,center=true); cube(4,center=true); }
|
||||
}
|
||||
}
|
|
@ -3,17 +3,25 @@ projection();
|
|||
// No children
|
||||
projection() { }
|
||||
// 2D child
|
||||
projection(cut=true) { square(); }
|
||||
projection() { square(); }
|
||||
|
||||
// Simple
|
||||
projection(cut=false) cube(10);
|
||||
projection(cut=true) translate([20,0,0]) cube(10, center=true);
|
||||
// Boundary case: clipping the top of a cube
|
||||
translate([0,20,0]) projection(cut=true) translate([0,0,-4.999999]) cube(10, center=true);
|
||||
|
||||
// holes
|
||||
translate([0,-10,0]) projection(cut=true) {
|
||||
union() {
|
||||
difference() { cube(5,center=true); cube(4,center=true); }
|
||||
translate([2.1,2.1]) difference() { cube(5,center=true); cube(4,center=true); }
|
||||
}
|
||||
// Two children
|
||||
translate([-12,0]) projection(cut=false) {
|
||||
cube(10);
|
||||
difference() {
|
||||
sphere(10);
|
||||
cylinder(h=30, r=5, center=true);
|
||||
}
|
||||
}
|
||||
|
||||
// Holes
|
||||
translate([6,-12]) projection(cut=false) {
|
||||
cube(10);
|
||||
difference() {
|
||||
sphere(10);
|
||||
cylinder(h=30, r=5, center=true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
render() {
|
||||
difference() {
|
||||
square(100, center=true);
|
||||
circle(r=30);
|
||||
square(10, center=true);
|
||||
circle(r=3);
|
||||
}
|
||||
}
|
||||
|
||||
translate([12,0,0]) render() {
|
||||
square(10, center=true);
|
||||
circle(r=3);
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 7.5 KiB |
|
@ -33,4 +33,7 @@ group() {
|
|||
multmatrix([[1, 0, 0, 2], [0, 1, 0, -4], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
polygon(points = [[0, 0], [1, 0], [1, 1], [0, 0]], paths = undef, convexity = 1);
|
||||
}
|
||||
multmatrix([[1, 0, 0, -2], [0, 1, 0, -4], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
polygon(points = [[0, 0], [1, 0], [1, 1], [0, 1], [0.2, 0.2], [0.8, 0.2], [0.8, 0.8], [0.2, 0.8]], paths = [[0, 1, 2, 3], [4, 5, 6, 7]], convexity = 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
group() {
|
||||
projection(cut = true, convexity = 0) {
|
||||
square(size = [1, 1], center = false);
|
||||
}
|
||||
projection(cut = true, convexity = 0) {
|
||||
multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
cube(size = [10, 10, 10], center = true);
|
||||
}
|
||||
}
|
||||
multmatrix([[1, 0, 0, 0], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
projection(cut = true, convexity = 0) {
|
||||
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -4.999999], [0, 0, 0, 1]]) {
|
||||
cube(size = [10, 10, 10], center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
multmatrix([[1, 0, 0, 0], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
projection(cut = true, convexity = 0) {
|
||||
union() {
|
||||
difference() {
|
||||
cube(size = [5, 5, 5], center = true);
|
||||
cube(size = [4, 4, 4], center = true);
|
||||
}
|
||||
multmatrix([[1, 0, 0, 2.1], [0, 1, 0, 2.1], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
difference() {
|
||||
cube(size = [5, 5, 5], center = true);
|
||||
cube(size = [4, 4, 4], center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,37 +1,27 @@
|
|||
group() {
|
||||
projection(cut = false, convexity = 0);
|
||||
projection(cut = false, convexity = 0);
|
||||
projection(cut = true, convexity = 0) {
|
||||
projection(cut = false, convexity = 0) {
|
||||
square(size = [1, 1], center = false);
|
||||
}
|
||||
projection(cut = false, convexity = 0) {
|
||||
cube(size = [10, 10, 10], center = false);
|
||||
}
|
||||
projection(cut = true, convexity = 0) {
|
||||
multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
cube(size = [10, 10, 10], center = true);
|
||||
}
|
||||
}
|
||||
multmatrix([[1, 0, 0, 0], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
projection(cut = true, convexity = 0) {
|
||||
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -4.999999], [0, 0, 0, 1]]) {
|
||||
cube(size = [10, 10, 10], center = true);
|
||||
multmatrix([[1, 0, 0, -12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
projection(cut = false, convexity = 0) {
|
||||
cube(size = [10, 10, 10], center = false);
|
||||
difference() {
|
||||
sphere($fn = 0, $fa = 12, $fs = 2, r = 10);
|
||||
cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 5, r2 = 5, center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
multmatrix([[1, 0, 0, 0], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
projection(cut = true, convexity = 0) {
|
||||
union() {
|
||||
difference() {
|
||||
cube(size = [5, 5, 5], center = true);
|
||||
cube(size = [4, 4, 4], center = true);
|
||||
}
|
||||
multmatrix([[1, 0, 0, 2.1], [0, 1, 0, 2.1], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
difference() {
|
||||
cube(size = [5, 5, 5], center = true);
|
||||
cube(size = [4, 4, 4], center = true);
|
||||
}
|
||||
}
|
||||
multmatrix([[1, 0, 0, 6], [0, 1, 0, -12], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
projection(cut = false, convexity = 0) {
|
||||
cube(size = [10, 10, 10], center = false);
|
||||
difference() {
|
||||
sphere($fn = 0, $fa = 12, $fs = 2, r = 10);
|
||||
cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 5, r2 = 5, center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
group() {
|
||||
render(convexity = 1) {
|
||||
difference() {
|
||||
square(size = [100, 100], center = true);
|
||||
circle($fn = 0, $fa = 12, $fs = 2, r = 30);
|
||||
square(size = [10, 10], center = true);
|
||||
circle($fn = 0, $fa = 12, $fs = 2, r = 3);
|
||||
}
|
||||
}
|
||||
multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
render(convexity = 1) {
|
||||
square(size = [10, 10], center = true);
|
||||
circle($fn = 0, $fa = 12, $fs = 2, r = 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.8 KiB |