Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12516/src/net/sourceforge/bprocessor/model
Added Files:
Direction.java
Log Message:
Still trying to fix header-comment - the problem is that the file was added as ASCII with keyword compression (-kk) instead of ASCII with keyword expansion (-kkv)
--- NEW FILE: Direction.java ---
//---------------------------------------------------------------------------------
// $Id$
//
// Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net)
// Released under the Lesser GNU Public License v2.1
//---------------------------------------------------------------------------------
package net.sourceforge.bprocessor.model;
/**
* Class representing a vertex and its direction for movement
*/
public class Direction {
/** The Vertex */
private Vertex vertex;
/** The direction */
private Vertex direction;
/**
* Constructor
* @param which the point
* @param dir the direction of the point
*/
public Direction(Vertex which, Vertex dir) {
vertex = which;
direction = dir;
}
/**
* change the direction to v projected on the sum of v and direction
* @param v The vertex to alter with
*/
public void alterDirection(Vertex v) {
Vertex sum = v.add(direction);
double value = sum.dot(direction) / (direction.length() * direction.length());
direction.scale(value);
}
/**
* @return Returns the direction.
*/
public Vertex getDirection() {
return direction;
}
/**
* @param direction The direction to set.
*/
public void setDirection(Vertex direction) {
this.direction = direction;
}
/**
* @return Returns the vertex.
*/
public Vertex getVertex() {
return vertex;
}
/**
* @param vertex The vertex to set.
*/
public void setVertex(Vertex vertex) {
this.vertex = vertex;
}
}
|