com.caffeineowl.graphics.bezier
Class BezierUtils.MidPointApproxTransformer

java.lang.Object
  extended by com.caffeineowl.graphics.bezier.BezierUtils.MidPointApproxTransformer
All Implemented Interfaces:
CubicSegmentConsumer
Enclosing class:
BezierUtils

static final class BezierUtils.MidPointApproxTransformer
extends java.lang.Object
implements CubicSegmentConsumer

A CubicSegmentConsumer that wraps around a QuadSegmentConsumer and, upon receiving a cubic segment, applies the mid point approximation and passed the resulted segment into the wrapped consumer.


Field Summary
(package private)  QuadSegmentConsumer actualConsumer
          The wrapped consumer.
 
Constructor Summary
BezierUtils.MidPointApproxTransformer(QuadSegmentConsumer readConsumer)
          Constructor
 
Method Summary
 void processSegment(java.awt.geom.CubicCurve2D segment, double startT, double endT)
          Transforms the received cubic segment into a quadratic one by applying the mid-point approximation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

actualConsumer

QuadSegmentConsumer actualConsumer
The wrapped consumer.

Constructor Detail

BezierUtils.MidPointApproxTransformer

BezierUtils.MidPointApproxTransformer(QuadSegmentConsumer readConsumer)
Constructor

Parameters:
readConsumer - the consumer to be used after processing.
Method Detail

processSegment

public void processSegment(java.awt.geom.CubicCurve2D segment,
                           double startT,
                           double endT)
Transforms the received cubic segment into a quadratic one by applying the mid-point approximation. Once the transformation is complete, the resulted segment is fed into the wrapped quad consumer.

Specified by:
processSegment in interface CubicSegmentConsumer
Parameters:
segment - the cubic segment
startT - the value for parameter to which the segment's start corresponds on the original curve.
endT - the value for parameter to which the segment's finish end corresponds on the original curve.