discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Simple trigonometry problem (I think I should go back to school)

VB
Verachten Bruno
Thu, Nov 26, 2020 3:17 PM

Hello,

It has been a while since I touched OpenScad. I'm starting from
scratch once again, I forgot everything.
I'm trying to "design" simple brackets and drill templates for PCBs.
Following https://hackaday.com/2018/02/13/openscad-tieing-it-together-with-hull/
precepts, I define my points, make cylinders, holes and then hull to
stitch everything together.
The problem I'm facing right now is that I get my trigo wrong. I don't
think it's OpenScad, it's maybe a bad understanding of what I'm
supposed to do with the atan function.
I have four holes, forming a rectangle. I have then four feets. I'm
trying to join 2 feet by a diagonal cylinder. So I'm dividing the
opposite side by the adjacent side, and applying atan() on the result,
to hopefully find the angle I'm supposed to use in rotate().
Unfortunately, that does not fit correctly, I'm a few degrees wrong.
I know it's stupid and I'm rusted with OpenScad and trigonometry, but
if anyone could point me in the right direction, that could help.

Thanks in advance,

feet = [[0,0,0], [42.11,0,0], [0,40.11,0], [42.11,40.11,0]];
holeSize = 3;
baseSize = 9;
footSize = 5;
baseHeight = 3;
totalHeight = 7;
linkThickness = 3;
linkHeight = 2;

feet(feet,holeSize, baseSize, baseHeight, totalHeight);
link(feet, linkThickness, linkHeight);

module foot(point, holeSize, baseSize, baseHeight, totalHeight) {
difference() {
union()  {
hull() {
cylinder(r=baseSize/2, h=baseHeight, $fn=100);
translate([0,0,(totalHeight - baseHeight)/2])
cylinder(r=footSize/2, h=baseHeight, $fn=100);
}
translate([0,0,totalHeight - baseHeight])
cylinder(r=footSize/2, h=baseHeight, $fn=100);
}
color("red") translate([0,0,-0.5]) cylinder(r=holeSize/2,
h=totalHeight+1, $fn=100);
}
}

module feet(points,holeSize, baseSize, baseHeight, totalHeight) {
for (point = points) {
translate (point) foot(point, holeSize, baseSize, baseHeight,
totalHeight);
}
}

module link(points, thickness, height) {
firstSide = points[1][0] - points[0][0];
secondSide = points[3][1] - points[0][0];
length = sqrt(pow(firstSide,2) + pow(secondSide,2));
tan = secondSide/firstSide;
atan = atan(secondSide/firstSide);
echo ("tan is", tan, " and atan is ", atan);
//360-atan(tan)
color("blue") translate([0,0,height*2]) rotate([270,0,-atan])
cylinder(h=length, r=thickness/2, center=false, $fn=100);
}

Bruno Verachten

Hello, It has been a while since I touched OpenScad. I'm starting from scratch once again, I forgot everything. I'm trying to "design" simple brackets and drill templates for PCBs. Following https://hackaday.com/2018/02/13/openscad-tieing-it-together-with-hull/ precepts, I define my points, make cylinders, holes and then hull to stitch everything together. The problem I'm facing right now is that I get my trigo wrong. I don't think it's OpenScad, it's maybe a bad understanding of what I'm supposed to do with the atan function. I have four holes, forming a rectangle. I have then four feets. I'm trying to join 2 feet by a diagonal cylinder. So I'm dividing the opposite side by the adjacent side, and applying atan() on the result, to hopefully find the angle I'm supposed to use in rotate(). Unfortunately, that does not fit correctly, I'm a few degrees wrong. I know it's stupid and I'm rusted with OpenScad and trigonometry, but if anyone could point me in the right direction, that could help. Thanks in advance, feet = [[0,0,0], [42.11,0,0], [0,40.11,0], [42.11,40.11,0]]; holeSize = 3; baseSize = 9; footSize = 5; baseHeight = 3; totalHeight = 7; linkThickness = 3; linkHeight = 2; feet(feet,holeSize, baseSize, baseHeight, totalHeight); link(feet, linkThickness, linkHeight); module foot(point, holeSize, baseSize, baseHeight, totalHeight) { difference() { union() { hull() { cylinder(r=baseSize/2, h=baseHeight, $fn=100); translate([0,0,(totalHeight - baseHeight)/2]) cylinder(r=footSize/2, h=baseHeight, $fn=100); } translate([0,0,totalHeight - baseHeight]) cylinder(r=footSize/2, h=baseHeight, $fn=100); } color("red") translate([0,0,-0.5]) cylinder(r=holeSize/2, h=totalHeight+1, $fn=100); } } module feet(points,holeSize, baseSize, baseHeight, totalHeight) { for (point = points) { translate (point) foot(point, holeSize, baseSize, baseHeight, totalHeight); } } module link(points, thickness, height) { firstSide = points[1][0] - points[0][0]; secondSide = points[3][1] - points[0][0]; length = sqrt(pow(firstSide,2) + pow(secondSide,2)); tan = secondSide/firstSide; atan = atan(secondSide/firstSide); echo ("tan is", tan, " and atan is ", atan); //360-atan(tan) color("blue") translate([0,0,height*2]) rotate([270,0,-atan]) cylinder(h=length, r=thickness/2, center=false, $fn=100); } -- Bruno Verachten
A
adrianv
Thu, Nov 26, 2020 3:34 PM

