Skip to content

Commit

Permalink
Fixed an overflow error in the original python script causing the Euc…
Browse files Browse the repository at this point in the history
…lidean 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.
  • Loading branch information
pdz10001 committed Oct 19, 2017
1 parent e7fdbe7 commit 9b2b403
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 41 deletions.
Empty file removed generator/__init__.py
Empty file.
33 changes: 0 additions & 33 deletions generator/old_parser.py

This file was deleted.

15 changes: 7 additions & 8 deletions subdivision_generator_orig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9b2b403

Please sign in to comment.