discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Loomis Heads

RW
Ray West
Fri, Mar 5, 2021 1:33 PM

Although 'Blender' is often recommended for modelling the human or other
natural forms, i am wondering if anyone has tried modelling faces in
openscad, using the Loomis method, or similar. I am not considering
photographic accuracy, but in sufficient detail to give some variation
to model figures, say. I think a representative face could be
constructed, from modules, relatively easily, and the individual modules
could be detailed as needed. It could be useful if there was a
transformation, such as 'hull()' but one in which the surface could be
altered in regions to more closely follow the underlying shapes, to sort
of smooth the internal corners.

Although 'Blender' is often recommended for modelling the human or other natural forms, i am wondering if anyone has tried modelling faces in openscad, using the Loomis method, or similar. I am not considering photographic accuracy, but in sufficient detail to give some variation to model figures, say. I think a representative face could be constructed, from modules, relatively easily, and the individual modules could be detailed as needed. It could be useful if there was a transformation, such as 'hull()' but one in which the surface could be altered in regions to more closely follow the underlying shapes, to sort of smooth the internal corners.
JB
Jordan Brown
Sat, Mar 6, 2021 12:18 AM

https://en.wikipedia.org/wiki/Andrew_Loomis
https://www.amazon.com/Drawing-Head-Hands-Andrew-Loomis/dp/0857680978
https://www.alexhays.com/loomis/Andrew%20Loomis%20-%20Drawing%20the%20Head%20and%20Hands.pdf

Fascinating.

Yes, I think that's entirely practical.

I'm an engineer, not an artist.  The process of producing
realistic-looking drawings of organic things has always been a total
mystery to me.  This, on the other hand, is a geometric approach to the
problem.  Coupled with curved-surface tools - Bezier patches, perhaps -
it seems like it would be totally amenable to use in OpenSCAD.

And, of course, if you do it right it'd all be parameterized.  Tweak a
number, and the head gets a little wider at the top.

https://en.wikipedia.org/wiki/Andrew_Loomis https://www.amazon.com/Drawing-Head-Hands-Andrew-Loomis/dp/0857680978 https://www.alexhays.com/loomis/Andrew%20Loomis%20-%20Drawing%20the%20Head%20and%20Hands.pdf Fascinating. Yes, I think that's entirely practical. I'm an engineer, not an artist.  The process of producing realistic-looking drawings of organic things has always been a total mystery to me.  This, on the other hand, is a geometric approach to the problem.  Coupled with curved-surface tools - Bezier patches, perhaps - it seems like it would be totally amenable to use in OpenSCAD. And, of course, if you do it right it'd all be parameterized.  Tweak a number, and the head gets a little wider at the top.
BL
Bryan Lee
Sat, Mar 6, 2021 12:36 AM

I had a similar question a couple months ago and was directed to the "Make
Human" project.

It does exactly what you describe: human figure with parameters to tweak
body style.
It filled my needs, though I'm still trying to figure out how to adjust a
pose in Blender for import.

Thus Jordan Brown hast written on Sat, Mar 06, 2021 at 12:18:30AM +0000, and, according to prophecy, it shall come to pass that:

I'm an engineer, not an artist.  The process of producing realistic-looking
drawings of organic things has always been a total mystery to me.  This, on the
other hand, is a geometric approach to the problem.  Coupled with
curved-surface tools - Bezier patches, perhaps - it seems like it would be
totally amenable to use in OpenSCAD.

And, of course, if you do it right it'd all be parameterized.  Tweak a number,
and the head gets a little wider at the top.

I had a similar question a couple months ago and was directed to the "Make Human" project. It does exactly what you describe: human figure with parameters to tweak body style. It filled my needs, though I'm still trying to figure out how to adjust a pose in Blender for import. Thus Jordan Brown hast written on Sat, Mar 06, 2021 at 12:18:30AM +0000, and, according to prophecy, it shall come to pass that: > I'm an engineer, not an artist.  The process of producing realistic-looking > drawings of organic things has always been a total mystery to me.  This, on the > other hand, is a geometric approach to the problem.  Coupled with > curved-surface tools - Bezier patches, perhaps - it seems like it would be > totally amenable to use in OpenSCAD. > > And, of course, if you do it right it'd all be parameterized.  Tweak a number, > and the head gets a little wider at the top.
JB
Jordan Brown
Sat, Mar 6, 2021 1:57 AM