Your problem with the trigonometry is you have the argument to atan inverted.
It should be atan(firstSide/secondSide).

Another consideration if you prefer not to work hard doing trigonometry is
to use a library such as BOSL2 where you could do

include<BOSL2/std.scad>

module link(points,thickness,height)
up(height*2) stroke([points[0],points[3]],
width=thickness,endcaps="butt",$fn=100);

to get the same result without trig.  Many folks seem to delight in working
out the trigonometry for their models, but even though I know trigonometry
well, I feel it is easier and better to have the computer do it for me.

gounthar wrote

Hello,

It has been a while since I touched OpenScad. I'm starting from
scratch once again, I forgot everything.
I'm trying to "design" simple brackets and drill templates for PCBs.
Following
https://hackaday.com/2018/02/13/openscad-tieing-it-together-with-hull/
precepts, I define my points, make cylinders, holes and then hull to
stitch everything together.
The problem I'm facing right now is that I get my trigo wrong. I don't
think it's OpenScad, it's maybe a bad understanding of what I'm
supposed to do with the atan function.
I have four holes, forming a rectangle. I have then four feets. I'm
trying to join 2 feet by a diagonal cylinder. So I'm dividing the
opposite side by the adjacent side, and applying atan() on the result,
to hopefully find the angle I'm supposed to use in rotate().
Unfortunately, that does not fit correctly, I'm a few degrees wrong.
I know it's stupid and I'm rusted with OpenScad and trigonometry, but
if anyone could point me in the right direction, that could help.

Thanks in advance,

feet = [[0,0,0], [42.11,0,0], [0,40.11,0], [42.11,40.11,0]];
holeSize = 3;
baseSize = 9;
footSize = 5;
baseHeight = 3;
totalHeight = 7;
linkThickness = 3;
linkHeight = 2;

feet(feet,holeSize, baseSize, baseHeight, totalHeight);
link(feet, linkThickness, linkHeight);

module foot(point, holeSize, baseSize, baseHeight, totalHeight) {
difference() {
union()  {
hull() {
cylinder(r=baseSize/2, h=baseHeight, $fn=100);
translate([0,0,(totalHeight - baseHeight)/2])
cylinder(r=footSize/2, h=baseHeight, $fn=100);
}
translate([0,0,totalHeight - baseHeight])
cylinder(r=footSize/2, h=baseHeight, $fn=100);
}
color("red") translate([0,0,-0.5]) cylinder(r=holeSize/2,
h=totalHeight+1, $fn=100);
}
}

module feet(points,holeSize, baseSize, baseHeight, totalHeight) {
for (point = points) {
translate (point) foot(point, holeSize, baseSize, baseHeight,
totalHeight);
}
}

module link(points, thickness, height) {
firstSide = points[1][0] - points[0][0];
secondSide = points[3][1] - points[0][0];
length = sqrt(pow(firstSide,2) + pow(secondSide,2));
tan = secondSide/firstSide;
atan = atan(secondSide/firstSide);
echo ("tan is", tan, " and atan is ", atan);
//360-atan(tan)
color("blue") translate([0,0,height*2]) rotate([270,0,-atan])
cylinder(h=length, r=thickness/2, center=false, $fn=100);
}

