Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /* 
   * Copyright 2011 Cologne University of Applied Sciences Licensed under the
   * Educational Community License, Version 2.0 (the "License"); you may
   * not use this file except in compliance with the License. You may
   * obtain a copy of the License at
   *
   * http://www.osedu.org/licenses/ECL-2.0
   *
   * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an "AS IS"
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  * or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package org.amcgala.framework.shape.shape2d;
 
 
Draws a 2D Arrow.

Author(s):
Robert Giacinto
 
 public class Arrow extends Shape {
 
     private Vector3d position;
     private Vector3d direction;
     private double length;
     private BresenhamLine l1;

    
Constructor.

Parameters:
position
direction
length
 
     public Arrow(Vector3d positionVector3d directiondouble length) {
         this. = position;
         this. = length;
         this. = direction.normalize().times(length);
         init();
     }

    
Returns the direction in form of a 3D Vector.
 
     public Vector3d getDirection() {
         return ;
     }

    
Sets the direction.

Parameters:
direction
 
     public void setDirection(Vector3d direction) {
         this. = direction.normalize().times();
         init();
     }

    
Returns the length.

Returns:
 
     public double getLength() {
         return ;
     }

    
Sets the length.

Parameters:
length
 
     public void setLength(double length) {
         this. = length;
         this. = .normalize().times(length);
         init();
     }

    
Returns the current position in form of a 3D Vector.

Returns:
 
     public Vector3d getPosition() {
         return ;
     }

    
Sets the Position.

Parameters:
position
 
     public void setPosition(Vector3d position) {
        this. = position;
        init();
    }

    
Rendermethod.
    @Override
    public void render(Matrix transformationCamera cameraRenderer renderer) {
        .render(transformationcamerarenderer);
    }
    /*
     * Updates the shape at runtime.
     */
    private void init() {
         = new BresenhamLine(... + .. + .);
        . = .;
    }
    
    private static final Logger log = LoggerFactory.getLogger(Arrow.class.getName());
New to GrepCode? Check out our FAQ X