FreeHEP API
Version current

org.freehep.graphics3d
Class Vector3

java.lang.Object
  extended byorg.freehep.graphics3d.Vector3
Direct Known Subclasses:
Scale, Translate

public class Vector3
extends Object

Keeps a 3 dimensional vector.

Original ArcBall C code from Ken Shoemake, Graphics Gems IV, 1993.

Version:
$Id: Vector3.java,v 1.2 2002/06/12 23:15:15 duns Exp $
Author:
Mark Donszelmann
Source Code:
Vector3.java

Field Summary
 double x
           
 double y
           
 double z
           
 
Constructor Summary
Vector3()
          creates null vector
Vector3(double x, double y, double z)
          creates vector from x,y,z
Vector3(Vector3 v)
          creates vector from v
 
Method Summary
 Vector3 add(Vector3 v, Vector3 r)
           
 Vector3 bisect(Vector3 v, Vector3 r)
           
 Vector3 cross(Vector3 v, Vector3 r)
           
 double dot(Vector3 v)
           
 double length()
           
 Vector3 negate(Vector3 r)
           
 Vector3 normalize(Vector3 r)
           
 Vector3 scale(double s, Vector3 r)
           
 Vector3 set(double x, double y, double z)
           
 Vector3 sub(Vector3 s, Vector3 r)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x

y

public double y

z

public double z
Constructor Detail

Vector3

public Vector3(double x,
               double y,
               double z)
creates vector from x,y,z


Vector3

public Vector3()
creates null vector


Vector3

public Vector3(Vector3 v)
creates vector from v

Method Detail

toString

public String toString()
Returns:
string representation of vector

length

public double length()
Returns:
length

normalize

public Vector3 normalize(Vector3 r)
Returns:
normal vector , or null if length is 0

scale

public Vector3 scale(double s,
                     Vector3 r)
Returns:
vector scaled by s

sub

public Vector3 sub(Vector3 s,
                   Vector3 r)
Returns:
difference between vector and s

add

public Vector3 add(Vector3 v,
                   Vector3 r)
Returns:
sum of vector and v

negate

public Vector3 negate(Vector3 r)
Returns:
the negation of vector

dot

public double dot(Vector3 v)
Returns:
dot product of vector and v

cross

public Vector3 cross(Vector3 v,
                     Vector3 r)
Returns:
cross produc of vector x v

bisect

public Vector3 bisect(Vector3 v,
                      Vector3 r)
Returns:
half arc between vector and v

set

public Vector3 set(double x,
                   double y,
                   double z)
Returns:
the vector set to x,y,z

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.