summaryrefslogtreecommitdiffstats
path: root/src/demos/xtrans/InterpolatedQuad3f.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/demos/xtrans/InterpolatedQuad3f.java')
-rwxr-xr-xsrc/demos/xtrans/InterpolatedQuad3f.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/demos/xtrans/InterpolatedQuad3f.java b/src/demos/xtrans/InterpolatedQuad3f.java
new file mode 100755
index 0000000..895a458
--- /dev/null
+++ b/src/demos/xtrans/InterpolatedQuad3f.java
@@ -0,0 +1,45 @@
+package demos.xtrans;
+
+import gleem.linalg.*;
+
+/** A quadrilateral of three-dimensional floating-point values which
+ interpolates between specified start and end values. */
+
+public class InterpolatedQuad3f {
+ private Quad3f start;
+ private Quad3f end;
+
+ /** Constructs a new InterpolatedQuad3f. By default both the start
+ and end quadrilaterals have all of their points set to the
+ origin. */
+ public InterpolatedQuad3f() {
+ start = new Quad3f();
+ end = new Quad3f();
+ }
+
+ /** Returns the starting value for the interpolation. */
+ public Quad3f getStart() {
+ return start;
+ }
+
+ /** Sets the starting value for the interpolation. */
+ public void setStart(Quad3f quad) {
+ start.set(quad);
+ }
+
+ /** Returns the ending value for the interpolation. */
+ public Quad3f getEnd() {
+ return end;
+ }
+
+ /** Sets the ending value for the interpolation. */
+ public void setEnd(Quad3f quad) {
+ end.set(quad);
+ }
+
+ /** Gets the current interpolated value at the specified fraction of
+ interpolation (0.0 - 1.0). */
+ public Quad3f getCurrent(float fraction) {
+ return start.times(1.0f - fraction).plus(end.times(fraction));
+ }
+}