Hi,

Guest

JB

Jordan Brown

Wed, May 24, 2023 12:02 AM

BTW, if anybody is curious here's the OpenSCAD program that generated

that diagram. It's got some examples of using trig to position and size

things.

```
n = 3;
t = 2;
r = 100;
a = 360/n;
module label(t) { text(t, halign="center", valign="center"); }
circle(r=r);
color("gray") rotate(180) translate([0,0,1]) circle(r=r, $fn=n);
color("white") translate([0,0,2]) {
rotate(a/2) translate([0,-t/2]) square([r,t]);
rotate(-a/2) translate([0,-t/2]) square([r,t]);
translate([0,-t/2]) square([r*cos(a/2),t]);
}
A = [0,0];
B = [r*cos(a/2), r*sin(a/2)];
C = [r*cos(a/2), 0];
D = [r*cos(a/2), -r*sin(a/2)];
color("black") translate([0,0,3]) {
translate(A) label("A");
translate(B) label("B");
translate(C) label("C");
translate(D) label("D");
}
```

Come to think of it, I could have positioned B and D by translating them

out to X=+r and then rotating, rather than by calculating the

coordinates. (Rotation to restore them to being upright left as an

exercise for the reader.) I can't immediately think of a non-trig way

to position C.

BTW, if anybody is curious here's the OpenSCAD program that generated
that diagram. It's got some examples of using trig to position and size
things.
n = 3;
t = 2;
r = 100;
a = 360/n;
module label(t) { text(t, halign="center", valign="center"); }
circle(r=r);
color("gray") rotate(180) translate([0,0,1]) circle(r=r, $fn=n);
color("white") translate([0,0,2]) {
rotate(a/2) translate([0,-t/2]) square([r,t]);
rotate(-a/2) translate([0,-t/2]) square([r,t]);
translate([0,-t/2]) square([r*cos(a/2),t]);
}
A = [0,0];
B = [r*cos(a/2), r*sin(a/2)];
C = [r*cos(a/2), 0];
D = [r*cos(a/2), -r*sin(a/2)];
color("black") translate([0,0,3]) {
translate(A) label("A");
translate(B) label("B");
translate(C) label("C");
translate(D) label("D");
}
Come to think of it, I could have positioned B and D by translating them
out to X=+r and then rotating, rather than by calculating the
coordinates. (Rotation to restore them to being upright left as an
exercise for the reader.) I can't immediately think of a non-trig way
to position C.

K

Ken

Wed, May 24, 2023 11:35 AM

Thanks Jordan, that piece of code's a keeper- besides the circumscribed

circle, it also neatly give the radius of the inscribed circle as well.

On 2023-05-24 10:02, Jordan Brown wrote:

BTW, if anybody is curious here's the OpenSCAD program that generated

that diagram. It's got some examples of using trig to position and

size things.

```
n = 3;
t = 2;
r = 100;
a = 360/n;
module label(t) { text(t, halign="center", valign="center"); }
circle(r=r);
color("gray") rotate(180) translate([0,0,1]) circle(r=r, $fn=n);
color("white") translate([0,0,2]) {
rotate(a/2) translate([0,-t/2]) square([r,t]);
rotate(-a/2) translate([0,-t/2]) square([r,t]);
translate([0,-t/2]) square([r*cos(a/2),t]);
}
A = [0,0];
B = [r*cos(a/2), r*sin(a/2)];
C = [r*cos(a/2), 0];
D = [r*cos(a/2), -r*sin(a/2)];
color("black") translate([0,0,3]) {
translate(A) label("A");
translate(B) label("B");
translate(C) label("C");
translate(D) label("D");
}
```

Come to think of it, I could have positioned B and D by translating

them out to X=+r and then rotating, rather than by calculating the

coordinates. (Rotation to restore them to being upright left as an

exercise for the reader.) I can't immediately think of a non-trig way

to position C.

OpenSCAD mailing list

To unsubscribe send an email todiscuss-leave@lists.openscad.org

Cheers, Ken

bats059@gmail.com

https://vk7krj.com

https://vk7krj.com/running.html

A baby can be defined as an ego with a noise at one end and a smell at the other.

Your job as parents is to teach them to control all three.

My job as a grandad is to tell you how you are doing it all wrong!

Thanks Jordan, that piece of code's a keeper- besides the circumscribed
circle, it also neatly give the radius of the inscribed circle as well.
On 2023-05-24 10:02, Jordan Brown wrote:
> BTW, if anybody is curious here's the OpenSCAD program that generated
> that diagram. It's got some examples of using trig to position and
> size things.
>
> n = 3;
> t = 2;
> r = 100;
> a = 360/n;
>
> module label(t) { text(t, halign="center", valign="center"); }
>
> circle(r=r);
> color("gray") rotate(180) translate([0,0,1]) circle(r=r, $fn=n);
> color("white") translate([0,0,2]) {
> rotate(a/2) translate([0,-t/2]) square([r,t]);
> rotate(-a/2) translate([0,-t/2]) square([r,t]);
> translate([0,-t/2]) square([r*cos(a/2),t]);
> }
>
> A = [0,0];
> B = [r*cos(a/2), r*sin(a/2)];
> C = [r*cos(a/2), 0];
> D = [r*cos(a/2), -r*sin(a/2)];
> color("black") translate([0,0,3]) {
> translate(A) label("A");
> translate(B) label("B");
> translate(C) label("C");
> translate(D) label("D");
> }
>
> Come to think of it, I could have positioned B and D by translating
> them out to X=+r and then rotating, rather than by calculating the
> coordinates. (Rotation to restore them to being upright left as an
> exercise for the reader.) I can't immediately think of a non-trig way
> to position C.
>
>
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email todiscuss-leave@lists.openscad.org
--
Cheers, Ken
bats059@gmail.com
https://vk7krj.com
https://vk7krj.com/running.html
----------------------------------------
A baby can be defined as an ego with a noise at one end and a smell at the other.
Your job as parents is to teach them to control all three.
My job as a grandad is to tell you how you are doing it all wrong!

Replying to:

Empathy v1.0
2024 ©Harmonylists.com