|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjpicedt.graphic.model.AbstractElement
jpicedt.graphic.model.PicParallelogram
jpicedt.graphic.model.PicEllipse
public class PicEllipse
Ellipse ou arc, basé sur un parallélogramme.
Le modèle géométrique de cette ellipse (ou de son homologue arc) tout en étant basé sur un parallelogramme,
est équivalent à une ellipse ayant subi une rotation autour de son centre.
Dans la documentation qui suit nous allons utiliser trois systèmes de coordonnées :
l2rVec et b2tVec hérités de la superclasse. La base parallélogramme est quelconque, c'est à dire que U
et V peuvent être non orthogonaux et de modules différents
Les angles d'arc sont être exprimés selon le cas dans l'un des trois systèmes précédents, comme indiqué par
la documentation correspondante du code.
Le préfixe skew fait référence à des angles mesurés dans la base parallélogramme, le préfixe
rotated à la base ellipse, et les prefixes corrected ou rotation à
des angles dans la base canonique. Pour des raisons historiques les angles de la base parallélogramme et de
la base ellipse sont en degrés, et ceux de la base canonique en radians.
Comme les axes de l'ellipse ne sont pas en géneral parallèles aux côtés du parallélogramme, sauf
si celui-ci est rectangle, les bases parallélogramme et ellise
Dans la base parallélogramme, l'arc peut être obtenu par la courbe paramétrique suivante :
skewAngleStart à skewAngleEnd.
Dans la base ellipse, l'arc peut être obtenu par la courbe paramétrique suivante :
rotatedAngleStart à rotatedAngleEnd. Une autre façon
de construire l'arc est d'effectuer une rotation de rotationAngle (dans le sens trigonométrique,
c'est à dire antihoraire) de l'arc dont la courbe paramétrée est :Dans la base canonique, le point de début de l'arc et le point de fin de l'arc ont des coordonnées polaires dont l'angle est respectivement rorationAngle + correctedAngleStart et rotationAngle + correctedAngleEnd. On rappelle que l'arc va du début à la fin dans le sens horaire si smallAxisLength < 0, et dans le sens antihoraire sinon.

| Field Summary | |
|---|---|
static int |
CHORD
prefined closure type for arcs |
protected int |
closure
closure type |
protected double |
greatAxis
Lengths of the great axis of the ellipse. |
static int |
LAST_PT
|
static int |
OPEN
prefined closure type for arcs |
static int |
P_ANGLE_END
point marking end-of-arc |
static int |
P_ANGLE_START
point marking start-of-arc |
static int |
PIE
prefined closure type for arcs |
protected double |
rotatedAngleEnd
Arc angles in degrees, as measured in the ellipse basis. |
protected double |
rotatedAngleStart
Arc angles in degrees, as measured in the ellipse basis. |
protected double |
rotationAngle
Angle in radians (CCW) between the great axis of the ellipse and the horizontal axis. |
protected double |
skewAngleEnd
|
protected double |
skewAngleStart
Arc start- and end- angles in degrees as measured with respect to parallolegram's basis (see toParalleloBasisCoordinates() for
details on how this basis is defined). |
protected double |
smallAxis
Length of the small axis of the ellipse. |
| Fields inherited from class jpicedt.graphic.model.PicParallelogram |
|---|
b2tVec, CTRL_PT_SIDE_BITMAP, FIRST_PT, IN_SIDE_B, IN_SIDE_L, IN_SIDE_R, IN_SIDE_T, l2rVec, P_BL, P_BR, P_CENTER, P_TL, P_TR, ptBL, ptBR, ptTR, SIDE_0, SIDE_B, SIDE_L, SIDE_R, SIDE_T |
| Fields inherited from class jpicedt.graphic.model.AbstractElement |
|---|
attributeSet, name, parent, view |
| Constructor Summary | |
|---|---|
PicEllipse()
Create a new PicEllipse, centered at (0,0), with a null radius. |
|
PicEllipse(int closure)
Create a new PicEllipse, centered at (0,0), with a null radius, the given closure type. |
|
PicEllipse(int closure,
PicAttributeSet set)
Create a new PicEllipse, centered at (0,0), with a null radius, the given closure type, and the given attribute set. |
|
PicEllipse(PicAttributeSet set)
Create a new PicEllipse, centered at (0,0), with a null radius, and the given attribute
set. |
|
PicEllipse(PicEllipse src)
"cloning" constructor (to be used by clone()) |
|
PicEllipse(PicPoint p1,
PicPoint p2,
PicPoint p3,
int closure)
Create a new PicEllipse object using the 3 given points as 3 consecutive points of the
surrounding parallelogram, and a default attribute set. |
|
PicEllipse(PicPoint p1,
PicPoint p2,
PicPoint p3,
int closure,
PicAttributeSet set)
Create a new PicEllipse object using the 3 given points as 3 consecutive points of the
surrounding parallelogram, and the given attribute set. |
|
| Method Summary | |
|---|---|
protected void |
_updateAxis()
Compute the axes of the ellipse (smallAxis, greatAxis), and the rotated angles in terms of the skew angles. |
PicEllipse |
clone()
Overload Object.clone() method |
PicMultiCurve |
convertToMultiCurve()
Return a Bezier curve created from this ellipse. |
AbstractCustomizer |
createCustomizer()
Returns a customizer (Swing) component |
Shape |
createShape()
Creates a Shape that reflects the geometry of this model. |
double |
getAngleEnd()
Returns skewAngleEnd, ie angle end of the arc in degrees,
measured in the frame defined by the parallelogram. |
double |
getAngleExtent()
Returns the extent of the arc in degrees (CCW) as measured in the parallelogram basis. |
double |
getAngleStart()
Returns skewAngleStart, ie the starting angle of the arc in degrees,
measured in the frame defined by the parallelogram. |
int |
getArcType()
Returns the closure type, ie one of CHORD, PIE or OPEN predefined constant fields. |
String |
getArcTypeAsString()
Returns the closure type as a String, ie one of "chord", "pie" or "open" |
Rectangle2D |
getBoundingBox(Rectangle2D r)
Returns the bounding box (ie the surrounding rectangle) in double precision Used for instance to determine the arguments of a \\begin{picture} command. |
double |
getCorrectedAngleEnd()
|
double |
getCorrectedAngleStart()
|
PicPoint |
getCtrlPt(int numPoint,
PicPoint src)
Return the user-controlled point having the given index. |
String |
getDefaultName()
Return a localised string that represents this object's name |
double |
getGreatAxisLength()
Return the length of the great-axis of this ellipse/arc. |
int |
getLastPointIndex()
Return the index of the last point that can be retrieved by getCtrlPt. |
double |
getRotatedAngleEnd()
Returns rotatedAngleEnd, ie the angle end of
the arc in degrees as measured in the frame defined by the axes of the
ellipse, that is to say relative to the great axe, and with CW or CCW
orientiation depending on whether getSmallAxisLength() returns a
positive or negative number. |
double |
getRotatedAngleExtent()
Returns the angle extent of the arc in degrees as measured in the frame defined by the axes of the ellipse. |
double |
getRotatedAngleStart()
Return rotatedAngleStart, ie the angle start
of the arc in degrees, as measured in the frame defined by the axes of
the ellipse, that is to say relative to the great axe, and with CW or
CCW orientiation depending on whether getSmallAxisLength() returns a
positive or negative number. |
double |
getRotationAngle()
Return the rotation angle, ie the angle between the great axis of the ellipse and the horizontal axis. |
double |
getSmallAxisLength()
Return the signed length of the small-axis of this ellipse/arc. |
PicVector |
getTangentAtAngleEnd(PicVector pt)
Utility for computing arrow direction. |
PicVector |
getTangentAtAngleStart(PicVector pt)
Utility for computing arrow direction. |
boolean |
isArc()
Returns true if this PicEllipse is an arc, ie if angle extent does not equl 360 |
boolean |
isCircular()
Returns TRUE if this ellipse is circular, ie if smallAxis==greatAxis. |
boolean |
isClosed()
Returns whether this arc or ellipse is closed or not. |
boolean |
isFlat()
Return true if this ellipse is flat. |
boolean |
isPlain()
Return true if this PicEllipse is a plain ellipse, ie if angle extent equals 360. |
boolean |
isRotated()
Return true if this PicEllipse has a null rotation angle along the x-axis |
void |
mirror(PicPoint ptOrg,
PicVector normalVector)
Effectue une réflexion sur this relativement à l'axe
défini par ptOrg et normalVector. |
void |
rotate(PicPoint ptOrg,
double angle)
Rotate this Element by the given angle along the given point. |
void |
scale(double ptOrgX,
double ptOrgY,
double sx,
double sy,
UserConfirmationCache ucc)
Scale this object by (sx,sy) using (ptOrgX,ptOrgY) as the origin. |
void |
setAngleEnd(double angleEnd)
Set the angle end, then fire a changed-update. |
void |
setAngleExtent(double angleExtent)
Sets the angle extent, keeping the angle start fixed, then fire a changed update. |
void |
setAngleStart(double angleStart)
Set the angle start, as measured in the parallelogram basis, then fire a changed-update. |
void |
setArcType(int closure)
Sets the closure type to one of CHORD, PIE or OPEN. |
void |
setCtrlPt(int numPoint,
PicPoint pt,
EditPointConstraint constraint)
Set the coordinate of the point indexed by "numPoint" to the given value. |
void |
setGeometry(Arc2D arc)
Sets the coordinates of this element from the given shape. |
void |
setGeometry(PicEllipse ell)
Sets the coordinates and angle extents of this Element from those of the given source. |
void |
setPlain()
Set angle parameters so that this ellipse is a plain ellipse. |
void |
shear(PicPoint ptOrg,
double shx,
double shy,
UserConfirmationCache ucc)
Shear this Element by the given params wrt to the given origin. |
void |
syncArrowGeometry(ArrowView v,
ArrowView.Direction d)
Helper for the associated View. |
String |
toString()
Implementation of the Object.toString() method, used for debugging purpose author: Sylvain Reynal |
protected void |
updateAxis()
Compute the axes of the ellipse (smallAxis, greatAxis), and the rotated angles in terms of the skew angles. |
protected void |
updateEllipse()
|
protected void |
updateRotatedAngles()
Updates values of rotatedAngleStart and rotatedAngleEnd. |
| Methods inherited from class jpicedt.graphic.model.PicParallelogram |
|---|
createActions, getB2TVec, getCenter, getCtrlPtSubset, getFirstPointIndex, getL2RtoXAxisAngle, getL2RVec, isRectangle, isXYorYXRectangle, isXYRectangle, makeRectangle, makeXYRectangle, setCtrlPt, setGeometry, setGeometry, toParalleloBasisCoordinates, translate, updateParalleloBasis |
| Methods inherited from class jpicedt.graphic.model.AbstractElement |
|---|
anchorPointsIterator, fireChangedUpdate, getAttribute, getAttributeSet, getDrawing, getName, getParent, getView, pullOutOfGroup, removeView, replaceBy, scale, scale, scale, setAttribute, setAttributeSet, setName, setParent, setViewFromFactory, shear |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface jpicedt.graphic.model.Element |
|---|
anchorPointsIterator, getAttribute, getAttributeSet, getDrawing, getName, getParent, getView, removeView, replaceBy, scale, scale, scale, setAttribute, setAttributeSet, setParent, setViewFromFactory, shear |
| Field Detail |
|---|
public static final int P_ANGLE_START
public static final int P_ANGLE_END
public static final int LAST_PT
public static final int CHORD
public static final int OPEN
public static final int PIE
protected double skewAngleStart
toParalleloBasisCoordinates() for
details on how this basis is defined).
To wind up shortly, let U and V denote unit-vectors defined by the sides of the
parallelogram (these are actually given by "l2rVec" and "b2tVec" protected fields, yet immediately
after updateParalleloBasis has been called), then the
starting point of the arc is located at :
Center+cos(skewAngleStart)*U+sin(skewAngleStart)*V.
This value is closer to the user than rotatedAngleStart. [SR:je ne comprend pas cette phrase !!!]
Moreover, arc is modelled by the following parametrized curve :
Center + cos(t)*U+sin(t)*V,
for t ranging from skewAngleStart to skewAngleEnd.
We set skewAngleStart in (-180,180], and skewAngleEnd in (skewAngleStart,skewAngleStart+360]. This
means that if one makes a mirror symmetry of the parallelogram and keeps the values of these "skew"
angles unchanged, then we get the mirror image of the arc.
We use degrees because user may enter a value.
[SR:pending] On peut faire la conversion dans les setters correspondants (setAngleXXX).
L'ideal est qd meme d'avoir la meme unite partout (en interne) pour ne pas s'emmeler les pedales.
PicParallelogram.l2rVec,
PicParallelogram.b2tVecprotected double skewAngleEnd
skewAngleStartprotected double rotationAngle
protected double smallAxis
protected double greatAxis
protected double rotatedAngleStart
updateRotatedAngles, and are obviously
identical with them if surrounding parallelogram is a rectangle. These angles may be used to build
an appropriate Shape for this Element, by first creating an Arc2D from these angles, then rotating this shape by rotationAngle.
We restrict values of rotatedAngleStart to (-180,180], and those of
rotatedAngleEnd to (rotatedAngleStart,rotatedAngleStart+360].
protected double rotatedAngleEnd
updateRotatedAngles, and are obviously
identical with them if surrounding parallelogram is a rectangle. These angles may be used to build
an appropriate Shape for this Element, by first creating an Arc2D from these angles, then rotating this shape by rotationAngle.
We restrict values of rotatedAngleStart to (-180,180], and those of
rotatedAngleEnd to (rotatedAngleStart,rotatedAngleStart+360].
protected int closure
| Constructor Detail |
|---|
public PicEllipse()
public PicEllipse(PicAttributeSet set)
PicEllipse, centered at (0,0), with a null radius, and the given attribute
set.
public PicEllipse(int closure)
PicEllipse, centered at (0,0), with a null radius, the given closure type.
closure - one of CHORD, PIE or OPEN.
public PicEllipse(int closure,
PicAttributeSet set)
closure - one of CHORD, PIE or OPEN.
public PicEllipse(PicPoint p1,
PicPoint p2,
PicPoint p3,
int closure,
PicAttributeSet set)
PicEllipse object using the 3 given points as 3 consecutive points of the
surrounding parallelogram, and the given attribute set.
closure - one of CHORD, PIE or OPEN.
public PicEllipse(PicPoint p1,
PicPoint p2,
PicPoint p3,
int closure)
PicEllipse object using the 3 given points as 3 consecutive points of the
surrounding parallelogram, and a default attribute set.
closure - one of CHORD, PIE or OPEN.public PicEllipse(PicEllipse src)
src - The PicEllipse object to clone| Method Detail |
|---|
public PicEllipse clone()
clone in interface Elementclone in class PicParallelogrampublic String getDefaultName()
getDefaultName in class PicParallelogram
public void setCtrlPt(int numPoint,
PicPoint pt,
EditPointConstraint constraint)
setCtrlPt in interface ElementsetCtrlPt in class PicParallelogramnumPoint - one of P_TL, P_TR, P_BL, P_BR, SIDE_T, SIDE_B, SIDE_L, SIDE_R or P_CENTER.constraint - either null or one of PicParallelogram.EditConstraintpublic void setGeometry(PicEllipse ell)
Element from those of the given source.
This methods fires a DrawingEvent.
public void setGeometry(Arc2D arc)
public PicPoint getCtrlPt(int numPoint,
PicPoint src)
Element is to return an IMMUTABLE instance of PicPoint, so that the only way to alter the
geometry of this element is by calling the setCtrlPt method.
getCtrlPt in interface ElementgetCtrlPt in class PicParallelogramnumPoint - the point index, should be greater or equal to the value returned by
getFirstPointIndex, and lower or equal to getLastPointIndex.
numPoint ;
if src is null, allocates a new PicPoint and return it,
otherwise directly modifies src and returns it as well for convenience.
public void scale(double ptOrgX,
double ptOrgY,
double sx,
double sy,
UserConfirmationCache ucc)
(sx,sy) using (ptOrgX,ptOrgY) as the origin. This
implementation simply apply a scaling transform to all specification-points. Note that sx
and sy may be negative. This method eventually fires a changed-update event.
scale in interface Elementscale in class PicParallelogramucc - une valeur UserConfirmationCache permettant de demander à l'utilisateur
confirmation, de se souvenir de la dernière confirmation qu'il a donné, ou de ses préférences.
public void rotate(PicPoint ptOrg,
double angle)
Element by the given angle along the given point.
rotate in interface Elementrotate in class PicParallelogramangle - rotation angle in radians
public void mirror(PicPoint ptOrg,
PicVector normalVector)
this relativement à l'axe
défini par ptOrg et normalVector.
mirror in interface Elementmirror in class PicParallelogramptOrg - le PicPoint par lequel passe l'axe de réflexion.normalVector - le PicVector normal à l'axe de réflexion.
public void shear(PicPoint ptOrg,
double shx,
double shy,
UserConfirmationCache ucc)
Element by the given params wrt to the given origin.
shear in interface Elementshear in class PicParallelogramucc - une valeur UserConfirmationCache permettant de demander à l'utilisateur
confirmation, de se souvenir de la dernière confirmation qu'il a donné, ou de ses préférences.public PicMultiCurve convertToMultiCurve()
convertToMultiCurve in interface PicMultiCurveConvertableconvertToMultiCurve in class PicParallelogrampublic Shape createShape()
createShape in interface ElementcreateShape in class PicParallelogrampublic Rectangle2D getBoundingBox(Rectangle2D r)
PicParallelogramThis implementation compute the bounding-box from the smallest rectangle that encompasses all the specification-points.
getBoundingBox in interface ElementgetBoundingBox in class PicParallelogram
public void syncArrowGeometry(ArrowView v,
ArrowView.Direction d)
ArrowView only if isArc()==true.
syncArrowGeometry in interface ElementsyncArrowGeometry in class AbstractElementpublic double getRotationAngle()
rotationAnglepublic double getGreatAxisLength()
public double getSmallAxisLength()
public void setAngleStart(double angleStart)
angleStart - The starting angle of the arc, in degrees,
counted COUNTERCLOCKWISE (aka trigonometric),
and measured in the parallelogram basis, ie skewAngleStart.public double getAngleStart()
skewAngleStart, ie the starting angle of the arc in degrees,
measured in the frame defined by the parallelogram.
public void setAngleEnd(double angleEnd)
angleEnd - The angle end of the arc, in degrees,
measured in the frame defined by the parallelogram, ie skewAngleEnd.public double getAngleEnd()
skewAngleEnd, ie angle end of the arc in degrees,
measured in the frame defined by the parallelogram. (value of skewAngleStart)
public void setAngleExtent(double angleExtent)
angleExtent - Angular extent of the arc, in degrees, counted COUNTERCLOCKWISE
as measured in parallelogram basis.public double getAngleExtent()
public double getRotatedAngleStart()
rotatedAngleStart, ie the angle start
of the arc in degrees, as measured in the frame defined by the axes of
the ellipse, that is to say relative to the great axe, and with CW or
CCW orientiation depending on whether getSmallAxisLength() returns a
positive or negative number.
public double getCorrectedAngleStart()
public double getCorrectedAngleEnd()
public double getRotatedAngleEnd()
rotatedAngleEnd, ie the angle end of
the arc in degrees as measured in the frame defined by the axes of the
ellipse, that is to say relative to the great axe, and with CW or CCW
orientiation depending on whether getSmallAxisLength() returns a
positive or negative number.
public double getRotatedAngleExtent()
public int getArcType()
public String getArcTypeAsString()
public void setArcType(int closure)
public int getLastPointIndex()
getCtrlPt.
getLastPointIndex in interface ElementgetLastPointIndex in class PicParallelogrampublic boolean isFlat()
public boolean isCircular()
getSmallAxisLength(),
getGreatAxisLength()public boolean isPlain()
public boolean isArc()
public boolean isRotated()
public void setPlain()
public boolean isClosed()
protected void _updateAxis()
protected void updateAxis()
protected void updateEllipse()
protected void updateRotatedAngles()
public PicVector getTangentAtAngleStart(PicVector pt)
pt - a preallocated PicPoint that get filled with the result ; a new one is allocated if pt==null
public PicVector getTangentAtAngleEnd(PicVector pt)
pt - a preallocated PicPoint that get filled with the result ; a new one is allocated if pt==null
public String toString()
toString in class PicParallelogrampublic AbstractCustomizer createCustomizer()
CustomizerFactory
createCustomizer in interface CustomizerFactorycreateCustomizer in class PicParallelogram
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||