Home » Archived » GEF3D » interpolated animation
interpolated animation [message #4767] |
Mon, 15 June 2009 23:17 |
Miles Parker Messages: 1341 Registered: July 2009 |
Senior Member |
|
|
OK, this is waaay out on the "some day would be nice" frontier, but I'm
wondering if there is any way to get animation for figures that have
moved between refreshes, ala GEF. (Actyually, I haven't had great
success getting this to work there anyway.) That is, if you place a
figure at X[1],Y[1],Z[1] and then move that figure to X1[4],Y1[1],Z1[1]
to have the intermediate step(s) X1[2],Y1[1],Z1[1], X1[3],Y1[1],Z1[1]
rendered at some time slice period. (Of course one could do it manually
but that's not practical for all cases.)
|
|
|
Re: interpolated animation [message #4836 is a reply to message #4767] |
Tue, 16 June 2009 08:21 |
Kristian Duske Messages: 64 Registered: July 2009 |
Member |
|
|
Hi Miles,
> OK, this is waaay out on the "some day would be nice" frontier, but I'm
> wondering if there is any way to get animation for figures that have
> moved between refreshes, ala GEF. (Actyually, I haven't had great
> success getting this to work there anyway.) That is, if you place a
> figure at X[1],Y[1],Z[1] and then move that figure to X1[4],Y1[1],Z1[1]
> to have the intermediate step(s) X1[2],Y1[1],Z1[1], X1[3],Y1[1],Z1[1]
> rendered at some time slice period. (Of course one could do it manually
> but that's not practical for all cases.)
This is on my mental to do list, but it has pretty low priority right
now. We will get to animations sooner or later because we will need
this for some nice GUI enhancements, but if we do this, we should get
it right. That means it should be applicable to all kinds of figure
changes (moving, resizing, rotating, ...) and it should be non-invasive
so that it can be applied to all kinds of figures, 2D and 3D.
So yeah, we will do this, but there are other GEF3D shortcomings that
are much more important to fix right now, so this is not going to
happen in the near future - sorry!
Best regards
Kristian
|
|
|
Re: interpolated animation [message #4905 is a reply to message #4767] |
Tue, 16 June 2009 08:57 |
|
Hi Miles,
On 2009-06-16 01:17:16 +0200, Miles Parker <milesparker@gmail.com> said:
> OK, this is waaay out on the "some day would be nice" frontier, but I'm
> wondering if there is any way to get animation for figures that have
> moved between refreshes, ala GEF. (Actyually, I haven't had great
> success getting this to work there anyway.)
Since GEF3D uses the very same update mechanisms as GEF, GEF animations
should work similarly as well. SO you may start with a GEF animation
and then try the very same animation in a 3D-fied editor.
We have already camera animation working, simply by using a Timer and a
TimerTask. The camera is then simply moved like that:
@Override
public void run() {
final Vector3fImpl newPos = new Vector3fImpl();
Math3D.add(camera.getPosition(null), delta, newPos);
Display.getDefault().asyncExec(new Runnable(){
public void run(){
camera.moveTo(newPos.x, newPos.y, newPos.z);
}});
}
But this is a special case an the camera is a concept not known in GEF.
Cheers,
Jens
|
|
| |
Re: interpolated animation [message #5039 is a reply to message #4836] |
Tue, 16 June 2009 21:10 |
Miles Parker Messages: 1341 Registered: July 2009 |
Senior Member |
|
|
OK, I was actually able to implement a simple version of this pretty easily..
First, I have a seperate model runnning; anytime there is a change in
state the model listerner does this:
public void update(IModel model) {
for (animationStep = 0; animationStep <
animationStepCount; animationStep++) {
figure.invalidateTree();
refresh();
figure.getUpdateManager().performUpdate();
}
animationStep = 0;
}
That forces constraints to be recalculated, which does this:
Map<Object, IVector3f> startPoints = new HashMap<Object, IVector3f>();
Map<Object, Vector3f> addPoints = new HashMap<Object, Vector3f>();
protected void calculateConstraints(GraphicalEditPart editPart) {
Object agent = editPart.getModel();
ILocation location = getLocationProvider().getLocation(agent);
if (location != null) {
IFigure3D agentFigure = (IFigure3D) editPart.getFigure();
IVector3f endPoint = new Vector3fImpl((float)
GenericEditPart.SCALE * location.getX(),
(float)
GenericEditPart.SCALE * location.getY(), -GenericEditPart.SCALE);
if (((Scape)
getMemberProvider().getParent(getModel())).getPeriod() > 0) {
IVector3f startPoint;
Vector3f addPoint;
if (animationStep == 0) {
startPoint = agentFigure.getPosition3D().getLocation3D();
startPoints.put(agent, startPoint);
addPoint = new Vector3fImpl();
Math3DVector3f.sub(endPoint, startPoint, addPoint);
Math3DVector3f.scale(1.0f / animationEnd, addPoint,
addPoint);
addPoints.put(agent, addPoint);
} else {
startPoint = startPoints.get(agent);
addPoint = addPoints.get(agent);
}
Vector3f intermediatePoint = new Vector3fImpl();
IVector3f currentPoint =
agentFigure.getPosition3D().getLocation3D();
Math3DVector3f.add(currentPoint, addPoint, intermediatePoint);
agentFigure.getPosition3D().setLocation3D(intermediatePoint) ;
} else {
agentFigure.getPosition3D().setLocation3D(endPoint);
}
}
}
(The location and member provider are AGF classes, their usage should
be pretty obvious.)
On 2009-06-16 01:21:28 -0700, Kristian Duske
<kristian.duske@fernuni-hagen.de> said:
> Hi Miles,
>
>> OK, this is waaay out on the "some day would be nice" frontier, but I'm
>> wondering if there is any way to get animation for figures that have
>> moved between refreshes, ala GEF. (Actyually, I haven't had great
>> success getting this to work there anyway.) That is, if you place a
>> figure at X[1],Y[1],Z[1] and then move that figure to X1[4],Y1[1],Z1[1]
>> to have the intermediate step(s) X1[2],Y1[1],Z1[1], X1[3],Y1[1],Z1[1]
>> rendered at some time slice period. (Of course one could do it manually
>> but that's not practical for all cases.)
>
> This is on my mental to do list, but it has pretty low priority right
> now. We will get to animations sooner or later because we will need
> this for some nice GUI enhancements, but if we do this, we should get
> it right. That means it should be applicable to all kinds of figure
> changes (moving, resizing, rotating, ...) and it should be non-invasive
> so that it can be applied to all kinds of figures, 2D and 3D.
>
> So yeah, we will do this, but there are other GEF3D shortcomings that
> are much more important to fix right now, so this is not going to
> happen in the near future - sorry!
>
> Best regards
> Kristian
|
|
|
Re: interpolated animation [message #5108 is a reply to message #4905] |
Wed, 17 June 2009 03:14 |
Miles Parker Messages: 1341 Registered: July 2009 |
Senior Member |
|
|
On 2009-06-16 01:57:13 -0700, Jens v.P. <developer@jevopi.de> said:
> Hi Miles,
>
> On 2009-06-16 01:17:16 +0200, Miles Parker <milesparker@gmail.com> said:
>
>> OK, this is waaay out on the "some day would be nice" frontier, but I'm
>> wondering if there is any way to get animation for figures that have
>> moved between refreshes, ala GEF. (Actyually, I haven't had great
>> success getting this to work there anyway.)
>
> Since GEF3D uses the very same update mechanisms as GEF, GEF animations
> should work similarly as well. SO you may start with a GEF animation
> and then try the very same animation in a 3D-fied editor.
>
> We have already camera animation working, simply by using a Timer and a
> TimerTask. The camera is then simply moved like that:
>
> @Override
>
> public void run() {
>
> final Vector3fImpl newPos = new Vector3fImpl();
>
> Math3D.add(camera.getPosition(null), delta, newPos);
>
> Display.getDefault().asyncExec(new Runnable(){
>
> public void run(){
>
> camera.moveTo(newPos.x, newPos.y, newPos.z);
>
> }});
>
> }
There doesn't seem to be anyway to get the current camera target..
(Where the camera is looking..) When I try to animate the camera, it is
really jerky, and I'd like to do a kind of pan movement but to do that
I htink I need to know where the camera is currently pointed..?
|
|
|
Re: interpolated animation [message #5177 is a reply to message #5108] |
Wed, 17 June 2009 11:06 |
|
Hi Miles,
On 2009-06-17 05:14:46 +0200, Miles Parker <milesparker@gmail.com> said:
> There doesn't seem to be anyway to get the current camera target..
> (Where the camera is looking..) When I try to animate the camera, it is
> really jerky, and I'd like to do a kind of pan movement but to do that
> I htink I need to know where the camera is currently pointed..?
Upps.. yes, you are right. Hehe.. you were right ;-) See revision 162:
"added getter for view direction and up vector" :-D If have added two
methods to ICamera.
If you want to know the figure to which the camera is looking at, you
will have to ask the picker (ColorPicker, see also
PickingUpdateManager) and use the (2D) center of the canvas as
parameters.
Cheers
Jens
|
|
|
Re: interpolated animation [message #5241 is a reply to message #5177] |
Wed, 17 June 2009 11:14 |
|
On 2009-06-17 13:06:33 +0200, Jens v.P. <developer@jevopi.de> said:
> Upps.. yes, you are right. Hehe.. you were right ;-) See revision 162:
> "added getter for view direction and up vector" :-D If have added two
> methods to ICamera.
Oh no... rev. 163 (there was a little bug, now passed parameters are
recognized in the getters)...
Jens
|
|
|
Re: interpolated animation [message #562075 is a reply to message #4767] |
Tue, 16 June 2009 08:21 |
Kristian Duske Messages: 64 Registered: July 2009 |
Member |
|
|
Hi Miles,
> OK, this is waaay out on the "some day would be nice" frontier, but I'm
> wondering if there is any way to get animation for figures that have
> moved between refreshes, ala GEF. (Actyually, I haven't had great
> success getting this to work there anyway.) That is, if you place a
> figure at X[1],Y[1],Z[1] and then move that figure to X1[4],Y1[1],Z1[1]
> to have the intermediate step(s) X1[2],Y1[1],Z1[1], X1[3],Y1[1],Z1[1]
> rendered at some time slice period. (Of course one could do it manually
> but that's not practical for all cases.)
This is on my mental to do list, but it has pretty low priority right
now. We will get to animations sooner or later because we will need
this for some nice GUI enhancements, but if we do this, we should get
it right. That means it should be applicable to all kinds of figure
changes (moving, resizing, rotating, ...) and it should be non-invasive
so that it can be applied to all kinds of figures, 2D and 3D.
So yeah, we will do this, but there are other GEF3D shortcomings that
are much more important to fix right now, so this is not going to
happen in the near future - sorry!
Best regards
Kristian
|
|
|
Re: interpolated animation [message #562092 is a reply to message #4767] |
Tue, 16 June 2009 08:57 |
|
Hi Miles,
On 2009-06-16 01:17:16 +0200, Miles Parker <milesparker@gmail.com> said:
> OK, this is waaay out on the "some day would be nice" frontier, but I'm
> wondering if there is any way to get animation for figures that have
> moved between refreshes, ala GEF. (Actyually, I haven't had great
> success getting this to work there anyway.)
Since GEF3D uses the very same update mechanisms as GEF, GEF animations
should work similarly as well. SO you may start with a GEF animation
and then try the very same animation in a 3D-fied editor.
We have already camera animation working, simply by using a Timer and a
TimerTask. The camera is then simply moved like that:
@Override
public void run() {
final Vector3fImpl newPos = new Vector3fImpl();
Math3D.add(camera.getPosition(null), delta, newPos);
Display.getDefault().asyncExec(new Runnable(){
public void run(){
camera.moveTo(newPos.x, newPos.y, newPos.z);
}});
}
But this is a special case an the camera is a concept not known in GEF.
Cheers,
Jens
|
|
| |
Re: interpolated animation [message #562134 is a reply to message #4836] |
Tue, 16 June 2009 21:10 |
Miles Parker Messages: 1341 Registered: July 2009 |
Senior Member |
|
|
OK, I was actually able to implement a simple version of this pretty easily..
First, I have a seperate model runnning; anytime there is a change in
state the model listerner does this:
public void update(IModel model) {
for (animationStep = 0; animationStep <
animationStepCount; animationStep++) {
figure.invalidateTree();
refresh();
figure.getUpdateManager().performUpdate();
}
animationStep = 0;
}
That forces constraints to be recalculated, which does this:
Map<Object, IVector3f> startPoints = new HashMap<Object, IVector3f>();
Map<Object, Vector3f> addPoints = new HashMap<Object, Vector3f>();
protected void calculateConstraints(GraphicalEditPart editPart) {
Object agent = editPart.getModel();
ILocation location = getLocationProvider().getLocation(agent);
if (location != null) {
IFigure3D agentFigure = (IFigure3D) editPart.getFigure();
IVector3f endPoint = new Vector3fImpl((float)
GenericEditPart.SCALE * location.getX(),
(float)
GenericEditPart.SCALE * location.getY(), -GenericEditPart.SCALE);
if (((Scape)
getMemberProvider().getParent(getModel())).getPeriod() > 0) {
IVector3f startPoint;
Vector3f addPoint;
if (animationStep == 0) {
startPoint = agentFigure.getPosition3D().getLocation3D();
startPoints.put(agent, startPoint);
addPoint = new Vector3fImpl();
Math3DVector3f.sub(endPoint, startPoint, addPoint);
Math3DVector3f.scale(1.0f / animationEnd, addPoint,
addPoint);
addPoints.put(agent, addPoint);
} else {
startPoint = startPoints.get(agent);
addPoint = addPoints.get(agent);
}
Vector3f intermediatePoint = new Vector3fImpl();
IVector3f currentPoint =
agentFigure.getPosition3D().getLocation3D();
Math3DVector3f.add(currentPoint, addPoint, intermediatePoint);
agentFigure.getPosition3D().setLocation3D(intermediatePoint) ;
} else {
agentFigure.getPosition3D().setLocation3D(endPoint);
}
}
}
(The location and member provider are AGF classes, their usage should
be pretty obvious.)
On 2009-06-16 01:21:28 -0700, Kristian Duske
<kristian.duske@fernuni-hagen.de> said:
> Hi Miles,
>
>> OK, this is waaay out on the "some day would be nice" frontier, but I'm
>> wondering if there is any way to get animation for figures that have
>> moved between refreshes, ala GEF. (Actyually, I haven't had great
>> success getting this to work there anyway.) That is, if you place a
>> figure at X[1],Y[1],Z[1] and then move that figure to X1[4],Y1[1],Z1[1]
>> to have the intermediate step(s) X1[2],Y1[1],Z1[1], X1[3],Y1[1],Z1[1]
>> rendered at some time slice period. (Of course one could do it manually
>> but that's not practical for all cases.)
>
> This is on my mental to do list, but it has pretty low priority right
> now. We will get to animations sooner or later because we will need
> this for some nice GUI enhancements, but if we do this, we should get
> it right. That means it should be applicable to all kinds of figure
> changes (moving, resizing, rotating, ...) and it should be non-invasive
> so that it can be applied to all kinds of figures, 2D and 3D.
>
> So yeah, we will do this, but there are other GEF3D shortcomings that
> are much more important to fix right now, so this is not going to
> happen in the near future - sorry!
>
> Best regards
> Kristian
|
|
|
Re: interpolated animation [message #562157 is a reply to message #4905] |
Wed, 17 June 2009 03:14 |
Miles Parker Messages: 1341 Registered: July 2009 |
Senior Member |
|
|
On 2009-06-16 01:57:13 -0700, Jens v.P. <developer@jevopi.de> said:
> Hi Miles,
>
> On 2009-06-16 01:17:16 +0200, Miles Parker <milesparker@gmail.com> said:
>
>> OK, this is waaay out on the "some day would be nice" frontier, but I'm
>> wondering if there is any way to get animation for figures that have
>> moved between refreshes, ala GEF. (Actyually, I haven't had great
>> success getting this to work there anyway.)
>
> Since GEF3D uses the very same update mechanisms as GEF, GEF animations
> should work similarly as well. SO you may start with a GEF animation
> and then try the very same animation in a 3D-fied editor.
>
> We have already camera animation working, simply by using a Timer and a
> TimerTask. The camera is then simply moved like that:
>
> @Override
>
> public void run() {
>
> final Vector3fImpl newPos = new Vector3fImpl();
>
> Math3D.add(camera.getPosition(null), delta, newPos);
>
> Display.getDefault().asyncExec(new Runnable(){
>
> public void run(){
>
> camera.moveTo(newPos.x, newPos.y, newPos.z);
>
> }});
>
> }
There doesn't seem to be anyway to get the current camera target..
(Where the camera is looking..) When I try to animate the camera, it is
really jerky, and I'd like to do a kind of pan movement but to do that
I htink I need to know where the camera is currently pointed..?
|
|
|
Re: interpolated animation [message #562181 is a reply to message #5108] |
Wed, 17 June 2009 11:06 |
|
Hi Miles,
On 2009-06-17 05:14:46 +0200, Miles Parker <milesparker@gmail.com> said:
> There doesn't seem to be anyway to get the current camera target..
> (Where the camera is looking..) When I try to animate the camera, it is
> really jerky, and I'd like to do a kind of pan movement but to do that
> I htink I need to know where the camera is currently pointed..?
Upps.. yes, you are right. Hehe.. you were right ;-) See revision 162:
"added getter for view direction and up vector" :-D If have added two
methods to ICamera.
If you want to know the figure to which the camera is looking at, you
will have to ask the picker (ColorPicker, see also
PickingUpdateManager) and use the (2D) center of the canvas as
parameters.
Cheers
Jens
|
|
|
Re: interpolated animation [message #562206 is a reply to message #5177] |
Wed, 17 June 2009 11:14 |
|
On 2009-06-17 13:06:33 +0200, Jens v.P. <developer@jevopi.de> said:
> Upps.. yes, you are right. Hehe.. you were right ;-) See revision 162:
> "added getter for view direction and up vector" :-D If have added two
> methods to ICamera.
Oh no... rev. 163 (there was a little bug, now passed parameters are
recognized in the getters)...
Jens
|
|
|
Goto Forum:
Current Time: Thu Jan 02 21:15:17 GMT 2025
Powered by FUDForum. Page generated in 0.04111 seconds
|