Skip navigation links
WebARTS Design
Java Library

Version 0.10.2
2020-11-11 (Wed), 10:42:54
org.jdesktop.swingx.geom

## Class Morphing2D

• All Implemented Interfaces:
Shape

```public class Morphing2D
extends Object
implements Shape```

A morphing shape is a shape which geometry is constructed from two other shapes: a start shape and an end shape.

The morphing property of a morphing shape defines the amount of transformation applied to the start shape to turn it into the end shape.

Both shapes must have the same winding rule.

Author:
Jim Graham, Romain Guy (Maintainer)
• ### Nested Class Summary

Nested Classes
Modifier and Type Class and Description
`private static class ` `Morphing2D.Geometry`
`private static class ` `Morphing2D.Iterator`
• ### Field Summary

Fields
Modifier and Type Field and Description
`private Morphing2D.Geometry` `endGeometry`
`private double` `morph`
`private Morphing2D.Geometry` `startGeometry`
• ### Constructor Summary

Constructors
Constructor and Description
```Morphing2D(Shape startShape, Shape endShape)```
Creates a new morphing shape.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`boolean` ```contains(double x, double y)```
`boolean` ```contains(double x, double y, double w, double h)```
`boolean` `contains(Point2D p)`
`boolean` `contains(Rectangle2D r)`
`Rectangle` `getBounds()`
`Rectangle2D` `getBounds2D()`
`double` `getMorphing()`
Returns the morphing value between the two shapes.
`PathIterator` `getPathIterator(AffineTransform at)`
`PathIterator` ```getPathIterator(AffineTransform at, double flatness)```
`private static double` ```interp(double v0, double v1, double t)```
`boolean` ```intersects(double x, double y, double w, double h)```
`boolean` `intersects(Rectangle2D r)`
`private static double[]` ```mergeTvals(double[] tvals0, double[] tvals1)```
`void` `setMorphing(double morph)`
Sets the morphing value between the two shapes.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

• #### morph

`private double morph`
• #### startGeometry

`private Morphing2D.Geometry startGeometry`
• #### endGeometry

`private Morphing2D.Geometry endGeometry`
• ### Constructor Detail

• #### Morphing2D

```public Morphing2D(Shape startShape,
Shape endShape)```

Creates a new morphing shape. A morphing shape can be used to turn one shape into another one. The transformation can be controlled by the morph property.

Parameters:
`startShape` - the shape to morph from
`endShape` - the shape to morph to
Throws:
`IllegalPathStateException` - if the shapes do not have the same winding rule
See Also:
`getMorphing()`, `setMorphing(double)`
• ### Method Detail

• #### getMorphing

`public double getMorphing()`

Returns the morphing value between the two shapes.

Returns:
the morphing value between the two shapes
See Also:
`setMorphing(double)`
• #### setMorphing

`public void setMorphing(double morph)`

Sets the morphing value between the two shapes. This value controls the transformation from the start shape to the end shape. A value of 0.0 is the start shape. A value of 1.0 is the end shape. A value of 0.5 is a new shape, morphed half way from the start shape to the end shape.

The specified value should be between 0.0 and 1.0. If not, the value is clamped in the appropriate range.

Parameters:
`morph` - the morphing value between the two shapes
See Also:
`getMorphing()`
• #### interp

```private static double interp(double v0,
double v1,
double t)```
• #### mergeTvals

```private static double[] mergeTvals(double[] tvals0,
double[] tvals1)```
• #### getBounds

`public Rectangle getBounds()`
Specified by:
`getBounds` in interface `Shape`
• #### getBounds2D

`public Rectangle2D getBounds2D()`
Specified by:
`getBounds2D` in interface `Shape`
• #### contains

```public boolean contains(double x,
double y)```
Specified by:
`contains` in interface `Shape`
• #### contains

`public boolean contains(Point2D p)`
Specified by:
`contains` in interface `Shape`
• #### intersects

```public boolean intersects(double x,
double y,
double w,
double h)```
Specified by:
`intersects` in interface `Shape`
• #### intersects

`public boolean intersects(Rectangle2D r)`
Specified by:
`intersects` in interface `Shape`
• #### contains

```public boolean contains(double x,
double y,
double w,
double h)```
Specified by:
`contains` in interface `Shape`
• #### contains

`public boolean contains(Rectangle2D r)`
Specified by:
`contains` in interface `Shape`
• #### getPathIterator

`public PathIterator getPathIterator(AffineTransform at)`
Specified by:
`getPathIterator` in interface `Shape`
• #### getPathIterator

```public PathIterator getPathIterator(AffineTransform at,
double flatness)```
Specified by:
`getPathIterator` in interface `Shape`
Skip navigation links
Copyright (C) 2001-2021, Tom B. Gutwin

WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses