Problems with difference

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Problems with difference

Ronaldo

The stack and pips are nice solutions.

The rotation rotFromTo(a,b) is the rotation with minimum angle that maps the direction of vector `a` to the direction of vector `b`. It can be coded in many ways. As a function returning a 4x4 matrix, it can be found in the Tips&Tricks page of the OpenSCAD Manual. As a module, I like the following:

module rotFromTo(di,do) {
  if( norm(di) < 1e-16 || norm(do) < 1e-16 || norm(do/norm(do)+di/norm(di))<1e-16 )
    children();
  else
    mirror(do/norm(do)+di/norm(di)) mirror(di) children();
}
 


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Problems with difference

Parkinbot
In reply to this post by rugyoga
Found a nice way to calculate your flattened diamond, which I understand is
the primitive you are going to print:

module flattened_diamond(){
 
  p = [v[0], v[6], v[18], v[8], v[20], [0,0,0]];  // add origin
  intersection()
  {
    scale(1.5) hull() polyhedron(p, [[0,1,2,3,4, 5]]);
    diamond();
  }
}




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Problems with difference

Parkinbot
Ups, sorry, I just read that Ronaldo came up with the same approach ...



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
12