public abstract class JaxoBezierObject extends Jaxo3PointObject
Modifier and Type | Field and Description |
---|---|
static int |
SELECT_P4
Fourth point (index 3).
|
SELECT_P3
GHOST_DASH, GLUON_FREQ, PHOTON_FREQ, SCALAR_DASH
SELECT_DX, SELECT_DY, SELECT_P2
D_FORMAT, GRAY_SCALE_FORMAT, SELECT_NONE, SELECT_P1
Constructor and Description |
---|
JaxoBezierObject() |
Modifier and Type | Method and Description |
---|---|
JaxoArrow.Coordinates |
arrowCoordinates()
Returns the coordinates of the arrow of the current object.
|
boolean |
canBeSelected(int handle,
int mode)
Determines if the object can be selected (moved, edited, etc)
from the given point in a given edit mode.
|
void |
copyFrom(JaxoBezierObject temp)
Sets all parameters from the given object to the current one.
|
protected java.lang.String |
getArrowCommand(float scale) |
double |
getBezierLength()
Returns the approximate length of this Bezier curve.
|
int |
getGrabbedHandle(int clickX,
int clickY,
JaxoHandle h)
Determines which handle the user has selected to move/resize/edit
an object.
|
protected java.awt.geom.Point2D |
getLatexPoint(double x,
double y,
float scaleFactor,
int canvasHeight)
Returns the latex (ie axodraw) coordinates of the point passed
of this JaxoObject.
|
java.awt.geom.Point2D |
getPoint(double u)
Returns a point of this Bezier curve at parameter u.
|
int |
getPointCount()
Returns the number of points it takes to draw this object.
|
int |
getX(int index)
X coordinate of Point 0 <= index < getPointCount().
|
int |
getX4()
Returns the x coordinate of the fourth click point of this Bezier.
|
int |
getY(int index)
Y coordinate of Point 0 <= index < getPointCount().
|
int |
getY4()
Returns the y coordinate of the fourth click point of this Bezier.
|
boolean |
isCopy(JaxoObject comp)
Determines if this JaxoObject is a copy of the specified one.
|
boolean |
isNoFreqStretching()
Returns the frequency stretching property of this Bezier.
|
void |
moveBy(int deltaX,
int deltaY)
Reset the coordinates of the object when it is moved
by deltaX and deltaY.
|
void |
paintHandles(JaxoGraphics2D g2,
JaxoHandle h,
int editMode)
Paints the handles of this JaxoObject that allow
to move/resize/edit it.
|
void |
paintVisualAid(JaxoGraphics2D g2)
Paints a visual aid for the user during dragging
(moving or resizing) of this JaxoObject.
|
void |
rescaleObject(int orx,
int ory,
float scale)
Rescale this JaxoObject by the scale factor scale,
keeping the point (orx, ory) fixed.
|
void |
setBezierPts(int sx1,
int sy1,
int sx2,
int sy2,
int sx3,
int sy3,
int sx4,
int sy4)
Sets the points of this Bezier.
|
void |
setNoFreqStretching(boolean nofs)
Sets the frequency stretching property of this Bezier.
|
void |
setPreferences()
Applies default values to this JaxoObject.
|
void |
setState(JaxoObject o)
Restore state to the values of 'o'.
|
void |
setX(int index,
int value)
Set X coordinate of Point 0 <= index < getPointCount() to 'value'.
|
void |
setX4(int newx4)
Sets the x coordinate of the fourth click point of this Bezier.
|
void |
setY(int index,
int value)
Set Y coordinate of Point 0 <= index < getPointCount() to 'value'.
|
void |
setY4(int newy4)
Sets the y coordinate of the fourth click point of this Bezier.
|
double |
slope(double u)
Returns the first derivative of this Bezier curve at parameter u.
|
float |
smallestDistanceTo(int px,
int py)
Determines the smallest distance of any of the handles
of this JaxoObject from the given point.
|
copyFrom, getX3, getY3, isOneLine, set3Pts, setX3, setY3
arrowPositionIs, copy, copyFrom, dashIs, dlSepIs, getAmp, getArrow, getArrowPosition, getDash, getDLSeparation, getWiggles, isDoubleLine, isFlip, isPaintArrow, paintArrow, setAmp, setArrow, setArrowPosition, setDash, setDLSeparation, setDoubleLine, setFlip, setPaintArrow, setWiggles
copyFrom, getHeight, getRadius, getRelh, getRelSize, getRelw, getSize, getStroke, getStrokeWidth, getWidth, getX2, getY2, latexWidth, resetStroke, setLocation, setRadius, setRelativeHeight, setRelativeWidth, setRelWAndH, setStroke, setStrokeWidth, setX2, setY2, strokeIs
addPropertyChangeListener, contains, contains, contains, contains, copyFrom, firePropertyChange, getBounds2D, getBoundsWithHandles, getColor, getGeneralPath, getLaTexLocation, getName, getPathIterator, getPathIterator, getPoints, getX, getY, intersects, intersects, isAround, isMarked, latexCommand, paint, prepareEditPanel, propertyChange, removePropertyChangeListener, setAsMarked, setColor, setLocation, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setPointCount, setPoints, setTransient, setX, setXPosition, setY, setYPosition
public static final int SELECT_P4
public int getPointCount()
getPointCount
in class Jaxo3PointObject
public int getX(int index)
getX
in class Jaxo3PointObject
index
- The index of the point to get.public int getY(int index)
getY
in class Jaxo3PointObject
index
- The index of the point to get.public void setX(int index, int value)
setX
in class Jaxo3PointObject
index
- The index of the point to set.value
- The value to set.public void setY(int index, int value)
setY
in class Jaxo3PointObject
index
- The index of the point to set.value
- The value to set.public final void setNoFreqStretching(boolean nofs)
nofs
- True if this Bezier is not frequency stretched.public final boolean isNoFreqStretching()
public final void setX4(int newx4)
newx4
- The x coordinate of the fourth click point of this Bezier.public final int getX4()
public final void setY4(int newy4)
newy4
- The y coordinate of the fourth click point of this Bezier.public final int getY4()
public final void setBezierPts(int sx1, int sy1, int sx2, int sy2, int sx3, int sy3, int sx4, int sy4)
sx1
- The x coordinate of the first click point of this Bezier.sy1
- The y coordinate of the first click point of this Bezier.sx2
- The x coordinate of the second click point of this Bezier.sy2
- The y coordinate of the second click point of this Bezier.sx3
- The x coordinate of the third click point of this Bezier.sy3
- The y coordinate of the third click point of this Bezier.sx4
- The x coordinate of the fourth click point of this Bezier.sy4
- The y coordinate of the fourth click point of this Bezier.public boolean isCopy(JaxoObject comp)
isCopy
in class Jaxo3PointObject
comp
- The JaxoObject to compare against.public void copyFrom(JaxoBezierObject temp)
temp
- The object to copy from.public void setState(JaxoObject o)
JaxoObject.copy()
.setState
in class JaxoParticleObject
o
- the object to copy from.public final void paintVisualAid(JaxoGraphics2D g2)
paintVisualAid
in class JaxoObject
g2
- The graphics context to paint the visual aid.public final void paintHandles(JaxoGraphics2D g2, JaxoHandle h, int editMode)
paintHandles
in class Jaxo3PointObject
g2
- The corresponding graphics context.h
- A handle object to be used for painting.editMode
- The edit mode that the handles are being painted in.public final float smallestDistanceTo(int px, int py)
smallestDistanceTo
in class Jaxo3PointObject
px
- The x coordinate of the test point.py
- The y coordinate of the test point.public int getGrabbedHandle(int clickX, int clickY, JaxoHandle h)
getGrabbedHandle
in class Jaxo3PointObject
clickX
- The x coordinate where the mouse click has ocurred.clickY
- The y coordinate where the mouse click has ocurred.h
- A handle object.public boolean canBeSelected(int handle, int mode)
canBeSelected
in class Jaxo3PointObject
handle
- One of the static variables SELECT_* defined for
this JaxoObject.mode
- The current edit mode.public final void moveBy(int deltaX, int deltaY)
moveBy
in class Jaxo3PointObject
deltaX
- The x displacement.deltaY
- The y displacement.public final void rescaleObject(int orx, int ory, float scale)
rescaleObject
in class Jaxo3PointObject
orx
- The x-coordinate of the fixed point.ory
- The y-coordinate of the fixed point.scale
- The scale parameter.protected java.awt.geom.Point2D getLatexPoint(double x, double y, float scaleFactor, int canvasHeight)
x
- the x coordinate of the pointy
- the y coordinate of the pointscaleFactor
- A scalefactor.canvasHeight
- The current height of the canvas.protected java.lang.String getArrowCommand(float scale)
public JaxoArrow.Coordinates arrowCoordinates()
arrowCoordinates
in class JaxoParticleObject
public java.awt.geom.Point2D getPoint(double u)
u
- the parameter value, needs to be between 0 and 1.public double slope(double u)
u
- the parameter value, needs to be between 0 and 1.public final double getBezierLength()
public void setPreferences()
preferences
.setPreferences
in class JaxoParticleObject
Licensed under GPL. For more information, see http://jaxodraw.sourceforge.net/license.html or the LICENSE file in the jaxodraw distribution.