From 9b2b4035622b09d95993ece5a85a028a48904d9b Mon Sep 17 00:00:00 2001 From: Pzaff Date: Wed, 18 Oct 2017 23:18:45 -0400 Subject: [PATCH] Fixed an overflow error in the original python script causing the Euclidean distance between points to be incorrect. Hardcoded the M1 value for testing purposes. This needs to be changed to be dynamically calculated by fixing the multiplication overflow. --- generator/__init__.py | 0 generator/old_parser.py | 33 --------------------------------- subdivision_generator_orig.py | 15 +++++++-------- 3 files changed, 7 insertions(+), 41 deletions(-) delete mode 100644 generator/__init__.py delete mode 100644 generator/old_parser.py diff --git a/generator/__init__.py b/generator/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/generator/old_parser.py b/generator/old_parser.py deleted file mode 100644 index 0a63575..0000000 --- a/generator/old_parser.py +++ /dev/null @@ -1,33 +0,0 @@ -# #!/usr/bin/env python -# """ -# @author Peter Zaffetti 2017 -# """ -# class Parser: -# -# def __init__(self): -# pass -# -# def parse_curve(curve_filename=None): -# -# if curve_filename is None: -# return None -# -# curve_file = open(curve_filename, "r") -# -# -# for line in curve_file: -# comment_parts = "" -# curve_points = list() -# -# if line.startswith("%"): -# continue -# elif "%" in line: -# comment_parts = line.split("%") -# -# if comment_parts is not None: -# curve_string = comment_parts[0] -# curve_points = curve_string.split(",") -# else: -# curve_points = line.split(",") -# -# if len(curve_points) == 3: \ No newline at end of file diff --git a/subdivision_generator_orig.py b/subdivision_generator_orig.py index f3f9e05..33abdc7 100644 --- a/subdivision_generator_orig.py +++ b/subdivision_generator_orig.py @@ -82,12 +82,8 @@ def closestDistanceBetweenLines(a0, a1, b0, b1, clampAll=False, clampA0=False, c Calculate the distance of the line segment between the start and end points ''' def distanceBetweenTwoPoints(startPoint, endPoint): - x = endPoint[0] - startPoint[0] - y = endPoint[1] - startPoint[1] - z = endPoint[2] - startPoint[2] + return np.linalg.norm(endPoint - startPoint) - # return math.sqrt( x*x + y*y + z*z) - return (x * x + y * y + z * z) ** (0.5) ''' A function used to reduce a line segment between the startPoint and the endPoint @@ -176,11 +172,14 @@ def omegaOne(listOfControlPoints): to properly associate with its correct bezier curve ''' def generateM1(omegaOne, delta): - omegaOneSquared = omegaOne * omegaOne + # omegaOneSquared = omegaOne * omegaOne + omegaOneSquared = np.multiply(omegaOne, omegaOne) deltaSquared = delta * delta intermediate = ((float(7) / float(16) * omegaOneSquared * (1 / deltaSquared)) - (float(1) / float(7))) - logResult = math.log(intermediate, 2) - return math.ceil(logResult) + # logResult = math.log(intermediate, 2) + # return math.ceil(logResult) + # TODO: PDZ- This needs to NOT be hardcoded. Need to figure out a way to multiply omegaOne * omegaOne and not get an overflow. Then the two lines above can be uncommented. + return math.ceil(90.958811263220) ''' Generates the hodograph delta sub 2 set from Professor Peters' and Ji Li's paper. It is defined in the paper