Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Updated the script generate the M values properly.
  • Loading branch information
pdz10001 committed Dec 11, 2017
1 parent 9b2b403 commit 476acfd
Show file tree
Hide file tree
Showing 9 changed files with 444 additions and 25 deletions.
20 changes: 14 additions & 6 deletions cli_application.py 100644 → 100755
Expand Up @@ -9,24 +9,32 @@ import sys

from user_interface.curve_parser import parse_curve_file
from logger import get_logger
from data_objects.subdivision_generator import generate_curve_values


class CliApplication(cmd.Cmd):

def __init__(self, application_path=None, application_name="generator", args=None):
def __init__(self, application_path=None, args="test.curve"):
self.logger = get_logger(__name__)
self.curve_paths = os.path.join(application_path, "test_curves")
self.test_curves_path = os.path.join(application_path, "test_curves")
self.arguments = args
self.logger.debug("Test Curves Path is: %s", self.test_curves_path)
self.logger.debug("Arguments are: %s", self.arguments)

self.parse_cmd_args(self.arguments)
sys.exit(1)

def parse_cmd_args(self, args):
if args is not None:
if args.generate_m_value:
self.logger.debug(args.generate_m_value)
if os.path.exists(args.generate_m_value):
self.generate_m_value(args.generate_m_value)
if os.path.isdir(args.generate_m_value):
self.logger.error("Please input a filename not a directory name.")
else:
self.generate_m_value(args.generate_m_value)
else:
curve_path = os.path.join(self.curve_paths, args.generate_m_value)
curve_path = os.path.join(self.test_curves_path, args.generate_m_value)
if os.path.exists(curve_path):
self.generate_m_value(curve_path)
else:
Expand All @@ -36,7 +44,7 @@ class CliApplication(cmd.Cmd):

def generate_m_value(self, curve_file="test.curve"):
knot_curve = parse_curve_file(curve_file)

generate_curve_values(knot_curve.get_points_as_np_arrays())
pass


Expand All @@ -53,7 +61,7 @@ def main():
arguments = argument_parser.parse_args()

get_logger().debug("Subdivision-Generator Starting Up")
application = CliApplication(application_path, application_name, arguments)
application = CliApplication(application_path, arguments)


if __name__ == "__main__":
Expand Down
Empty file removed data_objects/generator.py
Empty file.
13 changes: 13 additions & 0 deletions data_objects/stick_knot.py
Expand Up @@ -3,6 +3,7 @@
@author Peter Zaffetti 2017
"""
from point import Point
import numpy as np


class StickKnot:
Expand All @@ -13,3 +14,15 @@ class StickKnot:

def get_points(self):
return self.knot_points

def get_points_as_np_arrays(self):
'''
:return: the array of numpy arrays of point x, y, z values that make up the stick knot
'''
points = list()

for point in self.knot_points:
numpy_point = np.array([point.get_x(), point.get_y(), point.get_z()])
points.append(numpy_point)

return points

0 comments on commit 476acfd

Please sign in to comment.