Skip to content

Commit

Permalink
add getDistance() and getLookAt()
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Feinberg committed Mar 10, 2009
1 parent f02232d commit 6a18f21
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion resources/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<property name="author" value="Jonathan Feinberg" />
<property name="copyright" value="(c) 2008" />
<property name="libraryName" value="PeasyCam" />
<property name="versionNumber" value="0.5.0" />
<property name="versionNumber" value="0.5.1" />
<property name="yourLink" value="http://mrfeinberg.com" />
<property name="keywords" value="3D,camera,rotation" />
<property name="tested:platform" value="Windows" />
Expand Down
11 changes: 11 additions & 0 deletions src/peasy/PeasyCam.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ private void mouseRotate(final double dx, final double dy)
}
}

public double getDistance()
{
return distance;
}

public void setDistance(final double newDistance)
{
setDistance(newDistance, 300);
Expand All @@ -249,6 +254,12 @@ public void setDistance(final double newDistance, final long animationTimeMillis
animationTimeMillis));
}

public float[] getLookAt()
{
return new float[] { (float) center.getX(), (float) center.getY(),
(float) center.getZ() };
}

public void lookAt(final double x, final double y, final double z)
{
centerInterps.startInterpolation(new CenterInterp(new Vector3D(x, y, z), 300));
Expand Down
4 changes: 4 additions & 0 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ <h2>Thanks</h2>
<p>Useful bug reports and feature suggestions were provided by:</p>
<ul>
<li><a href="http://ooish.com/">Oori Shalev</a></li>
<li>Jeffrey Gentes</li>
</ul>
<p>Please let me know if I've forgotten to acknowledge you.</p>

Expand Down Expand Up @@ -205,6 +206,9 @@ <h3>Methods</h3>
camera.setDistance(double d); // distance from looked-at point
camera.pan(double dx, double dy); // move the looked-at point relative to current orientation

double camera.getDistance(); // current distance
float[] camera.getLookAt(); // float[] { x, y, z }, looked-at point

camera.setMinimumDistance(double minimumDistance);
camera.setMaximumDistance(double maximumDistance); // clamp zooming

Expand Down

0 comments on commit 6a18f21

Please sign in to comment.