Skip to content
Snippets Groups Projects
Commit c06f76b0 authored by Alan Odom's avatar Alan Odom Committed by Rune Morling
Browse files

PDT: Revise Docstrings

Made functions more understandable by improving DocStrings
parent ee577f16
No related branches found
No related tags found
No related merge requests found
......@@ -113,6 +113,7 @@ def get_tangent_points(context, hloc_0, vloc_0, radius_0, hloc_p, vloc_p):
vloc_t1: Vertical Location of First Tangent Point
vloc_t2: Vertical Location of Second Tangent Point
"""
numerator = (radius_0 ** 2 * (hloc_p - hloc_0)) + (
radius_0
* (vloc_p - vloc_0)
......@@ -202,7 +203,23 @@ def make_vectors(coords, a1, a2, a3, pg):
def tangent_setup(context, pg, plane, obj_data, centre_0, centre_1, centre_2, radius_0, radius_1):
# Depth is a3
"""This section sets up all the variables required for the tangent functions.
Args:
context: Blender bpy.context instance
pg: PDT Parameter Group of variables
plane: Working plane
obj_data: All the data of the chosen object
centre_0: Centre coordinates of the first arc
centre_1: Centre coordinates of the second arc
centre_2: Coordinates fo the point
radius_0: Radius if the first Arc
radius_1: Radius of the second Arc
Returns:
Status Set.
"""
a1, a2, a3 = set_mode(plane)
mode = pg.tangent_mode
if plane == "LO":
......@@ -226,6 +243,11 @@ def tangent_setup(context, pg, plane, obj_data, centre_0, centre_1, centre_2, ra
context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
return {"FINISHED"}
"""This next section will draw Point based Tangents.
These are drawn from a point to an Arc
"""
if mode == "point":
if (
(centre_2[a1] - centre_0[a1]) ** 2 + (centre_2[a2] - centre_0[a2]) ** 2 - radius_0 ** 2
......@@ -259,8 +281,12 @@ def tangent_setup(context, pg, plane, obj_data, centre_0, centre_1, centre_2, ra
return {"FINISHED"}
"""This next section will draw Arc based Outer Tangents.
These are drawn from an Arc to another Arc
"""
if mode in {"outer", "both"}:
# Outer Tangents
if radius_0 == radius_1:
# No intersection point for outer tangents
sin_angle = (centre_1[a2] - centre_0[a2]) / distance
......@@ -310,8 +336,12 @@ def tangent_setup(context, pg, plane, obj_data, centre_0, centre_1, centre_2, ra
tangent_vectors = make_vectors(coords_in, a1, a2, a3, pg)
draw_tangents(tangent_vectors, obj_data)
"""This next section will draw Arc based Inner Tangents.
These are drawn from an Arc to another Arc
"""
if mode in {"inner", "both"}:
# Inner Tangents
hloc_pi, vloc_pi = get_tangent_intersect_inner(
centre_0[a1], centre_0[a2], centre_1[a1], centre_1[a2], radius_0, radius_1
)
......@@ -347,6 +377,8 @@ def tangent_setup(context, pg, plane, obj_data, centre_0, centre_1, centre_2, ra
tangent_vectors = make_vectors(coords_in, a1, a2, a3, pg)
draw_tangents(tangent_vectors, obj_data)
return {"FINISHED"}
def draw_tangents(tangent_vectors, obj_data):
"""Add Edges Representing the Tangents.
......@@ -452,7 +484,6 @@ class PDT_OT_TangentOperate(Operator):
Returns:
Nothing.
"""
scene = context.scene
pg = scene.pdt_pg
plane = pg.plane
......
......@@ -460,7 +460,7 @@ def command_parse(context):
obj_loc = obj.matrix_world.decompose()[0]
verts = []
else:
if operation not in {"G"}:
if operation != "G":
pg.error = PDT_OBJ_MODE_ERROR
context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
raise PDT_ObjectModeError
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment