| 1 |
package org.papervision3d.core.math.util |
|---|
| 2 |
{ |
|---|
| 3 |
import org.papervision3d.core.geom.renderables.Vertex3D; |
|---|
| 4 |
import org.papervision3d.core.math.NumberUV; |
|---|
| 5 |
|
|---|
| 6 |
public class InterpolationUtil |
|---|
| 7 |
{ |
|---|
| 8 |
public static function interpolatePoint( a:Vertex3D, b:Vertex3D, alpha:Number ):Vertex3D |
|---|
| 9 |
{ |
|---|
| 10 |
var dst:Vertex3D = new Vertex3D(); |
|---|
| 11 |
dst.x = a.x + alpha * (b.x - a.x); |
|---|
| 12 |
dst.y = a.y + alpha * (b.y - a.y); |
|---|
| 13 |
dst.z = a.z + alpha * (b.z - a.z); |
|---|
| 14 |
return dst; |
|---|
| 15 |
} |
|---|
| 16 |
|
|---|
| 17 |
public static function interpolatePointTo(a:Vertex3D, b:Vertex3D, alpha:Number, dst:Vertex3D):void |
|---|
| 18 |
{ |
|---|
| 19 |
dst.x = a.x + alpha * (b.x - a.x); |
|---|
| 20 |
dst.y = a.y + alpha * (b.y - a.y); |
|---|
| 21 |
dst.z = a.z + alpha * (b.z - a.z); |
|---|
| 22 |
} |
|---|
| 23 |
|
|---|
| 24 |
public static function interpolateUV( a:NumberUV, b:NumberUV, alpha:Number ):NumberUV |
|---|
| 25 |
{ |
|---|
| 26 |
var dst:NumberUV = new NumberUV(); |
|---|
| 27 |
dst.u = a.u + alpha * (b.u - a.u); |
|---|
| 28 |
dst.v = a.v + alpha * (b.v - a.v); |
|---|
| 29 |
return dst; |
|---|
| 30 |
} |
|---|
| 31 |
|
|---|
| 32 |
public static function interpolateUVTo( a:NumberUV, b:NumberUV, alpha:Number, dst:NumberUV):NumberUV |
|---|
| 33 |
{ |
|---|
| 34 |
dst.u = a.u + alpha * (b.u - a.u); |
|---|
| 35 |
dst.v = a.v + alpha * (b.v - a.v); |
|---|
| 36 |
return dst; |
|---|
| 37 |
} |
|---|
| 38 |
|
|---|
| 39 |
} |
|---|
| 40 |
} |
|---|