Age definition

Tech support and suggestions forum. If you only have a basic question on how to get started, please use the "newbies" forum in the community section.

Moderator: joepal

Age definition

Postby JBird » Tue Aug 24, 2010 9:12 am

Hi,

I am confused with the age definition in the API Documentation. There seems to be an inconsistency. Which should I use if I want to manually change the age through a plugin with setAge()?

human.setAge(self, age)
Sets the age of the model. 0 if 12 years old, 1 is 70. To set a particular age in years, use the formula age_value = (age_in_years - 12) / (70 - 12).


While in the source code of guimacromodelling
Code: Select all
def syncStatus(self):
...
   if human.getAge() < 0.5:
      age = 12 + ((25 - 12) * 2) * human.getAge()
   else:
      age = 25 + ((70 - 25) * 2) * (human.getAge() - 0.5)


Greets :D

J
JBird
 
Posts: 8
Joined: Thu Aug 12, 2010 9:51 am

Re: Age definition

Postby mflerackers » Tue Aug 24, 2010 9:24 am

That is because there are 3 models, 12 - 25 - 70 so the code needs to take this into account. Also the input was changed to [-1, 1], -1 gives 12, 0 gives 25, while 1 gives 70, any value in between gives an interpolation.
MakeHuman project Developer
mflerackers
 
Posts: 636
Joined: Thu Feb 05, 2009 11:53 am
Location: Kyoto

Re: Age definition

Postby JBird » Tue Aug 24, 2010 9:45 am

mflerackers wrote:That is because there are 3 models, 12 - 25 - 70 so the code needs to take this into account. Also the input was changed to [-1, 1], -1 gives 12, 0 gives 25, while 1 gives 70, any value in between gives an interpolation.

So for setAge(), I use the 12-25-70 interpolation instead of the 12-70 interpolation?
JBird
 
Posts: 8
Joined: Thu Aug 12, 2010 9:51 am

Re: Age definition

Postby mflerackers » Tue Aug 24, 2010 10:32 am

There is no 12 -70 interpolation. You alsways interpolate from 12 -25 and from 25 - 70.
MakeHuman project Developer
mflerackers
 
Posts: 636
Joined: Thu Feb 05, 2009 11:53 am
Location: Kyoto

Re: Age definition

Postby JBird » Tue Aug 24, 2010 11:37 am

mflerackers wrote:There is no 12 -70 interpolation. You alsways interpolate from 12 -25 and from 25 - 70.


Ok, what I meant was that the API documentation of setAge() says to interpolate between 12 and 70 (see below) but this is not correct.

API documentation of human.setAge():
age_value = (age_in_years - 12) / (70 - 12)

http://download.tuxfamily.org/makehuman/api/human.Human-class.html#setAge


Thank you very much for the fast replies and keep up the awesome work!
JBird
 
Posts: 8
Joined: Thu Aug 12, 2010 9:51 am

Re: Age definition

Postby mflerackers » Tue Aug 24, 2010 12:01 pm

Yes, the documentation is quite out of sync with the code.
MakeHuman project Developer
mflerackers
 
Posts: 636
Joined: Thu Feb 05, 2009 11:53 am
Location: Kyoto


Return to Bugs, problems and feature requests

Who is online

Users browsing this forum: No registered users and 1 guest