Bruno Verachten


OpenSCAD mailing list

Discuss@.openscad

Your problem with the trigonometry is you have the argument to atan inverted. It should be atan(firstSide/secondSide). Another consideration if you prefer not to work hard doing trigonometry is to use a library such as BOSL2 where you could do include<BOSL2/std.scad> module link(points,thickness,height) up(height*2) stroke([points[0],points[3]], width=thickness,endcaps="butt",$fn=100); to get the same result without trig. Many folks seem to delight in working out the trigonometry for their models, but even though I know trigonometry well, I feel it is easier and better to have the computer do it for me. gounthar wrote > Hello, > > It has been a while since I touched OpenScad. I'm starting from > scratch once again, I forgot everything. > I'm trying to "design" simple brackets and drill templates for PCBs. > Following > https://hackaday.com/2018/02/13/openscad-tieing-it-together-with-hull/ > precepts, I define my points, make cylinders, holes and then hull to > stitch everything together. > The problem I'm facing right now is that I get my trigo wrong. I don't > think it's OpenScad, it's maybe a bad understanding of what I'm > supposed to do with the atan function. > I have four holes, forming a rectangle. I have then four feets. I'm > trying to join 2 feet by a diagonal cylinder. So I'm dividing the > opposite side by the adjacent side, and applying atan() on the result, > to hopefully find the angle I'm supposed to use in rotate(). > Unfortunately, that does not fit correctly, I'm a few degrees wrong. > I know it's stupid and I'm rusted with OpenScad and trigonometry, but > if anyone could point me in the right direction, that could help. > > Thanks in advance, > > > feet = [[0,0,0], [42.11,0,0], [0,40.11,0], [42.11,40.11,0]]; > holeSize = 3; > baseSize = 9; > footSize = 5; > baseHeight = 3; > totalHeight = 7; > linkThickness = 3; > linkHeight = 2; > > feet(feet,holeSize, baseSize, baseHeight, totalHeight); > link(feet, linkThickness, linkHeight); > > module foot(point, holeSize, baseSize, baseHeight, totalHeight) { > difference() { > union() { > hull() { > cylinder(r=baseSize/2, h=baseHeight, $fn=100); > translate([0,0,(totalHeight - baseHeight)/2]) > cylinder(r=footSize/2, h=baseHeight, $fn=100); > } > translate([0,0,totalHeight - baseHeight]) > cylinder(r=footSize/2, h=baseHeight, $fn=100); > } > color("red") translate([0,0,-0.5]) cylinder(r=holeSize/2, > h=totalHeight+1, $fn=100); > } > } > > module feet(points,holeSize, baseSize, baseHeight, totalHeight) { > for (point = points) { > translate (point) foot(point, holeSize, baseSize, baseHeight, > totalHeight); > } > } > > module link(points, thickness, height) { > firstSide = points[1][0] - points[0][0]; > secondSide = points[3][1] - points[0][0]; > length = sqrt(pow(firstSide,2) + pow(secondSide,2)); > tan = secondSide/firstSide; > atan = atan(secondSide/firstSide); > echo ("tan is", tan, " and atan is ", atan); > //360-atan(tan) > color("blue") translate([0,0,height*2]) rotate([270,0,-atan]) > cylinder(h=length, r=thickness/2, center=false, $fn=100); > } > -- > Bruno Verachten > > _______________________________________________ > OpenSCAD mailing list > Discuss@.openscad > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- Sent from: http://forum.openscad.org/
R
rickan
Thu, Nov 26, 2020 3:55 PM

Another method not involving atan (or a library) (I think quaternions are
easier):

feet = [[0,0,0], [42.11,0,0], [0,40.11,0], [42.11,40.11,0]];
holeSize = 3;
baseSize = 9;
footSize = 5;
baseHeight = 3;
totalHeight = 7;
linkThickness = 3;
linkHeight = 2;

feet(feet,holeSize, baseSize, baseHeight, totalHeight);
link(feet, linkThickness, linkHeight);

