From 101567f5f16d91a13c8067764d5e14eefb2b9936 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 15 Mar 2014 16:54:34 +0100 Subject: FloatUtil/VectorUtil: Enhance isEqual/compare w/ and w/o epsilon, add unit tests - Cleanup VectorUtil (vec2/3 naming, remove dedundant functions) --- src/jogl/classes/com/jogamp/graph/geom/Outline.java | 2 +- src/jogl/classes/com/jogamp/graph/geom/SVertex.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/jogl/classes/com/jogamp/graph/geom') diff --git a/src/jogl/classes/com/jogamp/graph/geom/Outline.java b/src/jogl/classes/com/jogamp/graph/geom/Outline.java index 9d4d1f26d..80aea2af4 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/Outline.java +++ b/src/jogl/classes/com/jogamp/graph/geom/Outline.java @@ -172,7 +172,7 @@ public class Outline implements Cloneable, Comparable { if( !isEmpty() ) { final Vertex first = vertices.get(0); final Vertex last = getLastVertex(); - if( !VectorUtil.checkEquality( first.getCoord(), last.getCoord() ) ) { + if( !VectorUtil.isVec3Equal( first.getCoord(), 0, last.getCoord(), 0, FloatUtil.EPSILON ) ) { if( closeTail ) { vertices.add(first.clone()); } else { diff --git a/src/jogl/classes/com/jogamp/graph/geom/SVertex.java b/src/jogl/classes/com/jogamp/graph/geom/SVertex.java index 99f10a694..beac908d4 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/SVertex.java +++ b/src/jogl/classes/com/jogamp/graph/geom/SVertex.java @@ -27,6 +27,7 @@ */ package com.jogamp.graph.geom; +import com.jogamp.opengl.math.FloatUtil; import com.jogamp.opengl.math.VectorUtil; /** A Simple Vertex Implementation. Where the coordinates, and other attributes are @@ -188,8 +189,8 @@ public class SVertex implements Vertex { final Vertex v = (Vertex) obj; return this == v || isOnCurve() == v.isOnCurve() && - VectorUtil.checkEqualityVec2(getTexCoord(), v.getTexCoord()) && - VectorUtil.checkEquality(getCoord(), v.getCoord()) ; + VectorUtil.isVec2Equal(getTexCoord(), 0, v.getTexCoord(), 0, FloatUtil.EPSILON) && + VectorUtil.isVec3Equal(getCoord(), 0, v.getCoord(), 0, FloatUtil.EPSILON) ; } @Override -- cgit v1.2.3