|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component net.sourceforge.webcompmath.draw.Drawable net.sourceforge.webcompmath.draw.RiemannSlice
public class RiemannSlice
A RiemannSlice shows one slice in a Riemann sum, useful for area and volume applets. It can show a rectangle (for area Riemann sums), washer (for volumes of revolution), various geometric shapes (for volumes of known cross section) or a segment of a circle for polar area. The volume types are designed to give a 3d look.
Washers and some known cross section shapes come in two halves. You add the rear half to a DisplayCanvas before the other drawables, then add the front half at the end. This improves the 3d effect. You can use a partly transparent fill color (which is the default) to help enhance things.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
static int |
CIRCLE_FRONT
Circle cross section with diameter along the base. |
static int |
CIRCLE_REAR
Circle cross section with diameter along the base. |
static int |
CIRCUMSCRIBED
Slice method type: circumscribed (maximum value on the rectangle's interval) |
static int |
EQUILATERAL
Equilateral triangle cross section with side along the base. |
static int |
INSCRIBED
Slice method type: inscribed (minimum value on the rectangle's interval) |
static int |
ISOSCELES_HYP
Right isosceles triangle cross section with hypotenuse along the base. |
static int |
ISOSCELES_LEG
Right isosceles triangle cross section with leg along the base. |
static int |
LEFTENDPOINT
Slice method type: left end point |
protected int |
lineWidth
The width, in pixels, of the outlines of the rects. |
static int |
MIDPOINT
Slice method type: mid point |
static int |
POLAR
Circular segment used for polar areas |
static int |
RECTANGLE
Rectangle (or trapezoid) shape |
static int |
RIGHTENDPOINT
Slice method type: right end point |
static int |
SEMICIRCLE
Semicircle cross section with diameter along the base. |
static int |
SQUARE_DIAG_FRONT
Square cross section with diagonal along the base. |
static int |
SQUARE_DIAG_REAR
Square cross section with diagonal along the base. |
static int |
SQUARE_SIDE
Square cross section with side along the base. |
static int |
TRAPEZOID
Slice method type: trapezoid (only recommended for RECTANGLE shape) |
static int |
WASHER_FRONT
Front half of washer |
static int |
WASHER_REAR
Rear half of washer |
Fields inherited from class net.sourceforge.webcompmath.draw.Drawable |
---|
canvas, coords |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
RiemannSlice()
Construct a RiemannSumRects object that initially has nothing to draw and that is set up to use the default number of intervals, 5. |
|
RiemannSlice(Function uf,
Function lf,
Value coord,
int method,
int shape)
Construct a new RiemannSlice object. |
Method Summary | |
---|---|
void |
compute()
This is generally called by a Controller. |
void |
draw(java.awt.Graphics g,
boolean coordsChanged)
Draw the Rieman slice. |
float |
getAspect()
Get the aspect ratio |
Value |
getAxis()
Get the axis of revolution |
Value |
getCoordinate()
Get the coordinate where the slice is to be drawn. |
java.awt.Color |
getFillColor()
Get the current fill color |
int |
getLineWidth()
Get the width, in pixels, of outline lines. |
Function |
getLowerFuction()
Returns the lower function. |
int |
getMethod()
Return the current method used to draw the slice |
java.awt.Color |
getOutlineColor()
Get the color that is used to draw outlines around the rects. |
int |
getShape()
Get the shape for this slice. |
float |
getSlant()
Get the amount of slant offset |
float |
getSliceWidth()
Get the width of the slice, in pixels. |
Function |
getUpperFuction()
Returns the upper function for the Riemann slice. |
Value |
getXMax()
Get the max x value |
Value |
getXMin()
Get the min x value |
boolean |
isInverse()
Get whether to display inverse version |
void |
setAspect(float aspect)
Set the aspect ration (width to height). |
void |
setAxis(Value axis)
Set the axis of revolution. |
void |
setCoordinate(Value coordinate)
Set the coordinate where the slice is to be drawn. |
void |
setFillColor(java.awt.Color c)
Set the fill color. |
void |
setInverse(boolean inverse)
Set whether to show as inverse. |
void |
setLineWidth(int width)
Set the width, in pixels, of outline lines. |
void |
setLowerFunction(Function func)
Set the lower function, when computing area between curves. |
void |
setMethod(int m)
Set the method used to draw the slice. |
void |
setOutlineColor(java.awt.Color c)
Set the color that will be used to draw outlines around the rects. |
void |
setShape(int shape)
Set the shape for this slice. |
void |
setSlant(float slant)
Set the slant offset. |
void |
setSliceWidth(float width)
Set the width of the slice. |
void |
setUpperFunction(Function func)
Set the upper function that defines the top of the slice. |
void |
setXMax(Value max)
Set the max x value. |
void |
setXMin(Value min)
Set the min x value. |
Methods inherited from class net.sourceforge.webcompmath.draw.Drawable |
---|
getVisible, needsRedraw, setOwnerData, setVisible |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int lineWidth
public static final int LEFTENDPOINT
public static final int RIGHTENDPOINT
public static final int MIDPOINT
public static final int CIRCUMSCRIBED
public static final int INSCRIBED
public static final int TRAPEZOID
public static final int RECTANGLE
public static final int WASHER_FRONT
public static final int WASHER_REAR
public static final int SQUARE_SIDE
public static final int SQUARE_DIAG_FRONT
public static final int SQUARE_DIAG_REAR
public static final int SEMICIRCLE
public static final int CIRCLE_FRONT
public static final int CIRCLE_REAR
public static final int EQUILATERAL
public static final int ISOSCELES_HYP
public static final int ISOSCELES_LEG
public static final int POLAR
Constructor Detail |
---|
public RiemannSlice()
public RiemannSlice(Function uf, Function lf, Value coord, int method, int shape)
uf
- upper functionlf
- the lower function, may be null to use the horizontal axiscoord
- a Value object representing the coordinate where the slice is
to be drawnmethod
- the sum method; default is LEFTENDPOINTshape
- the slice shape; default is RECTANGLEMethod Detail |
---|
public java.awt.Color getFillColor()
public void setFillColor(java.awt.Color c)
c
- fill colorpublic void setOutlineColor(java.awt.Color c)
c
- outline colorpublic java.awt.Color getOutlineColor()
public void setUpperFunction(Function func)
func
- function for top of slicepublic Function getUpperFuction()
public void setLowerFunction(Function func)
func
- lower functionpublic Function getLowerFuction()
public void setMethod(int m)
m
- can be: LEFTENDPOINT, RIGHTENDPOINT, MIDPOINT, CIRCUMSCRIBED,
INSCRIBED or TRAPEZOID (these are integers ranging from 0 to
5, respectively) TRAPEZOID is not valid for POLAR.public int getMethod()
public Value getCoordinate()
public void setCoordinate(Value coordinate)
coordinate
- the coordinate to setpublic int getShape()
public void setShape(int shape)
shape
- the shape to setpublic float getSliceWidth()
public void setSliceWidth(float width)
width
- the width to setpublic void setLineWidth(int width)
width
- line widthpublic int getLineWidth()
public boolean isInverse()
public void setInverse(boolean inverse)
inverse
- true for inversepublic Value getXMax()
public void setXMax(Value max)
max
- The xMax to set.public Value getXMin()
public void setXMin(Value min)
min
- The xMin to set.public Value getAxis()
public void setAxis(Value axis)
axis
- the axis to setpublic float getAspect()
public void setAspect(float aspect)
aspect
- the aspect to setpublic float getSlant()
public void setSlant(float slant)
slant
- the slant to setpublic void compute()
compute
in interface Computable
public void draw(java.awt.Graphics g, boolean coordsChanged)
draw
in class Drawable
g
- graphics contextcoordsChanged
- true or false
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |