Drawable, Interactive, Measurable, Trackablepublic class TVector extends TShape
| Modifier and Type | Field | Description |
|---|---|---|
protected java.awt.Shape |
head |
|
protected int |
length |
|
protected java.awt.geom.Line2D |
line |
|
protected java.awt.geom.GeneralPath |
path |
|
protected java.awt.geom.AffineTransform |
rotation |
|
protected java.awt.Shape |
shaft |
|
protected TPoint |
tail |
|
protected TPoint |
tip |
|
protected boolean |
tipEnabled |
|
protected java.awt.Rectangle |
tipRect |
|
protected int |
width |
attachedTo, coordsEditTrigger, coordsVisibleInMouseBox, enabled, isAdjusting, screenPt, stepEditTrigger, support, trackEditTrigger, worldPt, xyStringBuilder| Constructor | Description |
|---|---|
TVector() |
Constructs a default TVector with tail position (0, 0) and
components (0, 0).
|
TVector(double xt,
double yt,
double xc,
double yc) |
Constructs a TVector with specified tail and components.
|
| Modifier and Type | Method | Description |
|---|---|---|
Interactive |
findInteractive(DrawingPanel panel,
int xpix,
int ypix) |
Returns the interactive drawable object at the specified pixel
position.
|
protected java.awt.Shape |
getShape(VideoPanel vidPanel) |
Gets the shape to be filled in the draw method.
|
TPoint |
getTail() |
Gets the tail.
|
TPoint |
getTip() |
Gets the tip.
|
double |
getXComponent() |
Gets the x component.
|
double |
getYComponent() |
Gets the y component.
|
boolean |
isTipEnabled() |
Gets whether the tip is enabled.
|
void |
setStroke(java.awt.BasicStroke stroke) |
Overrides TPoint setStroke method.
|
void |
setTipEnabled(boolean enabled) |
Enables and disables the interactivity of the tip.
|
void |
setTipLength(int tipLength) |
Sets the length of the arrow tip.
|
void |
setXComponent(double x) |
Sets the x component.
|
void |
setXY(double x,
double y) |
Overrides TPoint setXY method to move both tip and tail.
|
void |
setXYComponents(double x,
double y) |
Sets the x and y components.
|
void |
setYComponent(double y) |
Sets the y component.
|
getX, getYfinalize, getClass, notify, notifyAll, wait, wait, waitclone, distance, distance, distance, distanceSq, distanceSq, distanceSq, hashCode, setLocationaddPropertyChangeListener, addPropertyChangeListener, angle, angle, attachTo, center, cos, cos, detach, equals, getFrameNumber, getScreenPosition, getWorldPosition, getXMax, getXMin, getYMax, getYMin, isAdjusting, isAttached, isCoordsEditTrigger, isEnabled, isMeasured, isStepEditTrigger, isTrackEditTrigger, removePropertyChangeListener, removePropertyChangeListener, setAdjusting, setCoordsEditTrigger, setEnabled, setLocation, setPositionOnLine, setScreenPosition, setScreenPosition, setStepEditTrigger, setTrackEditTrigger, setWorldPosition, setX, setY, showCoordinates, sin, sin, translatedraw, getBounds, getColor, getStroke, isVisible, setColor, setHitRectCenter, setVisible, toStringprotected java.awt.geom.GeneralPath path
protected java.awt.geom.Line2D line
protected java.awt.Shape head
protected java.awt.Shape shaft
protected int length
protected int width
protected java.awt.geom.AffineTransform rotation
protected TPoint tail
protected TPoint tip
protected java.awt.Rectangle tipRect
protected boolean tipEnabled
public TVector()
public TVector(double xt,
double yt,
double xc,
double yc)
xt - x position of tailyt - y position of tailxc - x componentyc - y componentpublic TPoint getTip()
public TPoint getTail()
public void setXComponent(double x)
x - the x componentpublic void setYComponent(double y)
y - the y componentpublic void setXYComponents(double x,
double y)
x - the x componenty - the y componentpublic double getXComponent()
public double getYComponent()
public void setXY(double x,
double y)
setXY in interface InteractivesetXY in class TPointx - the x positiony - the y positionpublic void setTipEnabled(boolean enabled)
enabled - true to enable the tippublic boolean isTipEnabled()
true if the tip is enabledpublic void setTipLength(int tipLength)
tipLength - the tip length in pixelspublic void setStroke(java.awt.BasicStroke stroke)
public Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
findInteractive in interface InteractivefindInteractive in class TShapepanel - the drawing panelxpix - the x pixel position on the panelypix - the y pixel position on the panelprotected java.awt.Shape getShape(VideoPanel vidPanel)