Documentation of 'vgp.tutor.linear.PjLinear' Java class
PjLinear ("JavaView Reference Manual")
"JavaView? v5.03.003"
vgp.tutor.linear

Class PjLinear

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, PsTimeListenerIf, PsUpdateIf, PvPickListenerIf


    public class PjLinear
    extends PjProject
    Simple interactive linear algebra applet performs vector calculations on two vectors and shows the result vector.

    The result vector has 3D coordinates because of the possible cross product mode. Nevertheless, the dimension of the two argument vectors has been chosen 2D since then the vectors always lie in the xy-plane in the display, even if the camera is in perspective mode. This makes the dragging of the argument vectors in cross product mode more intuitive. Note, the method computeResult() may be simplified a little if one chooses 3D coordinates for all vectors.

    See Also:
    Serialized Form
    Author:
    Konrad Polthier
    Version:
    05.11.02, 1.30 revised (ep) Use perspective camera for cross product.
    04.03.01, 1.20 revised (kp) Converted into a tutorial, and moved to vgp.tutor.
    26.11.00, 1.10 revised (kp) Use global instead of local polygon colors.
    22.10.00, 1.00 created (kp)
    • Field Detail

      • MODE_ADD

        public static final int MODE_ADD
        Summation mode, result is sum of two argument vectors.
        See Also:
        Constant Field Values
      • MODE_SUB

        public static final int MODE_SUB
        Difference mode, result is difference of two argument vectors.
        See Also:
        Constant Field Values
      • MODE_CROSS

        public static final int MODE_CROSS
        Cross product mode, result is cross product of two argument vectors.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PjLinear

        public PjLinear()
        Constructors creates two argument vectors and a result vector. Initializations of instance variables should be performed within the init() method to allow resetting the project later by simply calling the init() method.
    • Method Detail

      • init

        public void init()
        Initialize all instance variables of this project. This method is invoked during the construction of this project and whenever this project is reset. Therefore, allocations of instance variables should be performed in the constructor of the project.
        Overrides:
        init in class PjProject
      • start

        public void start()
        Description copied from class: PjProject
        Method is invoked during loading of a project in JavaView.

        If a project has an animation object, then the animation panel is shown when the project's this start() method is invoked during loading of the project. Use setAnimation(PsAnimation) to register an animation.

        If auto fit is enabled then scenery is scaled to fit in each display.

        Overrides:
        start in class PjProject
        See Also:
        PvViewerIf.start(), PjProject.isEnabledAutoFit()
      • getMode

        public int getMode()
        Get the current computation mode, possibly values are MODE_... constants.
      • setMode

        public int setMode(int mode)
        Set the current computation mode, possibly values are MODE_... constants. Method also recomputes the result vector and initiates a redraw.
      • computeResult

        public void computeResult(int mode)
        Perform vector arithmetic on two argument vectors to compute the result vector. This method could be made simpler if one uses 3D coordinates for argument vectors too.
      • update

        public boolean update(java.lang.Object event)
        Perform recomputations whenever a child has changed. Here the two argument vectors have registered this class as parent, therefore, we are able to catch their update events and recompute the result vectors if they have changed. Method is usually invoked from the children.
        Specified by:
        update in interface PsUpdateIf
        Overrides:
        update in class PsObject
        Parameters:
        event - carries a lot of information
        Returns:
        true if event has been handled, otherwise false
        See Also:
        PsObject.setParent(PsUpdateIf), PsObject.getFather(), PsObject.addUpdateListener(PsUpdateIf)
"JavaView? v5.03.003"

"

The software JavaView? is copyright protected. All Rights Reserved.
"

Ads help maintain this website.