module foot(point, holeSize, baseSize, baseHeight, totalHeight) {
difference() {
union()  {
hull() {
cylinder(r=baseSize/2, h=baseHeight, $fn=100);
translate([0,0,(totalHeight - baseHeight)/2])
cylinder(r=footSize/2, h=baseHeight, $fn=100);
}
translate([0,0,totalHeight - baseHeight])
cylinder(r=footSize/2, h=baseHeight, $fn=100);
}
color("red") translate([0,0,-0.5]) cylinder(r=holeSize/2,
h=totalHeight+1, $fn=100);
}
}

module feet(points,holeSize, baseSize, baseHeight, totalHeight) {
for (point = points) {
translate (point) foot(point, holeSize, baseSize, baseHeight,
totalHeight);
}
}

module link(points, thickness, height) {
firstSide = points[1][0] - points[0][0];
secondSide = points[3][1] - points[0][0];
length = sqrt(pow(firstSide,2) + pow(secondSide,2));
tan = secondSide/firstSide;
atan = atan(secondSide/firstSide);
echo ("tan is", tan, " and atan is ", atan);
//360-atan(tan)
color("blue")
translate([0,0,height*2])
rotate(-90, [secondSide/length, -firstSide/length, 0])
cylinder(h=length, r=thickness/2, center=false, $fn=100);
}

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

Another method not involving atan (or a library) (I think quaternions are easier): feet = [[0,0,0], [42.11,0,0], [0,40.11,0], [42.11,40.11,0]]; holeSize = 3; baseSize = 9; footSize = 5; baseHeight = 3; totalHeight = 7; linkThickness = 3; linkHeight = 2; feet(feet,holeSize, baseSize, baseHeight, totalHeight); link(feet, linkThickness, linkHeight); module foot(point, holeSize, baseSize, baseHeight, totalHeight) { difference() { union() { hull() { cylinder(r=baseSize/2, h=baseHeight, $fn=100); translate([0,0,(totalHeight - baseHeight)/2]) cylinder(r=footSize/2, h=baseHeight, $fn=100); } translate([0,0,totalHeight - baseHeight]) cylinder(r=footSize/2, h=baseHeight, $fn=100); } color("red") translate([0,0,-0.5]) cylinder(r=holeSize/2, h=totalHeight+1, $fn=100); } } module feet(points,holeSize, baseSize, baseHeight, totalHeight) { for (point = points) { translate (point) foot(point, holeSize, baseSize, baseHeight, totalHeight); } } module link(points, thickness, height) { firstSide = points[1][0] - points[0][0]; secondSide = points[3][1] - points[0][0]; length = sqrt(pow(firstSide,2) + pow(secondSide,2)); tan = secondSide/firstSide; atan = atan(secondSide/firstSide); echo ("tan is", tan, " and atan is ", atan); //360-atan(tan) color("blue") translate([0,0,height*2]) rotate(-90, [secondSide/length, -firstSide/length, 0]) cylinder(h=length, r=thickness/2, center=false, $fn=100); } -- Sent from: http://forum.openscad.org/
A
arnholm@arnholm.org
Thu, Nov 26, 2020 3:55 PM

On 2020-11-26 16:17, Verachten Bruno wrote:

I have four holes, forming a rectangle. I have then four feets. I'm
trying to join 2 feet by a diagonal cylinder. So I'm dividing the
opposite side by the adjacent side, and applying atan() on the result,
to hopefully find the angle I'm supposed to use in rotate().
Unfortunately, that does not fit correctly, I'm a few degrees wrong.

There is no need to use trigonometric functions for something like this.
Try this to replace your link

module link(points, thickness, height) {
pdx = points[3][0] - points[0][0];
pdy = points[3][1] - points[0][1];
length = sqrt(pow(pdx,2) + pow(pdy,2));
dx = pdx/length;
dy = pdy/length;
color("blue")
translate([0,0,height*2])
multmatrix([[dx,-dy,0,0],[dy,dx,0,0],[0,0,1,0],[0,0,0,1]])
rotate([0,90,0])
cylinder(h=length, r=thickness/2, center=false, $fn=100);
}

You already have the direction cosines, so you just need to apply them.

Carsten Arnholm

On 2020-11-26 16:17, Verachten Bruno wrote: > I have four holes, forming a rectangle. I have then four feets. I'm > trying to join 2 feet by a diagonal cylinder. So I'm dividing the > opposite side by the adjacent side, and applying atan() on the result, > to hopefully find the angle I'm supposed to use in rotate(). > Unfortunately, that does not fit correctly, I'm a few degrees wrong. There is no need to use trigonometric functions for something like this. Try this to replace your link module link(points, thickness, height) { pdx = points[3][0] - points[0][0]; pdy = points[3][1] - points[0][1]; length = sqrt(pow(pdx,2) + pow(pdy,2)); dx = pdx/length; dy = pdy/length; color("blue") translate([0,0,height*2]) multmatrix([[dx,-dy,0,0],[dy,dx,0,0],[0,0,1,0],[0,0,0,1]]) rotate([0,90,0]) cylinder(h=length, r=thickness/2, center=false, $fn=100); } You already have the direction cosines, so you just need to apply them. Carsten Arnholm
VB
Verachten Bruno
Thu, Nov 26, 2020 4:36 PM

That was quick!
Thanks a lot for pointing out my obvious (but not to me at the time of
coding) mistake and for the links and other ways of doing this.
I now have a working bracket design.
I'm a happy camper.
See you soon for another stupid question. ;-)

