473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Designing better structures for animation tool

X-No-Archive

Hi all,

Can anyone help me with structuring the data in a small tool I have to
build? I'm trying to work out if there's a design pattern or data
structure that would remove some of the dependencies.

I am designing an animation tool.

A /Character/ is easily represented by a tree, each node of which
delegates to a vector. A skeleton or stickman can therefore be
described.

Any number of /Poses/ (or Keyframes) can be defined, each of which is
an angle for each joint in the Character. A Pose can therefore be
stored using a tree, each node of which delegates to an Integer, which
is the angle for that joint.

Here we have the first problem: each Pose (there won't be less than 50
Poses) requires storing a tree of the same structure as the Character.
If the Character's structure changes, every Pose needs to be explicitly
notified of this change.

Any number of /Animations/ may be defined. These are a list of Poses
(the same Pose may be used in any number of Animations).

Here we have my second problem - do I index or reference the Poses?
Either way, if a Pose is deleted, every Animation will have to be
individually notified of the deletion, so that the integrity of the
Pose list in the Animation is kept.

In addition, each Animation has an /Interpolation/ for each pair of
Poses in the list. This may be a set of Beziers, one for each joint in
the Character. These can be stored in a tree, each node of which
delegates to a Bezier object which describes the motion curve for that
joint, but this is the same as my first problem: each Interpolation
requires storing a tree of the same structure as the character.
I have looked at organising this data differently: one method would be
for each node in a Character's tree to delegate to a Joint object, each
of which contains a list of angles, one for each Pose in the system -
but this scatters the discreet notion of a 'Pose' into an "index into
many joints' Poses list".
If it's a choice between the two techniques, I've tried the latter and
I'm tempted to try the former, thinking that keeping a set of trees
following the same structure is the nicer of the two solutions.
I guess the ideal would be if the tree structures used by the Pose and
Animation objects somehow implicitly reflect the Character's tree, but
I'm not sure if this is possible - any ideas on this or other ways to
improve this design?
Many thanks,
Darren Grant

Jul 23 '05 #1
6 2369
X-No-Archive
Darren wrote:
Can anyone help me with structuring the data in a small tool I have to
build? I'm trying to work out if there's a design pattern or data
structure that would remove some of the dependencies.
[..]


I didn't find a C++ _language_ question in your post, sorry. You might
be much better off asking your OOD question in 'comp.object' or in any
of 'comp.games.development.*' newsgroups.

V
Jul 23 '05 #2
Willdo, thanks Victor.

Jul 23 '05 #3

"Darren" <dg**@hotmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
X-No-Archive

Hi all,

Can anyone help me with structuring the data in a small tool I have to
build? I'm trying to work out if there's a design pattern or data
structure that would remove some of the dependencies.

I am designing an animation tool.

A /Character/ is easily represented by a tree, each node of which
delegates to a vector. A skeleton or stickman can therefore be
described.

Any number of /Poses/ (or Keyframes) can be defined, each of which is
an angle for each joint in the Character. A Pose can therefore be
stored using a tree, each node of which delegates to an Integer, which
is the angle for that joint.

Here we have the first problem: each Pose (there won't be less than 50
Poses) requires storing a tree of the same structure as the Character.
If the Character's structure changes, every Pose needs to be explicitly
notified of this change.

Any number of /Animations/ may be defined. These are a list of Poses
(the same Pose may be used in any number of Animations).

Here we have my second problem - do I index or reference the Poses?
Either way, if a Pose is deleted, every Animation will have to be
individually notified of the deletion, so that the integrity of the
Pose list in the Animation is kept.

In addition, each Animation has an /Interpolation/ for each pair of
Poses in the list. This may be a set of Beziers, one for each joint in
the Character. These can be stored in a tree, each node of which
delegates to a Bezier object which describes the motion curve for that
joint, but this is the same as my first problem: each Interpolation
requires storing a tree of the same structure as the character.
I have looked at organising this data differently: one method would be
for each node in a Character's tree to delegate to a Joint object, each
of which contains a list of angles, one for each Pose in the system -
but this scatters the discreet notion of a 'Pose' into an "index into
many joints' Poses list".
If it's a choice between the two techniques, I've tried the latter and
I'm tempted to try the former, thinking that keeping a set of trees
following the same structure is the nicer of the two solutions.
I guess the ideal would be if the tree structures used by the Pose and
Animation objects somehow implicitly reflect the Character's tree, but
I'm not sure if this is possible - any ideas on this or other ways to
improve this design?


This is actually an OO design question and not specifically related to C++.
However, some ideas came to my mind:

[Off topic from here on]

Each character has a collection of possible poses. If you declare these
poses not in absolute numbers but in relative numbers you can easily handle
transitions and furthermore, this allows for a vast number of inherently
available poses influenced by the original pose of the character. The
relation between poses and character etc. could be done using an observer
design pattern. Looking this up in Google you'll find plenty of information.
The same holds true for the relation of animations and poses. In case you do
not keep copies of the available poses but just reference them (I'd even do
this via the characters because they must be in the animation and implicitly
carry the poses with them) you have no problem with on-line modifications.
Regarding the interpolation objects I'd add them as members to the snimation
objects and they can store a reference to the start & end pose. Hence, any
modification will automatically have an effect on all participants.

