geometrically confused

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

geometrically confused

DanS
This post has NOT been accepted by the mailing list yet.
This is a very dumb question, but I keep having trouble wrapping my head around the geometry of openScad (I know, right hand rule... but I'm having trouble picturing things).  I am trying to make a surface of four planes where the "center" of those four planes (the vertex where they all meet) is the lowest point, and the highest points are the outermost vertexes of the four planes (diagonal from the center).

So this is what I've done so far:

module quarterPlane() {
  rotate([2.25, -2.25, 0]) {
    cube([23.49,19,.02]);
  }
}

module halfPlane() {
  quarterPlane();
  mirror([0,1,0]) quarterPlane();
}

halfPlane();
mirror([1,0,0]) halfPlane();

I'm concerned that I may have gaps, or not the geometry I'm looking for.
Also I made the y rotation -2.25 because that looked better in the visualization window but my "intuition" originally told me to use 2.25 degrees instead.

-How can I best internalize openScad geometry?
-How can I test for gaps between objects?
-Does my example look ok?
Reply | Threaded
Open this post in threaded view
|

Re: geometrically confused

Bananapeel
Rotation is a really difficult issue. The part is rotated around the axis, not around its own center. So you get different results depending on whether you translate it before or after rotating. To rotate a part around its own center, it needs to be placed with its center at 0 on the axes that you want to rotate around.

rotate([0,20,0])  {
    color("red")
    translate([-3,0,0])
    cube([3,3,3]);

    translate([0, 6, 0])
    cube([3,3,3]);
}

One cube appears to be rotated "up" (red) and the other "down" even though both were rotated 20*. The difference lies in their initial positions. Be very observant about where your parts are created, even before you start translating/rotating.

Rotation is like tying a string from each of the vertices and to the axis that you are rotating about, then moving the vertices by x degrees.

The direction of rotation is also difficult to predict. I don't use the right hand rule. Instead I imagine a protractor centered at [0,0,0]. Rotate the view so that you are "standing" on the POSITIVE side of the axis you are rotating around and looking towards zero. Imagine (you don't have to imagine it, as I drew it for us in the code below - I'm definetely saving this for future use!) the full circle of 360 degrees. If you have an object placed at 120 and rotate it 30 degrees around the x axis it should end up at 150.


module protractor(c) {
    color(c)
    for (i=[0:30:359]) {
        rotate([i, 0, 0])
        translate([0, 100, 0])
        rotate([0,90,0])
        linear_extrude(height=1)
        text(str(i));
       
        rotate([i,0,0])
        translate([0, 0, 10])
        cylinder(h=90, r=0.5);
    }
}

// rotate around the x axis
protractor("red");

// rotate around the y axis
//rotate([0,0,90])
//protractor("chartreuse");

// rotate around the z axis
//rotate([0, 90, 0])
//protractor("blue");

I hope this helps!

Regards,
Bananapeel :)
Reply | Threaded
Open this post in threaded view
|

Re: geometrically confused

DanS
This post has NOT been accepted by the mailing list yet.
Thanks Bananapeel.  I think it will take me a while understand the geometry here.  I think I'll play with your protractor to better inform myself.

If anyone has tips on my last two questions, please chime in.
Reply | Threaded
Open this post in threaded view
|

Re: geometrically confused

Bananapeel
You can see why you had to rotate it negatively in the code below (I exaggerated the rotations to make it easier to see). Also, by exaggerating the values, an imperfectness with the geometry becomes apparent. The planes sort of overlap. I'm no expert, but I think it's not going to matter in practice, because the thickness of the planes covers up the gap (with the proper rotation values).

module quarterPlane() {
    color("Blue")
    rotate([22.5, 22.5, 0])
    translate([-23.49,0,0])  // create the part in the other quadrant and you need to rotate positively to get up towards 30 degrees.
    cube([23.49,19,.02]);
   
    color("red")  // this is your old part. notice you have to flip it negatively to rotate the outer edge from 180 towards 150, because 150 is less than 180
    rotate([22.5, -22.5, 0])
    cube([23.49,19,.02]);
}

quarterPlane();

module protractor(c) {
    color(c)
    for (i=[0:30:359]) {
        rotate([i, 0, 0])
        translate([0, 100, 0])
        rotate([0,90,0])
        linear_extrude(height=1)
        text(str(i));
       
        rotate([i,0,0])
        translate([0, 0, 10])
        cylinder(h=90, r=0.5);
    }
}

rotate([0,0,90])
protractor("chartreuse");

Reply | Threaded
Open this post in threaded view
|

Re: geometrically confused

DanS
This post has NOT been accepted by the mailing list yet.
I need to train my faulty intuition.  I was not expecting that odd angled overlap (which gets larger away from the center).  I was imagining that the four planes would just exactly meet up and that would be it.

I'm going to have a number of cases where this angled surface has to join up with other surfaces and I don't want to create lots of gaps or overlaps.

Thanks again for the help