On Thu, Nov 26, 2020 at 4:55 PM rickan richard@kandarian.com wrote:

Another method not involving atan (or a library) (I think quaternions are
easier):

feet = [[0,0,0], [42.11,0,0], [0,40.11,0], [42.11,40.11,0]];
holeSize = 3;
baseSize = 9;
footSize = 5;
baseHeight = 3;
totalHeight = 7;
linkThickness = 3;
linkHeight = 2;

feet(feet,holeSize, baseSize, baseHeight, totalHeight);
link(feet, linkThickness, linkHeight);

module foot(point, holeSize, baseSize, baseHeight, totalHeight) {
difference() {
union()  {
hull() {
cylinder(r=baseSize/2, h=baseHeight, $fn=100);
translate([0,0,(totalHeight - baseHeight)/2])
cylinder(r=footSize/2, h=baseHeight, $fn=100);
}
translate([0,0,totalHeight - baseHeight])
cylinder(r=footSize/2, h=baseHeight, $fn=100);
}
color("red") translate([0,0,-0.5]) cylinder(r=holeSize/2,
h=totalHeight+1, $fn=100);
}
}

module feet(points,holeSize, baseSize, baseHeight, totalHeight) {
for (point = points) {
translate (point) foot(point, holeSize, baseSize, baseHeight,
totalHeight);
}
}

module link(points, thickness, height) {
firstSide = points[1][0] - points[0][0];
secondSide = points[3][1] - points[0][0];
length = sqrt(pow(firstSide,2) + pow(secondSide,2));
tan = secondSide/firstSide;
atan = atan(secondSide/firstSide);
echo ("tan is", tan, " and atan is ", atan);
//360-atan(tan)
color("blue")
translate([0,0,height*2])
rotate(-90, [secondSide/length, -firstSide/length, 0])
cylinder(h=length, r=thickness/2, center=false, $fn=100);
}

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


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

--
Bruno Verachten

That was quick! Thanks a lot for pointing out my obvious (but not to me at the time of coding) mistake and for the links and other ways of doing this. I now have a working bracket design. I'm a happy camper. See you soon for another stupid question. ;-) On Thu, Nov 26, 2020 at 4:55 PM rickan <richard@kandarian.com> wrote: > > Another method not involving atan (or a library) (I think quaternions are > easier): > > feet = [[0,0,0], [42.11,0,0], [0,40.11,0], [42.11,40.11,0]]; > holeSize = 3; > baseSize = 9; > footSize = 5; > baseHeight = 3; > totalHeight = 7; > linkThickness = 3; > linkHeight = 2; > > feet(feet,holeSize, baseSize, baseHeight, totalHeight); > link(feet, linkThickness, linkHeight); > > module foot(point, holeSize, baseSize, baseHeight, totalHeight) { > difference() { > union() { > hull() { > cylinder(r=baseSize/2, h=baseHeight, $fn=100); > translate([0,0,(totalHeight - baseHeight)/2]) > cylinder(r=footSize/2, h=baseHeight, $fn=100); > } > translate([0,0,totalHeight - baseHeight]) > cylinder(r=footSize/2, h=baseHeight, $fn=100); > } > color("red") translate([0,0,-0.5]) cylinder(r=holeSize/2, > h=totalHeight+1, $fn=100); > } > } > > module feet(points,holeSize, baseSize, baseHeight, totalHeight) { > for (point = points) { > translate (point) foot(point, holeSize, baseSize, baseHeight, > totalHeight); > } > } > > module link(points, thickness, height) { > firstSide = points[1][0] - points[0][0]; > secondSide = points[3][1] - points[0][0]; > length = sqrt(pow(firstSide,2) + pow(secondSide,2)); > tan = secondSide/firstSide; > atan = atan(secondSide/firstSide); > echo ("tan is", tan, " and atan is ", atan); > //360-atan(tan) > color("blue") > translate([0,0,height*2]) > rotate(-90, [secondSide/length, -firstSide/length, 0]) > cylinder(h=length, r=thickness/2, center=false, $fn=100); > } > > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- Bruno Verachten
A
arnholm@arnholm.org
Thu, Nov 26, 2020 4:39 PM