On 3/5/2021 4:36 PM, Bryan Lee wrote:

I had a similar question a couple months ago and was directed to the "Make
Human" project.

Now all somebody needs to do is to port their models from Python to
OpenSCAD :-)

On 3/5/2021 4:36 PM, Bryan Lee wrote: > I had a similar question a couple months ago and was directed to the "Make > Human" project. Now all somebody needs to do is to port their models from Python to OpenSCAD :-)
RW
Ray West
Sat, Mar 6, 2021 4:02 PM

From 60 years ago, i remember using these
https://n.stuccu.co.uk/s/Artist+Manikin in 'A level' art, and a few
rules wrt drawing faces - eyes halfway up face, bottom of nose half way
'twixt eyes and chin, so I'm thinking along the lines of facial feature
additions (like Mr. Potato Head, or as now, just gender neutral  'Potato
Head')  and then pose the manikin and drape over clothing. Hair could be
awkward, but baseball caps could help there, initially.

I think, based on a Loomis type construction set, my initial thought is
to have the cranium sphere at a size of 1000 units, which would most
likely allow integer values for details of ear lobes/whatever. If it has
to look realistic, then there will need to be some controllable curve
blending/contouring, which I've always found tricky in openscad, and
most other cad packages too. Ideally the ability to simply to push
things around, as in using modelling clay would be useful, but nothing
in openscad is manipulated in that way, afaik. However, with the correct
choice of values, then that will not be needed so much.

Although it would be nice to construct a face from spheres and other
basic shapes, I believe that eye sockets and lips would be awkward, and
instead it may be simpler to combine a few  extruded cross sections, but
I would consider that, and using polygons as cheating.

Could be fun!

On 06/03/2021 00:18, Jordan Brown wrote:

https://en.wikipedia.org/wiki/Andrew_Loomis
https://www.amazon.com/Drawing-Head-Hands-Andrew-Loomis/dp/0857680978
https://www.alexhays.com/loomis/Andrew%20Loomis%20-%20Drawing%20the%20Head%20and%20Hands.pdf

Fascinating.

Yes, I think that's entirely practical.

I'm an engineer, not an artist.  The process of producing
realistic-looking drawings of organic things has always been a total
mystery to me.  This, on the other hand, is a geometric approach to
the problem.  Coupled with curved-surface tools - Bezier patches,
perhaps - it seems like it would be totally amenable to use in OpenSCAD.

And, of course, if you do it right it'd all be parameterized. Tweak a
number, and the head gets a little wider at the top.

From 60 years ago, i remember using these https://n.stuccu.co.uk/s/Artist+Manikin in 'A level' art, and a few rules wrt drawing faces - eyes halfway up face, bottom of nose half way 'twixt eyes and chin, so I'm thinking along the lines of facial feature additions (like Mr. Potato Head, or as now, just gender neutral  'Potato Head')  and then pose the manikin and drape over clothing. Hair could be awkward, but baseball caps could help there, initially. I think, based on a Loomis type construction set, my initial thought is to have the cranium sphere at a size of 1000 units, which would most likely allow integer values for details of ear lobes/whatever. If it has to look realistic, then there will need to be some controllable curve blending/contouring, which I've always found tricky in openscad, and most other cad packages too. Ideally the ability to simply to push things around, as in using modelling clay would be useful, but nothing in openscad is manipulated in that way, afaik. However, with the correct choice of values, then that will not be needed so much. Although it would be nice to construct a face from spheres and other basic shapes, I believe that eye sockets and lips would be awkward, and instead it may be simpler to combine a few  extruded cross sections, but I would consider that, and using polygons as cheating. Could be fun! On 06/03/2021 00:18, Jordan Brown wrote: > https://en.wikipedia.org/wiki/Andrew_Loomis > https://www.amazon.com/Drawing-Head-Hands-Andrew-Loomis/dp/0857680978 > https://www.alexhays.com/loomis/Andrew%20Loomis%20-%20Drawing%20the%20Head%20and%20Hands.pdf > > Fascinating. > > Yes, I think that's entirely practical. > > I'm an engineer, not an artist.  The process of producing > realistic-looking drawings of organic things has always been a total > mystery to me.  This, on the other hand, is a geometric approach to > the problem.  Coupled with curved-surface tools - Bezier patches, > perhaps - it seems like it would be totally amenable to use in OpenSCAD. > > And, of course, if you do it right it'd all be parameterized. Tweak a > number, and the head gets a little wider at the top. >
RW
Ray West
Sat, Mar 6, 2021 9:36 PM

From 60 years ago, i remember using these
https://n.stuccu.co.uk/s/Artist+Manikin in 'A level' art, and a few
rules wrt drawing faces - eyes halfway up face, bottom of nose half way
'twixt eyes and chin, so I'm thinking along the lines of facial feature
additions (like Mr. Potato Head, or as now, just gender neutral  'Potato
Head')  and then pose the manikin and drape over clothing. Hair could be
awkward, but baseball caps could help there, initially.

I think, based on a Loomis type construction set, my initial thought is
to have the cranium sphere at a size of 1000 units, which would most
likely allow integer values for details of ear lobes/whatever. If it has
to look realistic, then there will need to be some controllable curve
blending/contouring, which I've always found tricky in openscad, and
most other cad packages too. Ideally the ability to simply to push
things around, as in using modelling clay would be useful, but nothing
in openscad is manipulated in that way, afaik. However, with the correct
choice of values, then that will not be needed so much.

Although it would be nice to construct a face from spheres and other
basic shapes, I believe that eye sockets and lips would be awkward, and
instead it may be simpler to combine a few  extruded cross sections, but
I would consider that, and using polygons as cheating.

Could be fun!

On 06/03/2021 00:18, Jordan Brown wrote:

https://en.wikipedia.org/wiki/Andrew_Loomis
https://www.amazon.com/Drawing-Head-Hands-Andrew-Loomis/dp/0857680978
https://www.alexhays.com/loomis/Andrew%20Loomis%20-%20Drawing%20the%20Head%20and%20Hands.pdf

Fascinating.

Yes, I think that's entirely practical.

I'm an engineer, not an artist.  The process of producing
realistic-looking drawings of organic things has always been a total
mystery to me.  This, on the other hand, is a geometric approach to
the problem.  Coupled with curved-surface tools - Bezier patches,
perhaps - it seems like it would be totally amenable to use in OpenSCAD.

And, of course, if you do it right it'd all be parameterized. Tweak a
number, and the head gets a little wider at the top.

From 60 years ago, i remember using these https://n.stuccu.co.uk/s/Artist+Manikin in 'A level' art, and a few rules wrt drawing faces - eyes halfway up face, bottom of nose half way 'twixt eyes and chin, so I'm thinking along the lines of facial feature additions (like Mr. Potato Head, or as now, just gender neutral  'Potato Head')  and then pose the manikin and drape over clothing. Hair could be awkward, but baseball caps could help there, initially. I think, based on a Loomis type construction set, my initial thought is to have the cranium sphere at a size of 1000 units, which would most likely allow integer values for details of ear lobes/whatever. If it has to look realistic, then there will need to be some controllable curve blending/contouring, which I've always found tricky in openscad, and most other cad packages too. Ideally the ability to simply to push things around, as in using modelling clay would be useful, but nothing in openscad is manipulated in that way, afaik. However, with the correct choice of values, then that will not be needed so much. Although it would be nice to construct a face from spheres and other basic shapes, I believe that eye sockets and lips would be awkward, and instead it may be simpler to combine a few  extruded cross sections, but I would consider that, and using polygons as cheating. Could be fun! On 06/03/2021 00:18, Jordan Brown wrote: > https://en.wikipedia.org/wiki/Andrew_Loomis > https://www.amazon.com/Drawing-Head-Hands-Andrew-Loomis/dp/0857680978 > https://www.alexhays.com/loomis/Andrew%20Loomis%20-%20Drawing%20the%20Head%20and%20Hands.pdf > > Fascinating. > > Yes, I think that's entirely practical. > > I'm an engineer, not an artist.  The process of producing > realistic-looking drawings of organic things has always been a total > mystery to me.  This, on the other hand, is a geometric approach to > the problem.  Coupled with curved-surface tools - Bezier patches, > perhaps - it seems like it would be totally amenable to use in OpenSCAD. > > And, of course, if you do it right it'd all be parameterized. Tweak a > number, and the head gets a little wider at the top. >
RW
Ray West
Sat, Mar 6, 2021 10:10 PM

Well, I've made a start. From pages 43 and 44 of the pdf mentioned by
Jordan, I've decided that since everything is more or less thirds, to
chose a size of 300 for the cranium. I've roughly constructed a face,
place holders for parts, really, but having printed it at a more a less
a 7mm to the foot scale, (scaled the total height of this stl to about
10mm height) it has a far better potential  than a scaled model of an
more accurate facial rendering.  When making scale models, in order for
them to 'look right', adjustments have to be made, hiding some details,
emphasising others, change colours, etc - you can't scale nature.

Now to do some various hats/hair styles, then examine the body details.,
drape clothing and so on. I'm not sure if trying to make it more
parametric at this stage is worth while. I'm not sure of what would be
involved in the automatic placement of the ears, for example, but
certain basic features could be calculated, nose flare etc.

I think the limbs of the manikin could be interesting, in particular if
I limit the joint rotations, etc. I will probably add hair/hat to this
face first.

//face3 based on loomis p43,44
// 300 max ball
module base(){
    union()
       sphere(d=300);
       translate([0,-50,-100])sphere(d=200);
       translate([0,-110,-150])sphere(d=90);//pointed chin
}

module slice(){
    cube([1000,1000,1000],true);
}

module head(){
hull()
difference(){ //slice off side of head
    base();
    translate([610,0,0])rotate([0,8,0])slice();
    translate([-610,0,0])rotate([0,-8,0])slice();
}
}

module nose(){
  cylinder(100,50,20);
}

module eyesocket(){
  rotate([0,90,0])cylinder(500,20,20);
}

module ear(){
  cylinder (15,40,40);
}

module neck(){
    translate([0,90,-350])rotate([10,0,0])cylinder(350,95,95);
}

module lips() {
    union(){
       cylinder(5,40,50);
       translate([0,0,-5]) cylinder(15,50,40);
}
}

$fn=60;
//place features on head
union(){
   difference(){
      union(){
         neck();
         head();
         translate([90,10,-40]) rotate([90,0,65])ear();  //left ear
         translate([-90,10,-40]) rotate([90,0,-65])ear();  //right ear
}
     translate([-250,-130,0])eyesocket();
}
  translate([0,-130,-90])  nose();
  translate([0,-115,-140]) lips();
}

On 06/03/2021 16:02, Ray West wrote:

From 60 years ago, i remember using these
https://n.stuccu.co.uk/s/Artist+Manikin in 'A level' art, and a few
rules wrt drawing faces - eyes halfway up face, bottom of nose half
way 'twixt eyes and chin, so I'm thinking along the lines of facial
feature additions (like Mr. Potato Head, or as now, just gender
neutral  'Potato Head')  and then pose the manikin and drape over
clothing. Hair could be awkward, but baseball caps could help there,
initially.

I think, based on a Loomis type construction set, my initial thought
is to have the cranium sphere at a size of 1000 units, which would
most likely allow integer values for details of ear lobes/whatever. If
it has to look realistic, then there will need to be some controllable
curve blending/contouring, which I've always found tricky in openscad,
and most other cad packages too. Ideally the ability to simply to push
things around, as in using modelling clay would be useful, but nothing
in openscad is manipulated in that way, afaik. However, with the
correct choice of values, then that will not be needed so much.

Although it would be nice to construct a face from spheres and other
basic shapes, I believe that eye sockets and lips would be awkward,
and instead it may be simpler to combine a few  extruded cross
sections, but I would consider that, and using polygons as cheating.

Could be fun!

On 06/03/2021 00:18, Jordan Brown wrote:

https://en.wikipedia.org/wiki/Andrew_Loomis
https://www.amazon.com/Drawing-Head-Hands-Andrew-Loomis/dp/0857680978
https://www.alexhays.com/loomis/Andrew%20Loomis%20-%20Drawing%20the%20Head%20and%20Hands.pdf

Fascinating.

Yes, I think that's entirely practical.

I'm an engineer, not an artist.  The process of producing
realistic-looking drawings of organic things has always been a total
mystery to me.  This, on the other hand, is a geometric approach to
the problem.  Coupled with curved-surface tools - Bezier patches,
perhaps - it seems like it would be totally amenable to use in OpenSCAD.

And, of course, if you do it right it'd all be parameterized. Tweak a
number, and the head gets a little wider at the top.

Well, I've made a start. From pages 43 and 44 of the pdf mentioned by Jordan, I've decided that since everything is more or less thirds, to chose a size of 300 for the cranium. I've roughly constructed a face, place holders for parts, really, but having printed it at a more a less a 7mm to the foot scale, (scaled the total height of this stl to about 10mm height) it has a far better potential  than a scaled model of an more accurate facial rendering.  When making scale models, in order for them to 'look right', adjustments have to be made, hiding some details, emphasising others, change colours, etc - you can't scale nature. Now to do some various hats/hair styles, then examine the body details., drape clothing and so on. I'm not sure if trying to make it more parametric at this stage is worth while. I'm not sure of what would be involved in the automatic placement of the ears, for example, but certain basic features could be calculated, nose flare etc. I think the limbs of the manikin could be interesting, in particular if I limit the joint rotations, etc. I will probably add hair/hat to this face first. //face3 based on loomis p43,44 // 300 max ball module base(){     union()        sphere(d=300);        translate([0,-50,-100])sphere(d=200);        translate([0,-110,-150])sphere(d=90);//pointed chin } module slice(){     cube([1000,1000,1000],true); } module head(){ hull() difference(){ //slice off side of head     base();     translate([610,0,0])rotate([0,8,0])slice();     translate([-610,0,0])rotate([0,-8,0])slice(); } } module nose(){   cylinder(100,50,20); } module eyesocket(){   rotate([0,90,0])cylinder(500,20,20); } module ear(){   cylinder (15,40,40); } module neck(){     translate([0,90,-350])rotate([10,0,0])cylinder(350,95,95); } module lips() {     union(){        cylinder(5,40,50);        translate([0,0,-5]) cylinder(15,50,40); } } $fn=60; //place features on head union(){    difference(){       union(){          neck();          head();          translate([90,10,-40]) rotate([90,0,65])ear();  //left ear          translate([-90,10,-40]) rotate([90,0,-65])ear();  //right ear }      translate([-250,-130,0])eyesocket(); }   translate([0,-130,-90])  nose();   translate([0,-115,-140]) lips(); } On 06/03/2021 16:02, Ray West wrote: > From 60 years ago, i remember using these > https://n.stuccu.co.uk/s/Artist+Manikin in 'A level' art, and a few > rules wrt drawing faces - eyes halfway up face, bottom of nose half > way 'twixt eyes and chin, so I'm thinking along the lines of facial > feature additions (like Mr. Potato Head, or as now, just gender > neutral  'Potato Head')  and then pose the manikin and drape over > clothing. Hair could be awkward, but baseball caps could help there, > initially. > > I think, based on a Loomis type construction set, my initial thought > is to have the cranium sphere at a size of 1000 units, which would > most likely allow integer values for details of ear lobes/whatever. If > it has to look realistic, then there will need to be some controllable > curve blending/contouring, which I've always found tricky in openscad, > and most other cad packages too. Ideally the ability to simply to push > things around, as in using modelling clay would be useful, but nothing > in openscad is manipulated in that way, afaik. However, with the > correct choice of values, then that will not be needed so much. > > Although it would be nice to construct a face from spheres and other > basic shapes, I believe that eye sockets and lips would be awkward, > and instead it may be simpler to combine a few  extruded cross > sections, but I would consider that, and using polygons as cheating. > > Could be fun! > > On 06/03/2021 00:18, Jordan Brown wrote: >> https://en.wikipedia.org/wiki/Andrew_Loomis >> https://www.amazon.com/Drawing-Head-Hands-Andrew-Loomis/dp/0857680978 >> https://www.alexhays.com/loomis/Andrew%20Loomis%20-%20Drawing%20the%20Head%20and%20Hands.pdf >> >> >> Fascinating. >> >> Yes, I think that's entirely practical. >> >> I'm an engineer, not an artist.  The process of producing >> realistic-looking drawings of organic things has always been a total >> mystery to me.  This, on the other hand, is a geometric approach to >> the problem.  Coupled with curved-surface tools - Bezier patches, >> perhaps - it seems like it would be totally amenable to use in OpenSCAD. >> >> And, of course, if you do it right it'd all be parameterized. Tweak a >> number, and the head gets a little wider at the top. >>
RW
Ray West
Sun, Mar 7, 2021 8:11 PM

I've found some average dimensions for a manikin, based on the size of
the head, which will give a starting point for the body. However, I'm at
a loss as to how to manipulate the joints. (not necessarily the
geometry, cos/sin, etc., but how to get it to work in openscad).

As an example, I've put a snippet of code and comments below. I was
hoping to have a list of vectors, one for each end of a limb, and then
be able to write some code to adjust the angles of a particular limb.
I'm sure it can be done, except I'm thinking of it more as a
'traditional sequential problem', using global variables for the limb
ends, and sub routines called as required to move the end points around.
It's a similar problem to con rods and cranks, I guess that's been done.
Anyway, any help would be very much appreciated.

// length of p1 to p2 = 10
// length of s1 to s2  = 20
// s1 is 'hinged' to p2

//start positions

p1=[0,0,0];
p2=[0,0,10];
s1=[0,0,10];
s2=[0,0,30];

//How to change the values to the following?

p1=[0,0,0];
p2=[10,0,0];
s1=[10,0,0];
s2=[10,0,20];

//the syntax, I can't seem to be able to use anything like p2.x = 10
// can't pass values back from modules
// functions limited to one line?
// No 'global variables'?
// there will be about 50 sets of vectors

I've found some average dimensions for a manikin, based on the size of the head, which will give a starting point for the body. However, I'm at a loss as to how to manipulate the joints. (not necessarily the geometry, cos/sin, etc., but how to get it to work in openscad). As an example, I've put a snippet of code and comments below. I was hoping to have a list of vectors, one for each end of a limb, and then be able to write some code to adjust the angles of a particular limb. I'm sure it can be done, except I'm thinking of it more as a 'traditional sequential problem', using global variables for the limb ends, and sub routines called as required to move the end points around. It's a similar problem to con rods and cranks, I guess that's been done. Anyway, any help would be very much appreciated. // length of p1 to p2 = 10 // length of s1 to s2  = 20 // s1 is 'hinged' to p2 //start positions p1=[0,0,0]; p2=[0,0,10]; s1=[0,0,10]; s2=[0,0,30]; //How to change the values to the following? p1=[0,0,0]; p2=[10,0,0]; s1=[10,0,0]; s2=[10,0,20]; //the syntax, I can't seem to be able to use anything like p2.x = 10 // can't pass values back from modules // functions limited to one line? // No 'global variables'? // there will be about 50 sets of vectors
NH
nop head
Sun, Mar 7, 2021 8:30 PM

There are no variables in OpenSCAD, just named constants (except in for
loops).

Functions are not limited to one line if you use let() you can assign
intermediate variables and use them later.  Here is an unrelated example of
a complex function:

function catenary_points(l, x, y, steps = 100) = //! Returns a list of 2D
points on the curve that goes from the origin to (x,y) and has length l.
let(
d = x / 2,
a = catenary_find_a(d, sqrt(sqr(l) - sqr(y))),  // Find a to get
the correct length
offset = argsinh(y / catenary_s(d, a)),
t0 = sinh(-d / a + offset),
t1 = sinh( d / a + offset),
h = a * cosh(-d / a + offset) - a,
lowest = offset > d / a ? [0, 0] : offset < -d / a ? [x, y] : [d -
offset * a, -h],
p0 = catenary(t0, a)
)
steps ? [for(t = [t0 : (t1 - t0) / steps : t1]) catenary(t, a) - p0] :
lowest;

You can have global constants. A constant at file scope is accessible to
modules and functions after it. If the name starts with a $ it is available
in any module or function called after.

On Sun, 7 Mar 2021 at 20:12, Ray West raywest@raywest.com wrote:

I've found some average dimensions for a manikin, based on the size of
the head, which will give a starting point for the body. However, I'm at
a loss as to how to manipulate the joints. (not necessarily the
geometry, cos/sin, etc., but how to get it to work in openscad).

As an example, I've put a snippet of code and comments below. I was
hoping to have a list of vectors, one for each end of a limb, and then
be able to write some code to adjust the angles of a particular limb.
I'm sure it can be done, except I'm thinking of it more as a
'traditional sequential problem', using global variables for the limb
ends, and sub routines called as required to move the end points around.
It's a similar problem to con rods and cranks, I guess that's been done.
Anyway, any help would be very much appreciated.

// length of p1 to p2 = 10
// length of s1 to s2  = 20
// s1 is 'hinged' to p2

//start positions

p1=[0,0,0];
p2=[0,0,10];
s1=[0,0,10];
s2=[0,0,30];

//How to change the values to the following?

p1=[0,0,0];
p2=[10,0,0];
s1=[10,0,0];
s2=[10,0,20];

//the syntax, I can't seem to be able to use anything like p2.x = 10
// can't pass values back from modules
// functions limited to one line?
// No 'global variables'?
// there will be about 50 sets of vectors


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

There are no variables in OpenSCAD, just named constants (except in for loops). Functions are not limited to one line if you use let() you can assign intermediate variables and use them later. Here is an unrelated example of a complex function: function catenary_points(l, x, y, steps = 100) = //! Returns a list of 2D points on the curve that goes from the origin to `(x,y)` and has length `l`. let( d = x / 2, a = catenary_find_a(d, sqrt(sqr(l) - sqr(y))), // Find a to get the correct length offset = argsinh(y / catenary_s(d, a)), t0 = sinh(-d / a + offset), t1 = sinh( d / a + offset), h = a * cosh(-d / a + offset) - a, lowest = offset > d / a ? [0, 0] : offset < -d / a ? [x, y] : [d - offset * a, -h], p0 = catenary(t0, a) ) steps ? [for(t = [t0 : (t1 - t0) / steps : t1]) catenary(t, a) - p0] : lowest; You can have global constants. A constant at file scope is accessible to modules and functions after it. If the name starts with a $ it is available in any module or function called after. On Sun, 7 Mar 2021 at 20:12, Ray West <raywest@raywest.com> wrote: > I've found some average dimensions for a manikin, based on the size of > the head, which will give a starting point for the body. However, I'm at > a loss as to how to manipulate the joints. (not necessarily the > geometry, cos/sin, etc., but how to get it to work in openscad). > > As an example, I've put a snippet of code and comments below. I was > hoping to have a list of vectors, one for each end of a limb, and then > be able to write some code to adjust the angles of a particular limb. > I'm sure it can be done, except I'm thinking of it more as a > 'traditional sequential problem', using global variables for the limb > ends, and sub routines called as required to move the end points around. > It's a similar problem to con rods and cranks, I guess that's been done. > Anyway, any help would be very much appreciated. > > // length of p1 to p2 = 10 > // length of s1 to s2 = 20 > // s1 is 'hinged' to p2 > > //start positions > > p1=[0,0,0]; > p2=[0,0,10]; > s1=[0,0,10]; > s2=[0,0,30]; > > //How to change the values to the following? > > p1=[0,0,0]; > p2=[10,0,0]; > s1=[10,0,0]; > s2=[10,0,20]; > > //the syntax, I can't seem to be able to use anything like p2.x = 10 > // can't pass values back from modules > // functions limited to one line? > // No 'global variables'? > // there will be about 50 sets of vectors > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
JB
Jordan Brown
Sun, Mar 7, 2021 9:01 PM

The way that I would think of a body and joints is to start with some
part - probably the torso, but technically you could start anywhere -
and attach limbs, heads, et cetera as children.  A joint rotates its
children.  So you have a torso with a shoulder joint, which rotates its
child the upper arm, with an elbow joint which rotates its child the
lower arm, and so on.  (But remember, the joints aren't simple
hinge-like connections; they can twist too - and twist sometimes happens
along a part.  Lower-arm twists happen along the entire arm, not
exclusively at either joint.)

The essence is that the hand doesn't have to care what the shoulder is
doing.  The hand just does its thing, relative to wherever the shoulder,
upper arm, elbow, lower arm, and wrist put it.

You could start with any part, but starting with the torso probably
results in the most natural behavior.  If you started with the big toe,
wiggling the toe would have the toe stay motionless while the rest of
the body moved.  That's sort of technically correct, but is probably
unexpected.

The way that I would think of a body and joints is to start with some part - probably the torso, but technically you could start anywhere - and attach limbs, heads, et cetera as children.  A joint rotates its children.  So you have a torso with a shoulder joint, which rotates its child the upper arm, with an elbow joint which rotates its child the lower arm, and so on.  (But remember, the joints aren't simple hinge-like connections; they can twist too - and twist sometimes happens along a part.  Lower-arm twists happen along the entire arm, not exclusively at either joint.) The essence is that the hand doesn't have to care what the shoulder is doing.  The hand just does its thing, relative to wherever the shoulder, upper arm, elbow, lower arm, and wrist put it. You could start with any part, but starting with the torso probably results in the most natural behavior.  If you started with the big toe, wiggling the toe would have the toe stay motionless while the rest of the body moved.  That's sort of technically correct, but is probably unexpected.