Haskell-Things / ImplicitCAD

A math-inspired CAD program in haskell. CSG, bevels, and shells; 2D & 3D geometry; 2D gcode generation...
https://implicitcad.org/
GNU Affero General Public License v3.0
1.39k stars 142 forks source link

Cummulative matrix transformation (translate, rotate) from OpenSCAD #220

Closed dimitre closed 3 years ago

dimitre commented 5 years ago

I know the project isn't meant to be 100% compatible with OpenSCAD but I've noticed a very basic issue trying to run the following code in both of them

union() {
    cube(size=[10,20,5]);
    rotate(30)
    translate([0,30,0]) 
    {
        cube(size=[10,20,5]);
        rotate(30)
        translate([0,30,0]) 
        {
            cube(size=[10,20,5]);
        }
    }
}

and ImplicitCAD doens't seem to understand the cumulative translation and rotation Screen Shot 2019-05-02 at 21 08 05

l29ah commented 5 years ago

The result suggests that there's some problem with a bounding box calculation.

l29ah commented 5 years ago

Minimal reproducer: rotate(30) cube(10);.

julialongtin commented 5 years ago

Reproduced with the original code. investigating.

isovector commented 3 years ago

I'm unable to reproduce in the Haskell library:


main :: IO ()
main = writeSTL 1 "/tmp/yo.stl" $
  let cube = cubeR 0 True (10, 20, 5)
   in union
        [ cube
        , rotate3 (degZ 30) $ translate (0, 30, 0) $ union
          [ cube
          , rotate3 (degZ 30) $ translate (0, 30, 0) cube
          ]
        ]

produces:

2020-11-26-125611_427x322_scrot

julialongtin commented 3 years ago

Fixed. Closing.