DynamicPathMorph class
Class for controlling the morphing of two shapes what it does basically is try to make the two shape having the same number of control points.
If both shape have only a few control points (smaller than maxControlPoints), the more elegant way to morph should be making as little sides to bend as possible (morphing a rectangle to a triangle, we would want only one of the sides of the triangle to bend into two sides of the rectangle). The total control points in this case should be max(points1, points2). And we use a Monte Carlo (with a maxTrial) to determine which sides to put the extra control points (on the shape that has less control points) will make the total amount of travel the control points need to morph minimal.
If one of the shape has many control points, the Monte Carlo is not guaranteed to find the optimal solution in time. In this case, we set the total control points to be lcm(points1, points2) and then we can supply equal number of extra control points to each side of each shape. The morphing may not be the best looking, but since at least one of the shapes is pretty complicated, this method saves time and gives generally acceptable results (I don't think there is a good way to morph a rounded rectangle into a 30 corner star without some weird shape in between).
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
centerOfMass(
List< Offset> points) → Offset -
computeMinimumOffsetIndex(
List< Offset> points1, List<Offset> points2) → int -
computeTotalMorphWeight(
List< Offset> points1, List<Offset> points2, {Offset origin = Offset.zero}) → double -
computeTotalOffset(
List< Offset> points1, List<Offset> points2, {int shift = 0}) → double -
estimateCombinationsOf(
int n, int k, {int maximum = 10000000}) → int -
generateAllSupplyCounts(
int totalPoints, int slots) → List< List< int> > -
lerpPaths(
double t, DynamicPath beginPath, DynamicPath endPath) → DynamicPath -
randomChoose(
List< num> list) → int -
sampleBorderPathsFromShape(
MorphShapeData data, {int maxTrial = 960, int minControlPoints = 12, int maxControlPoints = 240}) → void -
sampleDynamicPaths(
MorphShapeData data, DynamicPath path1, DynamicPath path2, {required bool isSameMorphGeometry, required int maxTrial, required int minControlPoints, required int maxControlPoints}) → void -
sampleSupplyCounts(
DynamicPath path, int totalPointsCount, {bool weightBased = true, List< int> ? oldCounts}) → List<int> -
supplyList(
List list, List< int> counts) → List -
supplyPoints(
DynamicPath path, List< int> supplyCounts) → DynamicPath -
unweightedSampling(
DynamicPath path1, DynamicPath path2, {required int maxControlPoints, required Offset origin}) → List -
weightedSampling(
DynamicPath path1, DynamicPath path2, {required int minControlPoints, required int maxTrial, required Offset origin}) → List