HTH
Chris


Jul 23 '05 #4
X-No-Archive

Hi Chris,

Thanks for the reply. Actually the whole tool caters just for the
animation of one character.

When you say 'declare the poses in relative numbers', do you mean the
angles of each joint? I just realised I made a mistake in my original
description - the skeleton is described by a tree of Lengths (ints) -
not vectors, so there's no 'original pose' to model the Poses on.

Imagine an 'Edit view', where an artist will model the skeleton with a
scratchpad-esque form where the joints may be freely rotated and
reshaped. Poses are done after this, in the 'Pose view', by dragging
the joints around, for example into a couple of 'Walk' poses.

Finally in the 'Animate view' poses will be dragged from the 'Poses
palette' into an 'Animation graph', for instance the 4 walk Poses will
be dragged into the correct order to form a walk animation. A 'Start
walking' animation may end with the same Pose that the 'Walking'
animation starts with (allowing 'Start walking' to segue into
'Walking').

Good idea to use the observer - but given that there is only one
Character in the system, I'm thinking it's probably overkill.

The Interpolations themselves do not need to know of the Poses they
interpolate between - they simply control the speed of each joint's
interpolation between two keyframes during rendering.
So, I've got the four classes:

Character
Tree of Integer: static sSkeleton
(each nodes delegates to Integer Length)

Pose
Tree of Integer: mKeyFrame
(same structure as Character.sSkeleton[1],
each node delegates to Integer Angle)

Animation
List of Pose : mPoses (integrity needs to be checked
for integrity after deleting a Pose[2])
List of Interp: mInterps (or stored as { Pose, Interp } pairs)

Interp
Tree of Bezier : mTree (same structure as Character.sSkeleton[1])
My original problem can be seen more easily here, labelled [1] and [2].
Regards,
Darren

Jul 23 '05 #5
Darren wrote:
X-No-Archive

Hi Chris,

Thanks for the reply. Actually the whole tool caters just for the
animation of one character.

When you say 'declare the poses in relative numbers', do you mean the
angles of each joint? I just realised I made a mistake in my original
description - the skeleton is described by a tree of Lengths (ints) -
not vectors, so there's no 'original pose' to model the Poses on.

Imagine an 'Edit view', where an artist will model the skeleton with a
scratchpad-esque form where the joints may be freely rotated and
reshaped. Poses are done after this, in the 'Pose view', by dragging
the joints around, for example into a couple of 'Walk' poses.

Finally in the 'Animate view' poses will be dragged from the 'Poses
palette' into an 'Animation graph', for instance the 4 walk Poses will
be dragged into the correct order to form a walk animation. A 'Start
walking' animation may end with the same Pose that the 'Walking'
animation starts with (allowing 'Start walking' to segue into
'Walking').

Good idea to use the observer - but given that there is only one
Character in the system, I'm thinking it's probably overkill.

The Interpolations themselves do not need to know of the Poses they
interpolate between - they simply control the speed of each joint's
interpolation between two keyframes during rendering.
So, I've got the four classes:

Character
Tree of Integer: static sSkeleton
(each nodes delegates to Integer Length)

Pose
Tree of Integer: mKeyFrame
(same structure as Character.sSkeleton[1],
each node delegates to Integer Angle)

Animation
List of Pose : mPoses (integrity needs to be checked
for integrity after deleting a Pose[2])
List of Interp: mInterps (or stored as { Pose, Interp } pairs)

Interp
Tree of Bezier : mTree (same structure as Character.sSkeleton[1])
My original problem can be seen more easily here, labelled [1] and [2].
Regards,
Darren


Hi Darren,

if you only have one character the observer might indeed be an overkill.
However, I don't quite understand the way you model the character just
by lengths. A skeleton/pose would normally be described by a number of
entities. These entities themselves are described by an object matrix
(the usual 4x4 matrices used in computer graphics) that contains the
information of the position and the rotation of the entity. All
positions and rotations are of course relative to the origin of the
character.

The character naturally would naturally contain a container of available
poses and these in turn contain a collection of the entities making up
this pose.

e.g.:

class CCharacter {
vector<CPoses*> m_Poses;
CMatrix m_Position; // global pos of the character
}

class CEntity {
int Length; // add further skeleton data...
CMatrix m_ObjMatrix; // position of this entity within the
// skeleton
};

class CPoses {
vector<CEntity> m_PoseData;
};

class CKeyFrame {
CPose* m_pStartPose;
CPose* m_pEndPose;
CInterpolator m_Interpolator;
};

class CAnimation {
vector<CKeyFrame> m_AnimData;
};
To keep the integrity of your system in case you will allow to really
remove poses from the character you'd either have to check in CKeyFrame
if the pointer to the poses are still valid, or have the poses keep a
list of all keyframes they are used in.

