org.knime.base.node.viz.pie.util
Class GeometryUtil

java.lang.Object
  extended by org.knime.base.node.viz.pie.util.GeometryUtil

public final class GeometryUtil
extends Object

Helper class for geometric calculations.

Author:
Tobias Koetter, University of Konstanz

Method Summary
static double calculateMidAngle(Arc2D arc)
          Calculated the mid angle of the given arc.
static double calculatePartialExtent(Arc2D arc, double fraction)
           
static Arc2D calculateSubArc(Arc2D arc, double fraction)
          Calculates a sub arc that lies in the given arc.
static Rectangle2D getArcBounds(Rectangle2D unexploded, Rectangle2D exploded, double angle, double extent, double explodePercent)
          Returns a rectangle that can be used to create a pie section (taking into account the amount by which the pie section is 'exploded').
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

calculateSubArc

public static Arc2D calculateSubArc(Arc2D arc,
                                    double fraction)
Calculates a sub arc that lies in the given arc.

Parameters:
arc - the basic arc
fraction - the fraction defines the size of the new arc in comparison to the basic arc in percentage 0.9 = 90%
Returns:
the arc

calculatePartialExtent

public static double calculatePartialExtent(Arc2D arc,
                                            double fraction)
Parameters:
arc - the basic arc
fraction - the fraction defines the size of the extend in comparison to the extend of the basic arc in percentage 0.9 = 90%
Returns:
the fraction of the basic arc extend

getArcBounds

public static Rectangle2D getArcBounds(Rectangle2D unexploded,
                                       Rectangle2D exploded,
                                       double angle,
                                       double extent,
                                       double explodePercent)
Returns a rectangle that can be used to create a pie section (taking into account the amount by which the pie section is 'exploded').

Parameters:
unexploded - the area inside which the unexploded pie sections are drawn.
exploded - the area inside which the exploded pie sections are drawn.
angle - the start angle.
extent - the extent of the arc.
explodePercent - the percent the new arc should reach into the explode area. 1.0 means the section should be shifted to the border of the explode area.
Returns:
A rectangle that can be used to create a pie section.

calculateMidAngle

public static double calculateMidAngle(Arc2D arc)
Calculated the mid angle of the given arc.

Parameters:
arc - the Arc2D to calculate the mid angle for
Returns:
the mid angle of the given arc


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.