Revision 23595 trunk/libraries/libAnimation3D/src/main/java/com/iver/cit/gvsig/animation/interpolator/Interpolator3DSpherical.java

View differences:

Interpolator3DSpherical.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19

  
1 20
package com.iver.cit.gvsig.animation.interpolator;
2 21

  
3 22
import java.util.List;
......
17 36
public class Interpolator3DSpherical implements IInterpolator {
18 37

  
19 38
	private IInterpolatorTimeFuntion function;
20
	private String description = "Interpolacin basada en encuadres";
39
	private String description = "Interpolaci?n basada en encuadres";
21 40
	private String name = "Interpolator3DSpherical";
22 41
	
23
	public IKeyFrame interpolate(List kfList, int index, double time) {
42
	public IKeyFrame interpolate(List<IKeyFrame> kfList, int index, double time) {
24 43
		KeyFrame3DFlat KF = new KeyFrame3DFlat();
25 44

  
26 45
		if (kfList == null)
27 46
			return null;
28 47

  
29 48
				
30
		/*Interpolaci�n por cuaterniones.*/
49
		/*Interpolaci?n por quaterniones.*/
31 50
		
32 51
		double newTime = this.getFuntion().interpolate(time);
33 52
		
......
57 76
			
58 77
			newTime = (newTime-time1)/(time2-time1);//normalize time 0..1
59 78
			
60
			
61 79
			Quat from = cam1.getViewMatrix().getRotate();
62 80
			Quat to = cam2.getViewMatrix().getRotate();
63 81

  
......
70 88
			Matrix m = Matrix.rotate(q);
71 89
			Matrix m2 = m.prod(m1);
72 90
			
73
			
74
			
75
			
76
			
77
			
78
			
79
			
80 91
			Camera c = new Camera();
81 92
			c.setViewMatrix(m2);
82 93
		
......
100 111

  
101 112
	}
102 113

  
103
	private double doubleInterpolate(double from, double to, double time) {
104
		if (from == to)
105
			return from;
106
		return from + (to - from) * time;
107
	}
114
//	private double doubleInterpolate(double from, double to, double time) {
115
//		if (from == to)
116
//			return from;
117
//		return from + (to - from) * time;
118
//	}
108 119

  
109 120
	private Vec3 vec3LinearInterpolate(Vec3 from, Vec3 to, double time) {
110 121
		if (from.equals(to))

Also available in: Unified diff