net.sf.latexdraw.glib.models.interfaces
Class GLibUtilities

java.lang.Object
  extended by net.sf.latexdraw.glib.models.interfaces.GLibUtilities

public final class GLibUtilities
extends java.lang.Object

Defines some utilities function for the glib library.

This file is part of LaTeXDraw.
Copyright (c) 2005-2012 Arnaud BLOUIN

LaTeXDraw is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
LaTeXDraw is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

07/03/2009

Since:
3.0
Version:
3.0
Author:
Arnaud BLOUIN

Field Summary
static GLibUtilities INSTANCE
          The singleton.
 
Constructor Summary
private GLibUtilities()
           
 
Method Summary
 double getAltitude(IPoint a, IPoint b, IPoint c)
          Computes the altitude ha of the right-triangle ABC, right in A.
 double[] getBezierCurveMinMax(java.util.List<IPoint> points, int level)
          Defines the min and the max coordinates of the borders of the Bezier curve.
 double getCornerGap(IPoint a, IPoint b, IPoint c, double gap)
          Given a right-rectangle ABC right in A, it computes the gap created by the corner of the triangle in B based on an initial gap.
 boolean isValidCoordinate(double coord)
           
 boolean isValidPoint(double x, double y)
           
 boolean isValidPoint(IPoint pt)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final GLibUtilities INSTANCE
The singleton.

Constructor Detail

GLibUtilities

private GLibUtilities()
Method Detail

isValidPoint

public boolean isValidPoint(IPoint pt)
Parameters:
pt - The point to test.
Returns:
True if the given point is valid (not NaN nor infinite nor null).
Since:
3.0

isValidCoordinate

public boolean isValidCoordinate(double coord)
Parameters:
coord - The value to test.
Returns:
True if the given value is value (not NaN nor infinite).
Since:
3.0

isValidPoint

public boolean isValidPoint(double x,
                            double y)
Parameters:
x - The X coordinates to test.
y - The Y coordinates to test.
Returns:
True if the given values are value (not NaN nor infinite).
Since:
3.0

getAltitude

public double getAltitude(IPoint a,
                          IPoint b,
                          IPoint c)
Computes the altitude ha of the right-triangle ABC, right in A.

Parameters:
a - The point A.
b - The point B.
c - The point C.
Returns:
The altitude ha or 0.
Since:
2.0.0

getCornerGap

public double getCornerGap(IPoint a,
                           IPoint b,
                           IPoint c,
                           double gap)
Given a right-rectangle ABC right in A, it computes the gap created by the corner of the triangle in B based on an initial gap.

Parameters:
a - The point A.
b - The point B.
c - The point C.
gap - The initial gap (for example, the thickness, the double border gap,...).
Returns:
The gap created by the corner of the point B.
Since:
2.0.0

getBezierCurveMinMax

public double[] getBezierCurveMinMax(java.util.List<IPoint> points,
                                     int level)
Defines the min and the max coordinates of the borders of the Bezier curve.

Parameters:
points - The initial control points.
level - The level of resolution.
Returns:
The maximum and the minimum coordinates of the Bezier curve; [minX, minY, maxX, maxY]