HTH
Chris
Jul 23 '05 #6
Hi Chris,

There's no external model file - the character is modelled by a tree
structure, eg

torso
/ \
l.arm r.arm
/ \
l.forearm r.forearm

or whatever. Each of these has a length.

Additionally there are Poses which give each joint or limb a rotation.

A solution I'm starting to use is on a cross-posting;
http://groups-beta.google.com/group/...33c56fe2770441

Cheers,
Darren

Chris Theis wrote:
Darren wrote:

Hi Chris,

Thanks for the reply. Actually the whole tool caters just for the
animation of one character.

When you say 'declare the poses in relative numbers', do you mean the
angles of each joint? I just realised I made a mistake in my original
description - the skeleton is described by a tree of Lengths (ints) -
not vectors, so there's no 'original pose' to model the Poses on.

Imagine an 'Edit view', where an artist will model the skeleton with a
scratchpad-esque form where the joints may be freely rotated and
reshaped. Poses are done after this, in the 'Pose view', by dragging
the joints around, for example into a couple of 'Walk' poses.

Finally in the 'Animate view' poses will be dragged from the 'Poses
palette' into an 'Animation graph', for instance the 4 walk Poses will
be dragged into the correct order to form a walk animation. A 'Start
walking' animation may end with the same Pose that the 'Walking'
animation starts with (allowing 'Start walking' to segue into
'Walking').

Good idea to use the observer - but given that there is only one
Character in the system, I'm thinking it's probably overkill.

The Interpolations themselves do not need to know of the Poses they
interpolate between - they simply control the speed of each joint's
interpolation between two keyframes during rendering.
So, I've got the four classes:

Character
Tree of Integer: static sSkeleton
(each nodes delegates to Integer Length)

Pose
Tree of Integer: mKeyFrame
(same structure as Character.sSkeleton[1],
each node delegates to Integer Angle)

Animation
List of Pose : mPoses (integrity needs to be checked
for integrity after deleting a Pose[2])
List of Interp: mInterps (or stored as { Pose, Interp } pairs)

Interp
Tree of Bezier : mTree (same structure as Character.sSkeleton[1])
My original problem can be seen more easily here, labelled [1] and [2].
Regards,
Darren


Hi Darren,

if you only have one character the observer might indeed be an overkill.
However, I don't quite understand the way you model the character just
by lengths. A skeleton/pose would normally be described by a number of
entities. These entities themselves are described by an object matrix
(the usual 4x4 matrices used in computer graphics) that contains the
information of the position and the rotation of the entity. All
positions and rotations are of course relative to the origin of the
character.

The character naturally would naturally contain a container of available
poses and these in turn contain a collection of the entities making up
this pose.

e.g.:

class CCharacter {
vector<CPoses*> m_Poses;
CMatrix m_Position; // global pos of the character
}

class CEntity {
int Length; // add further skeleton data...
CMatrix m_ObjMatrix; // position of this entity within the
// skeleton
};

class CPoses {
vector<CEntity> m_PoseData;
};

class CKeyFrame {
CPose* m_pStartPose;
CPose* m_pEndPose;
CInterpolator m_Interpolator;
};

class CAnimation {
vector<CKeyFrame> m_AnimData;
};
To keep the integrity of your system in case you will allow to really
remove poses from the character you'd either have to check in CKeyFrame
if the pointer to the poses are still valid, or have the poses keep a
list of all keyframes they are used in.

HTH
Chris


Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: James Brown | last post by:
Hi all, Having problems designing a template-class. I'll describe my scenario first then show what I've come up with so far: Need a class to provide pointer/array-like access to an area of...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
1
by: Chris Strug | last post by:
Hi, As something of a pet project, I'm looking to develop a tool to track employee holiday (or vacation for those of us in the US) for my company - good for the company (if I get something...
1
by: Brad | last post by:
Thanks for taking the time to read my question. I would like to make a progress bar for my data import, but I have no way of telling how long it is going to take, and therefore how to properly...
4
by: Dave | last post by:
Hi. I am learning PyOpenGL and I am working with a largish fixed scene composed of several thousand GLtriangles. I plan to store the coords and normals in a NumPy array. Is this the fastest...
2
by: rdemyan via AccessMonster.com | last post by:
My application has a lot of complicated SQL statements, calculations, processing that takes time. I've created a custom form to act like a messagebox. It has 10 small rectangles on it that change...
1
by: hottoku | last post by:
Hi All, I'm having quite a bit of trouble designing a search tool to work with my database. I have found lots of examples from Microsoft Templates to Allen Browne's sample search form. The...
2
by: moondaddy | last post by:
Below is some xaml that is a mockup of a control I'm building. It's a shape that will be used in a diagramming tool. The red, blue and green rectangles simulate connectors on the side of the...
0
by: Stef Mientki | last post by:
Virgil Stokes wrote: Maybe this might be of your interest: http://oase.uci.kun.nl/~mientki/data_www/pylab_works/pw_animations_screenshots.html Although it's in alfa stage, I'm using parts of...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.