On 2020-11-26 16:55, arnholm@arnholm.org wrote:

On 2020-11-26 16:17, Verachten Bruno wrote:

I have four holes, forming a rectangle. I have then four feets. I'm
trying to join 2 feet by a diagonal cylinder. So I'm dividing the
opposite side by the adjacent side, and applying atan() on the result,
to hopefully find the angle I'm supposed to use in rotate().
Unfortunately, that does not fit correctly, I'm a few degrees wrong.

There is no need to use trigonometric functions for something like
this. Try this to replace your link

module link(points, thickness, height) {
pdx = points[3][0] - points[0][0];
pdy = points[3][1] - points[0][1];
length = sqrt(pow(pdx,2) + pow(pdy,2));
dx = pdx/length;
dy = pdy/length;
color("blue")
translate([0,0,height*2])
multmatrix([[dx,-dy,0,0],[dy,dx,0,0],[0,0,1,0],[0,0,0,1]])
rotate([0,90,0])
cylinder(h=length, r=thickness/2, center=false, $fn=100);
}

Obviously, you could optimize it and avoid separate rotation &
translation:

module link(points, thickness, height) {
pdx = points[3][0] - points[0][0];
pdy = points[3][1] - points[0][1];
length = sqrt(pow(pdx,2) + pow(pdy,2));
dx = pdx/length;
dy = pdy/length;
color("blue")
multmatrix([[0,-dy,dx,0],[0,dx,dy,0],[-1,0,0,height*2],[0,0,0,1]])
cylinder(h=length, r=thickness/2, center=false, $fn=100);
}

Carsten Arholm

On 2020-11-26 16:55, arnholm@arnholm.org wrote: > On 2020-11-26 16:17, Verachten Bruno wrote: >> I have four holes, forming a rectangle. I have then four feets. I'm >> trying to join 2 feet by a diagonal cylinder. So I'm dividing the >> opposite side by the adjacent side, and applying atan() on the result, >> to hopefully find the angle I'm supposed to use in rotate(). >> Unfortunately, that does not fit correctly, I'm a few degrees wrong. > > There is no need to use trigonometric functions for something like > this. Try this to replace your link > > module link(points, thickness, height) { > pdx = points[3][0] - points[0][0]; > pdy = points[3][1] - points[0][1]; > length = sqrt(pow(pdx,2) + pow(pdy,2)); > dx = pdx/length; > dy = pdy/length; > color("blue") > translate([0,0,height*2]) > multmatrix([[dx,-dy,0,0],[dy,dx,0,0],[0,0,1,0],[0,0,0,1]]) > rotate([0,90,0]) > cylinder(h=length, r=thickness/2, center=false, $fn=100); > } Obviously, you could optimize it and avoid separate rotation & translation: module link(points, thickness, height) { pdx = points[3][0] - points[0][0]; pdy = points[3][1] - points[0][1]; length = sqrt(pow(pdx,2) + pow(pdy,2)); dx = pdx/length; dy = pdy/length; color("blue") multmatrix([[0,-dy,dx,0],[0,dx,dy,0],[-1,0,0,height*2],[0,0,0,1]]) cylinder(h=length, r=thickness/2, center=false, $fn=100); } Carsten Arholm