repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
dhermes/bezier
docs/make_images.py
surface_subdivide1
def surface_subdivide1(): """Image for :meth`.Surface.subdivide` docstring.""" if NO_IMAGES: return surface = bezier.Surface.from_nodes( np.asfortranarray([[0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]) ) surf_a, surf_b, surf_c, surf_d = surface.subdivide() figure, ((ax1, ax2), (ax3, ax4)) ...
python
def surface_subdivide1(): """Image for :meth`.Surface.subdivide` docstring.""" if NO_IMAGES: return surface = bezier.Surface.from_nodes( np.asfortranarray([[0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]) ) surf_a, surf_b, surf_c, surf_d = surface.subdivide() figure, ((ax1, ax2), (ax3, ax4)) ...
[ "def", "surface_subdivide1", "(", ")", ":", "if", "NO_IMAGES", ":", "return", "surface", "=", "bezier", ".", "Surface", ".", "from_nodes", "(", "np", ".", "asfortranarray", "(", "[", "[", "0.0", ",", "1.0", ",", "0.0", "]", ",", "[", "0.0", ",", "0.0...
Image for :meth`.Surface.subdivide` docstring.
[ "Image", "for", ":", "meth", ".", "Surface", ".", "subdivide", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L535-L585
dhermes/bezier
docs/make_images.py
surface_subdivide2
def surface_subdivide2(surface, sub_surface_b): """Image for :meth`.Surface.subdivide` docstring.""" if NO_IMAGES: return # Plot set-up. figure = plt.figure() ax = figure.gca() colors = seaborn.husl_palette(6) N = 128 s_vals = np.linspace(0.0, 1.0, N + 1) # Add edges from su...
python
def surface_subdivide2(surface, sub_surface_b): """Image for :meth`.Surface.subdivide` docstring.""" if NO_IMAGES: return # Plot set-up. figure = plt.figure() ax = figure.gca() colors = seaborn.husl_palette(6) N = 128 s_vals = np.linspace(0.0, 1.0, N + 1) # Add edges from su...
[ "def", "surface_subdivide2", "(", "surface", ",", "sub_surface_b", ")", ":", "if", "NO_IMAGES", ":", "return", "# Plot set-up.", "figure", "=", "plt", ".", "figure", "(", ")", "ax", "=", "figure", ".", "gca", "(", ")", "colors", "=", "seaborn", ".", "hus...
Image for :meth`.Surface.subdivide` docstring.
[ "Image", "for", ":", "meth", ".", "Surface", ".", "subdivide", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L600-L635
dhermes/bezier
docs/make_images.py
curved_polygon_constructor1
def curved_polygon_constructor1(curved_poly): """Image for :class`.CurvedPolygon` docstring.""" if NO_IMAGES: return ax = curved_poly.plot(256) ax.axis("scaled") ax.set_xlim(-0.125, 2.125) ax.set_ylim(-0.625, 1.625) save_image(ax.figure, "curved_polygon_constructor1.png")
python
def curved_polygon_constructor1(curved_poly): """Image for :class`.CurvedPolygon` docstring.""" if NO_IMAGES: return ax = curved_poly.plot(256) ax.axis("scaled") ax.set_xlim(-0.125, 2.125) ax.set_ylim(-0.625, 1.625) save_image(ax.figure, "curved_polygon_constructor1.png")
[ "def", "curved_polygon_constructor1", "(", "curved_poly", ")", ":", "if", "NO_IMAGES", ":", "return", "ax", "=", "curved_poly", ".", "plot", "(", "256", ")", "ax", ".", "axis", "(", "\"scaled\"", ")", "ax", ".", "set_xlim", "(", "-", "0.125", ",", "2.125...
Image for :class`.CurvedPolygon` docstring.
[ "Image", "for", ":", "class", ".", "CurvedPolygon", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L638-L647
dhermes/bezier
docs/make_images.py
curve_specialize
def curve_specialize(curve, new_curve): """Image for :meth`.Curve.specialize` docstring.""" if NO_IMAGES: return ax = curve.plot(256) interval = r"$\left[0, 1\right]$" line = ax.lines[-1] line.set_label(interval) color1 = line.get_color() new_curve.plot(256, ax=ax) interval ...
python
def curve_specialize(curve, new_curve): """Image for :meth`.Curve.specialize` docstring.""" if NO_IMAGES: return ax = curve.plot(256) interval = r"$\left[0, 1\right]$" line = ax.lines[-1] line.set_label(interval) color1 = line.get_color() new_curve.plot(256, ax=ax) interval ...
[ "def", "curve_specialize", "(", "curve", ",", "new_curve", ")", ":", "if", "NO_IMAGES", ":", "return", "ax", "=", "curve", ".", "plot", "(", "256", ")", "interval", "=", "r\"$\\left[0, 1\\right]$\"", "line", "=", "ax", ".", "lines", "[", "-", "1", "]", ...
Image for :meth`.Curve.specialize` docstring.
[ "Image", "for", ":", "meth", ".", "Curve", ".", "specialize", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L677-L709
dhermes/bezier
docs/make_images.py
newton_refine_surface
def newton_refine_surface(surface, x_val, y_val, s, t, new_s, new_t): """Image for :func:`._surface_helpers.newton_refine` docstring.""" if NO_IMAGES: return figure, (ax1, ax2) = plt.subplots(1, 2) # Plot features of the parameter space in ax1. tri_surf = bezier.Surface.from_nodes( ...
python
def newton_refine_surface(surface, x_val, y_val, s, t, new_s, new_t): """Image for :func:`._surface_helpers.newton_refine` docstring.""" if NO_IMAGES: return figure, (ax1, ax2) = plt.subplots(1, 2) # Plot features of the parameter space in ax1. tri_surf = bezier.Surface.from_nodes( ...
[ "def", "newton_refine_surface", "(", "surface", ",", "x_val", ",", "y_val", ",", "s", ",", "t", ",", "new_s", ",", "new_t", ")", ":", "if", "NO_IMAGES", ":", "return", "figure", ",", "(", "ax1", ",", "ax2", ")", "=", "plt", ".", "subplots", "(", "1...
Image for :func:`._surface_helpers.newton_refine` docstring.
[ "Image", "for", ":", "func", ":", ".", "_surface_helpers", ".", "newton_refine", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L712-L763
dhermes/bezier
docs/make_images.py
classify_intersection1
def classify_intersection1(s, curve1, tangent1, curve2, tangent2): """Image for :func:`._surface_helpers.classify_intersection` docstring.""" if NO_IMAGES: return surface1 = bezier.Surface.from_nodes( np.asfortranarray( [[1.0, 1.75, 2.0, 1.0, 1.5, 1.0], [0.0, 0.25, 1.0, 1.0, 1.5...
python
def classify_intersection1(s, curve1, tangent1, curve2, tangent2): """Image for :func:`._surface_helpers.classify_intersection` docstring.""" if NO_IMAGES: return surface1 = bezier.Surface.from_nodes( np.asfortranarray( [[1.0, 1.75, 2.0, 1.0, 1.5, 1.0], [0.0, 0.25, 1.0, 1.0, 1.5...
[ "def", "classify_intersection1", "(", "s", ",", "curve1", ",", "tangent1", ",", "curve2", ",", "tangent2", ")", ":", "if", "NO_IMAGES", ":", "return", "surface1", "=", "bezier", ".", "Surface", ".", "from_nodes", "(", "np", ".", "asfortranarray", "(", "[",...
Image for :func:`._surface_helpers.classify_intersection` docstring.
[ "Image", "for", ":", "func", ":", ".", "_surface_helpers", ".", "classify_intersection", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L797-L836
dhermes/bezier
docs/make_images.py
classify_intersection2
def classify_intersection2(s, curve1, curve2): """Image for :func:`._surface_helpers.classify_intersection` docstring.""" if NO_IMAGES: return surface1 = bezier.Surface.from_nodes( np.asfortranarray( [[1.0, 1.5, 2.0, 1.25, 1.75, 1.5], [0.0, 1.0, 0.0, 1.0, 1.0, 2.0]] ) ...
python
def classify_intersection2(s, curve1, curve2): """Image for :func:`._surface_helpers.classify_intersection` docstring.""" if NO_IMAGES: return surface1 = bezier.Surface.from_nodes( np.asfortranarray( [[1.0, 1.5, 2.0, 1.25, 1.75, 1.5], [0.0, 1.0, 0.0, 1.0, 1.0, 2.0]] ) ...
[ "def", "classify_intersection2", "(", "s", ",", "curve1", ",", "curve2", ")", ":", "if", "NO_IMAGES", ":", "return", "surface1", "=", "bezier", ".", "Surface", ".", "from_nodes", "(", "np", ".", "asfortranarray", "(", "[", "[", "1.0", ",", "1.5", ",", ...
Image for :func:`._surface_helpers.classify_intersection` docstring.
[ "Image", "for", ":", "func", ":", ".", "_surface_helpers", ".", "classify_intersection", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L839-L857
dhermes/bezier
docs/make_images.py
classify_intersection5
def classify_intersection5(s, curve1, curve2): """Image for :func:`._surface_helpers.classify_intersection` docstring.""" if NO_IMAGES: return surface1 = bezier.Surface.from_nodes( np.asfortranarray( [ [1.0, 1.5, 2.0, 1.25, 1.75, 1.5], [0.0, 1.0, ...
python
def classify_intersection5(s, curve1, curve2): """Image for :func:`._surface_helpers.classify_intersection` docstring.""" if NO_IMAGES: return surface1 = bezier.Surface.from_nodes( np.asfortranarray( [ [1.0, 1.5, 2.0, 1.25, 1.75, 1.5], [0.0, 1.0, ...
[ "def", "classify_intersection5", "(", "s", ",", "curve1", ",", "curve2", ")", ":", "if", "NO_IMAGES", ":", "return", "surface1", "=", "bezier", ".", "Surface", ".", "from_nodes", "(", "np", ".", "asfortranarray", "(", "[", "[", "1.0", ",", "1.5", ",", ...
Image for :func:`._surface_helpers.classify_intersection` docstring.
[ "Image", "for", ":", "func", ":", ".", "_surface_helpers", ".", "classify_intersection", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L911-L972
dhermes/bezier
docs/make_images.py
classify_intersection7
def classify_intersection7(s, curve1a, curve1b, curve2): """Image for :func:`._surface_helpers.classify_intersection` docstring.""" if NO_IMAGES: return surface1 = bezier.Surface.from_nodes( np.asfortranarray( [ [0.0, 4.5, 9.0, 0.0, 4.5, 0.0], [0....
python
def classify_intersection7(s, curve1a, curve1b, curve2): """Image for :func:`._surface_helpers.classify_intersection` docstring.""" if NO_IMAGES: return surface1 = bezier.Surface.from_nodes( np.asfortranarray( [ [0.0, 4.5, 9.0, 0.0, 4.5, 0.0], [0....
[ "def", "classify_intersection7", "(", "s", ",", "curve1a", ",", "curve1b", ",", "curve2", ")", ":", "if", "NO_IMAGES", ":", "return", "surface1", "=", "bezier", ".", "Surface", ".", "from_nodes", "(", "np", ".", "asfortranarray", "(", "[", "[", "0.0", ",...
Image for :func:`._surface_helpers.classify_intersection` docstring.
[ "Image", "for", ":", "func", ":", ".", "_surface_helpers", ".", "classify_intersection", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L1002-L1033
dhermes/bezier
docs/make_images.py
get_curvature
def get_curvature(nodes, s, tangent_vec, curvature): """Image for :func:`get_curvature` docstring.""" if NO_IMAGES: return curve = bezier.Curve.from_nodes(nodes) # Find the center of the circle along the direction # perpendicular to the tangent vector (90 degree left turn). radius_dir =...
python
def get_curvature(nodes, s, tangent_vec, curvature): """Image for :func:`get_curvature` docstring.""" if NO_IMAGES: return curve = bezier.Curve.from_nodes(nodes) # Find the center of the circle along the direction # perpendicular to the tangent vector (90 degree left turn). radius_dir =...
[ "def", "get_curvature", "(", "nodes", ",", "s", ",", "tangent_vec", ",", "curvature", ")", ":", "if", "NO_IMAGES", ":", "return", "curve", "=", "bezier", ".", "Curve", ".", "from_nodes", "(", "nodes", ")", "# Find the center of the circle along the direction", "...
Image for :func:`get_curvature` docstring.
[ "Image", "for", ":", "func", ":", "get_curvature", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L1036-L1061
dhermes/bezier
docs/make_images.py
curve_locate
def curve_locate(curve, point1, point2, point3): """Image for :meth`.Curve.locate` docstring.""" if NO_IMAGES: return ax = curve.plot(256) points = np.hstack([point1, point2, point3]) ax.plot( points[0, :], points[1, :], color="black", linestyle="None", marker="o" ) ax.axis(...
python
def curve_locate(curve, point1, point2, point3): """Image for :meth`.Curve.locate` docstring.""" if NO_IMAGES: return ax = curve.plot(256) points = np.hstack([point1, point2, point3]) ax.plot( points[0, :], points[1, :], color="black", linestyle="None", marker="o" ) ax.axis(...
[ "def", "curve_locate", "(", "curve", ",", "point1", ",", "point2", ",", "point3", ")", ":", "if", "NO_IMAGES", ":", "return", "ax", "=", "curve", ".", "plot", "(", "256", ")", "points", "=", "np", ".", "hstack", "(", "[", "point1", ",", "point2", "...
Image for :meth`.Curve.locate` docstring.
[ "Image", "for", ":", "meth", ".", "Curve", ".", "locate", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L1064-L1077
dhermes/bezier
docs/make_images.py
newton_refine_curve
def newton_refine_curve(curve, point, s, new_s): """Image for :func:`._curve_helpers.newton_refine` docstring.""" if NO_IMAGES: return ax = curve.plot(256) ax.plot(point[0, :], point[1, :], marker="H") wrong_points = curve.evaluate_multi(np.asfortranarray([s, new_s])) ax.plot( w...
python
def newton_refine_curve(curve, point, s, new_s): """Image for :func:`._curve_helpers.newton_refine` docstring.""" if NO_IMAGES: return ax = curve.plot(256) ax.plot(point[0, :], point[1, :], marker="H") wrong_points = curve.evaluate_multi(np.asfortranarray([s, new_s])) ax.plot( w...
[ "def", "newton_refine_curve", "(", "curve", ",", "point", ",", "s", ",", "new_s", ")", ":", "if", "NO_IMAGES", ":", "return", "ax", "=", "curve", ".", "plot", "(", "256", ")", "ax", ".", "plot", "(", "point", "[", "0", ",", ":", "]", ",", "point"...
Image for :func:`._curve_helpers.newton_refine` docstring.
[ "Image", "for", ":", "func", ":", ".", "_curve_helpers", ".", "newton_refine", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L1080-L1108
dhermes/bezier
docs/make_images.py
newton_refine_curve_cusp
def newton_refine_curve_cusp(curve, s_vals): """Image for :func:`._curve_helpers.newton_refine` docstring.""" if NO_IMAGES: return ax = curve.plot(256) ax.lines[-1].zorder = 1 points = curve.evaluate_multi(np.asfortranarray(s_vals)) colors = seaborn.dark_palette("blue", 6) ax.scatte...
python
def newton_refine_curve_cusp(curve, s_vals): """Image for :func:`._curve_helpers.newton_refine` docstring.""" if NO_IMAGES: return ax = curve.plot(256) ax.lines[-1].zorder = 1 points = curve.evaluate_multi(np.asfortranarray(s_vals)) colors = seaborn.dark_palette("blue", 6) ax.scatte...
[ "def", "newton_refine_curve_cusp", "(", "curve", ",", "s_vals", ")", ":", "if", "NO_IMAGES", ":", "return", "ax", "=", "curve", ".", "plot", "(", "256", ")", "ax", ".", "lines", "[", "-", "1", "]", ".", "zorder", "=", "1", "points", "=", "curve", "...
Image for :func:`._curve_helpers.newton_refine` docstring.
[ "Image", "for", ":", "func", ":", ".", "_curve_helpers", ".", "newton_refine", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L1111-L1127
dhermes/bezier
docs/make_images.py
classify_intersection8
def classify_intersection8(s, curve1, surface1, curve2, surface2): """Image for :func:`._surface_helpers.classify_intersection` docstring.""" if NO_IMAGES: return ax = classify_help(s, curve1, surface1, curve2, surface2, None) ax.set_xlim(-1.125, 1.125) ax.set_ylim(-0.125, 1.125) save_i...
python
def classify_intersection8(s, curve1, surface1, curve2, surface2): """Image for :func:`._surface_helpers.classify_intersection` docstring.""" if NO_IMAGES: return ax = classify_help(s, curve1, surface1, curve2, surface2, None) ax.set_xlim(-1.125, 1.125) ax.set_ylim(-0.125, 1.125) save_i...
[ "def", "classify_intersection8", "(", "s", ",", "curve1", ",", "surface1", ",", "curve2", ",", "surface2", ")", ":", "if", "NO_IMAGES", ":", "return", "ax", "=", "classify_help", "(", "s", ",", "curve1", ",", "surface1", ",", "curve2", ",", "surface2", "...
Image for :func:`._surface_helpers.classify_intersection` docstring.
[ "Image", "for", ":", "func", ":", ".", "_surface_helpers", ".", "classify_intersection", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L1130-L1138
dhermes/bezier
docs/make_images.py
_edges_classify_intersection9
def _edges_classify_intersection9(): """The edges for the curved polygon intersection used below. Helper for :func:`classify_intersection9`. """ edges1 = ( bezier.Curve.from_nodes( np.asfortranarray([[32.0, 30.0], [20.0, 25.0]]) ), bezier.Curve.from_nodes( ...
python
def _edges_classify_intersection9(): """The edges for the curved polygon intersection used below. Helper for :func:`classify_intersection9`. """ edges1 = ( bezier.Curve.from_nodes( np.asfortranarray([[32.0, 30.0], [20.0, 25.0]]) ), bezier.Curve.from_nodes( ...
[ "def", "_edges_classify_intersection9", "(", ")", ":", "edges1", "=", "(", "bezier", ".", "Curve", ".", "from_nodes", "(", "np", ".", "asfortranarray", "(", "[", "[", "32.0", ",", "30.0", "]", ",", "[", "20.0", ",", "25.0", "]", "]", ")", ")", ",", ...
The edges for the curved polygon intersection used below. Helper for :func:`classify_intersection9`.
[ "The", "edges", "for", "the", "curved", "polygon", "intersection", "used", "below", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L1141-L1174
dhermes/bezier
docs/make_images.py
classify_intersection9
def classify_intersection9(s, curve1, curve2): """Image for :func:`._surface_helpers.classify_intersection` docstring.""" if NO_IMAGES: return surface1 = bezier.Surface.from_nodes( np.asfortranarray( [ [0.0, 20.0, 40.0, 10.0, 30.0, 20.0], [0.0, 40...
python
def classify_intersection9(s, curve1, curve2): """Image for :func:`._surface_helpers.classify_intersection` docstring.""" if NO_IMAGES: return surface1 = bezier.Surface.from_nodes( np.asfortranarray( [ [0.0, 20.0, 40.0, 10.0, 30.0, 20.0], [0.0, 40...
[ "def", "classify_intersection9", "(", "s", ",", "curve1", ",", "curve2", ")", ":", "if", "NO_IMAGES", ":", "return", "surface1", "=", "bezier", ".", "Surface", ".", "from_nodes", "(", "np", ".", "asfortranarray", "(", "[", "[", "0.0", ",", "20.0", ",", ...
Image for :func:`._surface_helpers.classify_intersection` docstring.
[ "Image", "for", ":", "func", ":", ".", "_surface_helpers", ".", "classify_intersection", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L1177-L1219
dhermes/bezier
docs/make_images.py
curve_elevate
def curve_elevate(curve, elevated): """Image for :meth:`.curve.Curve.elevate` docstring.""" if NO_IMAGES: return figure, (ax1, ax2) = plt.subplots(1, 2) curve.plot(256, ax=ax1) color = ax1.lines[-1].get_color() add_patch(ax1, curve._nodes, color) elevated.plot(256, ax=ax2) color...
python
def curve_elevate(curve, elevated): """Image for :meth:`.curve.Curve.elevate` docstring.""" if NO_IMAGES: return figure, (ax1, ax2) = plt.subplots(1, 2) curve.plot(256, ax=ax1) color = ax1.lines[-1].get_color() add_patch(ax1, curve._nodes, color) elevated.plot(256, ax=ax2) color...
[ "def", "curve_elevate", "(", "curve", ",", "elevated", ")", ":", "if", "NO_IMAGES", ":", "return", "figure", ",", "(", "ax1", ",", "ax2", ")", "=", "plt", ".", "subplots", "(", "1", ",", "2", ")", "curve", ".", "plot", "(", "256", ",", "ax", "=",...
Image for :meth:`.curve.Curve.elevate` docstring.
[ "Image", "for", ":", "meth", ":", ".", "curve", ".", "Curve", ".", "elevate", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L1222-L1239
dhermes/bezier
docs/make_images.py
unit_triangle
def unit_triangle(): """Image for :class:`.surface.Surface` docstring.""" if NO_IMAGES: return nodes = np.asfortranarray([[0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]) surface = bezier.Surface(nodes, degree=1) ax = surface.plot(256) ax.axis("scaled") _plot_helpers.add_plot_boundary(ax) sav...
python
def unit_triangle(): """Image for :class:`.surface.Surface` docstring.""" if NO_IMAGES: return nodes = np.asfortranarray([[0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]) surface = bezier.Surface(nodes, degree=1) ax = surface.plot(256) ax.axis("scaled") _plot_helpers.add_plot_boundary(ax) sav...
[ "def", "unit_triangle", "(", ")", ":", "if", "NO_IMAGES", ":", "return", "nodes", "=", "np", ".", "asfortranarray", "(", "[", "[", "0.0", ",", "1.0", ",", "0.0", "]", ",", "[", "0.0", ",", "0.0", ",", "1.0", "]", "]", ")", "surface", "=", "bezier...
Image for :class:`.surface.Surface` docstring.
[ "Image", "for", ":", "class", ":", ".", "surface", ".", "Surface", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L1264-L1274
dhermes/bezier
docs/make_images.py
curve_reduce
def curve_reduce(curve, reduced): """Image for :meth:`.curve.Curve.reduce` docstring.""" if NO_IMAGES: return figure, (ax1, ax2) = plt.subplots(1, 2, sharex=True, sharey=True) curve.plot(256, ax=ax1) color = ax1.lines[-1].get_color() add_patch(ax1, curve._nodes, color) reduced.plot(...
python
def curve_reduce(curve, reduced): """Image for :meth:`.curve.Curve.reduce` docstring.""" if NO_IMAGES: return figure, (ax1, ax2) = plt.subplots(1, 2, sharex=True, sharey=True) curve.plot(256, ax=ax1) color = ax1.lines[-1].get_color() add_patch(ax1, curve._nodes, color) reduced.plot(...
[ "def", "curve_reduce", "(", "curve", ",", "reduced", ")", ":", "if", "NO_IMAGES", ":", "return", "figure", ",", "(", "ax1", ",", "ax2", ")", "=", "plt", ".", "subplots", "(", "1", ",", "2", ",", "sharex", "=", "True", ",", "sharey", "=", "True", ...
Image for :meth:`.curve.Curve.reduce` docstring.
[ "Image", "for", ":", "meth", ":", ".", "curve", ".", "Curve", ".", "reduce", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L1277-L1292
dhermes/bezier
docs/make_images.py
curve_reduce_approx
def curve_reduce_approx(curve, reduced): """Image for :meth:`.curve.Curve.reduce` docstring.""" if NO_IMAGES: return ax = curve.plot(256) color = ax.lines[-1].get_color() add_patch(ax, curve._nodes, color, alpha=0.25, node_color=color) reduced.plot(256, ax=ax) color = ax.lines[-1].g...
python
def curve_reduce_approx(curve, reduced): """Image for :meth:`.curve.Curve.reduce` docstring.""" if NO_IMAGES: return ax = curve.plot(256) color = ax.lines[-1].get_color() add_patch(ax, curve._nodes, color, alpha=0.25, node_color=color) reduced.plot(256, ax=ax) color = ax.lines[-1].g...
[ "def", "curve_reduce_approx", "(", "curve", ",", "reduced", ")", ":", "if", "NO_IMAGES", ":", "return", "ax", "=", "curve", ".", "plot", "(", "256", ")", "color", "=", "ax", ".", "lines", "[", "-", "1", "]", ".", "get_color", "(", ")", "add_patch", ...
Image for :meth:`.curve.Curve.reduce` docstring.
[ "Image", "for", ":", "meth", ":", ".", "curve", ".", "Curve", ".", "reduce", "docstring", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L1295-L1308
dhermes/bezier
src/bezier/_surface_intersection.py
newton_refine_solve
def newton_refine_solve(jac_both, x_val, surf_x, y_val, surf_y): r"""Helper for :func:`newton_refine`. We have a system: .. code-block:: rest [A C][ds] = [E] [B D][dt] [F] This is not a typo, ``A->B->C->D`` matches the data in ``jac_both``. We solve directly rather than using a l...
python
def newton_refine_solve(jac_both, x_val, surf_x, y_val, surf_y): r"""Helper for :func:`newton_refine`. We have a system: .. code-block:: rest [A C][ds] = [E] [B D][dt] [F] This is not a typo, ``A->B->C->D`` matches the data in ``jac_both``. We solve directly rather than using a l...
[ "def", "newton_refine_solve", "(", "jac_both", ",", "x_val", ",", "surf_x", ",", "y_val", ",", "surf_y", ")", ":", "a_val", ",", "b_val", ",", "c_val", ",", "d_val", "=", "jac_both", "[", ":", ",", "0", "]", "# and", "e_val", "=", "x_val", "-", ...
r"""Helper for :func:`newton_refine`. We have a system: .. code-block:: rest [A C][ds] = [E] [B D][dt] [F] This is not a typo, ``A->B->C->D`` matches the data in ``jac_both``. We solve directly rather than using a linear algebra utility: .. code-block:: rest ds = (D E - ...
[ "r", "Helper", "for", ":", "func", ":", "newton_refine", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L63-L100
dhermes/bezier
src/bezier/_surface_intersection.py
_newton_refine
def _newton_refine(nodes, degree, x_val, y_val, s, t): r"""Refine a solution to :math:`B(s, t) = p` using Newton's method. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Computes updates via .. math:: \left[\begin{array...
python
def _newton_refine(nodes, degree, x_val, y_val, s, t): r"""Refine a solution to :math:`B(s, t) = p` using Newton's method. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Computes updates via .. math:: \left[\begin{array...
[ "def", "_newton_refine", "(", "nodes", ",", "degree", ",", "x_val", ",", "y_val", ",", "s", ",", "t", ")", ":", "lambda1", "=", "1.0", "-", "s", "-", "t", "(", "surf_x", ",", ")", ",", "(", "surf_y", ",", ")", "=", "_surface_helpers", ".", "evalu...
r"""Refine a solution to :math:`B(s, t) = p` using Newton's method. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Computes updates via .. math:: \left[\begin{array}{c} 0 \\ 0 \end{array}\right] \approx ...
[ "r", "Refine", "a", "solution", "to", ":", "math", ":", "B", "(", "s", "t", ")", "=", "p", "using", "Newton", "s", "method", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L103-L228
dhermes/bezier
src/bezier/_surface_intersection.py
update_locate_candidates
def update_locate_candidates(candidate, next_candidates, x_val, y_val, degree): """Update list of candidate surfaces during geometric search for a point. .. note:: This is used **only** as a helper for :func:`locate_point`. Checks if the point ``(x_val, y_val)`` is contained in the ``candidate`` ...
python
def update_locate_candidates(candidate, next_candidates, x_val, y_val, degree): """Update list of candidate surfaces during geometric search for a point. .. note:: This is used **only** as a helper for :func:`locate_point`. Checks if the point ``(x_val, y_val)`` is contained in the ``candidate`` ...
[ "def", "update_locate_candidates", "(", "candidate", ",", "next_candidates", ",", "x_val", ",", "y_val", ",", "degree", ")", ":", "centroid_x", ",", "centroid_y", ",", "width", ",", "candidate_nodes", "=", "candidate", "point", "=", "np", ".", "asfortranarray", ...
Update list of candidate surfaces during geometric search for a point. .. note:: This is used **only** as a helper for :func:`locate_point`. Checks if the point ``(x_val, y_val)`` is contained in the ``candidate`` surface. If not, this function does nothing. If the point is contaned, the four ...
[ "Update", "list", "of", "candidate", "surfaces", "during", "geometric", "search", "for", "a", "point", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L231-L278
dhermes/bezier
src/bezier/_surface_intersection.py
mean_centroid
def mean_centroid(candidates): """Take the mean of all centroids in set of reference triangles. .. note:: This is used **only** as a helper for :func:`locate_point`. Args: candidates (List[Tuple[float, float, float, numpy.ndarray]): List of 4-tuples, each of which has been prod...
python
def mean_centroid(candidates): """Take the mean of all centroids in set of reference triangles. .. note:: This is used **only** as a helper for :func:`locate_point`. Args: candidates (List[Tuple[float, float, float, numpy.ndarray]): List of 4-tuples, each of which has been prod...
[ "def", "mean_centroid", "(", "candidates", ")", ":", "sum_x", "=", "0.0", "sum_y", "=", "0.0", "for", "centroid_x", ",", "centroid_y", ",", "_", ",", "_", "in", "candidates", ":", "sum_x", "+=", "centroid_x", "sum_y", "+=", "centroid_y", "denom", "=", "3...
Take the mean of all centroids in set of reference triangles. .. note:: This is used **only** as a helper for :func:`locate_point`. Args: candidates (List[Tuple[float, float, float, numpy.ndarray]): List of 4-tuples, each of which has been produced by :func:`locate_point`. ...
[ "Take", "the", "mean", "of", "all", "centroids", "in", "set", "of", "reference", "triangles", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L281-L312
dhermes/bezier
src/bezier/_surface_intersection.py
_locate_point
def _locate_point(nodes, degree, x_val, y_val): r"""Locate a point on a surface. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Does so by recursively subdividing the surface and rejecting sub-surfaces with bounding boxes that d...
python
def _locate_point(nodes, degree, x_val, y_val): r"""Locate a point on a surface. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Does so by recursively subdividing the surface and rejecting sub-surfaces with bounding boxes that d...
[ "def", "_locate_point", "(", "nodes", ",", "degree", ",", "x_val", ",", "y_val", ")", ":", "# We track the centroid rather than base_x/base_y/width (by storing triple", "# the centroid -- to avoid division by three until needed). We also need", "# to track the width (or rather, just the ...
r"""Locate a point on a surface. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Does so by recursively subdividing the surface and rejecting sub-surfaces with bounding boxes that don't contain the point. After the sub-surfaces a...
[ "r", "Locate", "a", "point", "on", "a", "surface", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L315-L368
dhermes/bezier
src/bezier/_surface_intersection.py
same_intersection
def same_intersection(intersection1, intersection2, wiggle=0.5 ** 40): """Check if two intersections are close to machine precision. .. note:: This is a helper used only by :func:`verify_duplicates`, which in turn is only used by :func:`generic_intersect`. Args: intersection1 (.Inte...
python
def same_intersection(intersection1, intersection2, wiggle=0.5 ** 40): """Check if two intersections are close to machine precision. .. note:: This is a helper used only by :func:`verify_duplicates`, which in turn is only used by :func:`generic_intersect`. Args: intersection1 (.Inte...
[ "def", "same_intersection", "(", "intersection1", ",", "intersection2", ",", "wiggle", "=", "0.5", "**", "40", ")", ":", "if", "intersection1", ".", "index_first", "!=", "intersection2", ".", "index_first", ":", "return", "False", "if", "intersection1", ".", "...
Check if two intersections are close to machine precision. .. note:: This is a helper used only by :func:`verify_duplicates`, which in turn is only used by :func:`generic_intersect`. Args: intersection1 (.Intersection): The first intersection. intersection2 (.Intersection): The ...
[ "Check", "if", "two", "intersections", "are", "close", "to", "machine", "precision", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L371-L400
dhermes/bezier
src/bezier/_surface_intersection.py
verify_duplicates
def verify_duplicates(duplicates, uniques): """Verify that a set of intersections had expected duplicates. .. note:: This is a helper used only by :func:`generic_intersect`. Args: duplicates (List[.Intersection]): List of intersections corresponding to duplicates that were filt...
python
def verify_duplicates(duplicates, uniques): """Verify that a set of intersections had expected duplicates. .. note:: This is a helper used only by :func:`generic_intersect`. Args: duplicates (List[.Intersection]): List of intersections corresponding to duplicates that were filt...
[ "def", "verify_duplicates", "(", "duplicates", ",", "uniques", ")", ":", "for", "uniq1", ",", "uniq2", "in", "itertools", ".", "combinations", "(", "uniques", ",", "2", ")", ":", "if", "same_intersection", "(", "uniq1", ",", "uniq2", ")", ":", "raise", "...
Verify that a set of intersections had expected duplicates. .. note:: This is a helper used only by :func:`generic_intersect`. Args: duplicates (List[.Intersection]): List of intersections corresponding to duplicates that were filtered out. uniques (List[.Intersection]): Li...
[ "Verify", "that", "a", "set", "of", "intersections", "had", "expected", "duplicates", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L403-L453
dhermes/bezier
src/bezier/_surface_intersection.py
verify_edge_segments
def verify_edge_segments(edge_infos): """Verify that the edge segments in an intersection are valid. .. note:: This is a helper used only by :func:`generic_intersect`. Args: edge_infos (Optional[list]): List of "edge info" lists. Each list represents a curved polygon and contai...
python
def verify_edge_segments(edge_infos): """Verify that the edge segments in an intersection are valid. .. note:: This is a helper used only by :func:`generic_intersect`. Args: edge_infos (Optional[list]): List of "edge info" lists. Each list represents a curved polygon and contai...
[ "def", "verify_edge_segments", "(", "edge_infos", ")", ":", "if", "edge_infos", "is", "None", ":", "return", "for", "edge_info", "in", "edge_infos", ":", "num_segments", "=", "len", "(", "edge_info", ")", "for", "index", "in", "six", ".", "moves", ".", "xr...
Verify that the edge segments in an intersection are valid. .. note:: This is a helper used only by :func:`generic_intersect`. Args: edge_infos (Optional[list]): List of "edge info" lists. Each list represents a curved polygon and contains 3-tuples of edge index, start ...
[ "Verify", "that", "the", "edge", "segments", "in", "an", "intersection", "are", "valid", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L456-L491
dhermes/bezier
src/bezier/_surface_intersection.py
add_edge_end_unused
def add_edge_end_unused(intersection, duplicates, intersections): """Add intersection that is ``COINCIDENT_UNUSED`` but on an edge end. This is a helper for :func:`~._surface_intersection.add_intersection`. It assumes that * ``intersection`` will have at least one of ``s == 0.0`` or ``t == 0.0`` *...
python
def add_edge_end_unused(intersection, duplicates, intersections): """Add intersection that is ``COINCIDENT_UNUSED`` but on an edge end. This is a helper for :func:`~._surface_intersection.add_intersection`. It assumes that * ``intersection`` will have at least one of ``s == 0.0`` or ``t == 0.0`` *...
[ "def", "add_edge_end_unused", "(", "intersection", ",", "duplicates", ",", "intersections", ")", ":", "found", "=", "None", "for", "other", "in", "intersections", ":", "if", "(", "intersection", ".", "index_first", "==", "other", ".", "index_first", "and", "in...
Add intersection that is ``COINCIDENT_UNUSED`` but on an edge end. This is a helper for :func:`~._surface_intersection.add_intersection`. It assumes that * ``intersection`` will have at least one of ``s == 0.0`` or ``t == 0.0`` * A "misclassified" intersection in ``intersections`` that matches `...
[ "Add", "intersection", "that", "is", "COINCIDENT_UNUSED", "but", "on", "an", "edge", "end", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L494-L528
dhermes/bezier
src/bezier/_surface_intersection.py
check_unused
def check_unused(intersection, duplicates, intersections): """Check if a "valid" ``intersection`` is already in ``intersections``. This assumes that * ``intersection`` will have at least one of ``s == 0.0`` or ``t == 0.0`` * At least one of the intersections in ``intersections`` is classified as ...
python
def check_unused(intersection, duplicates, intersections): """Check if a "valid" ``intersection`` is already in ``intersections``. This assumes that * ``intersection`` will have at least one of ``s == 0.0`` or ``t == 0.0`` * At least one of the intersections in ``intersections`` is classified as ...
[ "def", "check_unused", "(", "intersection", ",", "duplicates", ",", "intersections", ")", ":", "for", "other", "in", "intersections", ":", "if", "(", "other", ".", "interior_curve", "==", "UNUSED_T", "and", "intersection", ".", "index_first", "==", "other", "....
Check if a "valid" ``intersection`` is already in ``intersections``. This assumes that * ``intersection`` will have at least one of ``s == 0.0`` or ``t == 0.0`` * At least one of the intersections in ``intersections`` is classified as ``COINCIDENT_UNUSED``. Args: intersection (.Intersec...
[ "Check", "if", "a", "valid", "intersection", "is", "already", "in", "intersections", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L531-L563
dhermes/bezier
src/bezier/_surface_intersection.py
add_intersection
def add_intersection( # pylint: disable=too-many-arguments index1, s, index2, t, interior_curve, edge_nodes1, edge_nodes2, duplicates, intersections, ): """Create an :class:`Intersection` and append. The intersection will be classified as either a duplicate or a valid i...
python
def add_intersection( # pylint: disable=too-many-arguments index1, s, index2, t, interior_curve, edge_nodes1, edge_nodes2, duplicates, intersections, ): """Create an :class:`Intersection` and append. The intersection will be classified as either a duplicate or a valid i...
[ "def", "add_intersection", "(", "# pylint: disable=too-many-arguments", "index1", ",", "s", ",", "index2", ",", "t", ",", "interior_curve", ",", "edge_nodes1", ",", "edge_nodes2", ",", "duplicates", ",", "intersections", ",", ")", ":", "# NOTE: There is no correspondi...
Create an :class:`Intersection` and append. The intersection will be classified as either a duplicate or a valid intersection and appended to one of ``duplicates`` or ``intersections`` depending on that classification. Args: index1 (int): The index (among 0, 1, 2) of the first edge in the ...
[ "Create", "an", ":", "class", ":", "Intersection", "and", "append", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L566-L629
dhermes/bezier
src/bezier/_surface_intersection.py
classify_coincident
def classify_coincident(st_vals, coincident): r"""Determine if coincident parameters are "unused". .. note:: This is a helper for :func:`surface_intersections`. In the case that ``coincident`` is :data:`True`, then we'll have two sets of parameters :math:`(s_1, t_1)` and :math:`(s_2, t_2)`. ...
python
def classify_coincident(st_vals, coincident): r"""Determine if coincident parameters are "unused". .. note:: This is a helper for :func:`surface_intersections`. In the case that ``coincident`` is :data:`True`, then we'll have two sets of parameters :math:`(s_1, t_1)` and :math:`(s_2, t_2)`. ...
[ "def", "classify_coincident", "(", "st_vals", ",", "coincident", ")", ":", "if", "not", "coincident", ":", "return", "None", "if", "st_vals", "[", "0", ",", "0", "]", ">=", "st_vals", "[", "0", ",", "1", "]", "or", "st_vals", "[", "1", ",", "0", "]...
r"""Determine if coincident parameters are "unused". .. note:: This is a helper for :func:`surface_intersections`. In the case that ``coincident`` is :data:`True`, then we'll have two sets of parameters :math:`(s_1, t_1)` and :math:`(s_2, t_2)`. If one of :math:`s1 < s2` or :math:`t1 < t2` is...
[ "r", "Determine", "if", "coincident", "parameters", "are", "unused", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L632-L667
dhermes/bezier
src/bezier/_surface_intersection.py
should_use
def should_use(intersection): """Check if an intersection can be used as part of a curved polygon. Will return :data:`True` if the intersection is classified as :attr:`~.IntersectionClassification.FIRST`, :attr:`~.IntersectionClassification.SECOND` or :attr:`~.IntersectionClassification.COINCIDENT`...
python
def should_use(intersection): """Check if an intersection can be used as part of a curved polygon. Will return :data:`True` if the intersection is classified as :attr:`~.IntersectionClassification.FIRST`, :attr:`~.IntersectionClassification.SECOND` or :attr:`~.IntersectionClassification.COINCIDENT`...
[ "def", "should_use", "(", "intersection", ")", ":", "if", "intersection", ".", "interior_curve", "in", "ACCEPTABLE_CLASSIFICATIONS", ":", "return", "True", "if", "intersection", ".", "interior_curve", "in", "TANGENT_CLASSIFICATIONS", ":", "return", "intersection", "."...
Check if an intersection can be used as part of a curved polygon. Will return :data:`True` if the intersection is classified as :attr:`~.IntersectionClassification.FIRST`, :attr:`~.IntersectionClassification.SECOND` or :attr:`~.IntersectionClassification.COINCIDENT` or if the intersection is classi...
[ "Check", "if", "an", "intersection", "can", "be", "used", "as", "part", "of", "a", "curved", "polygon", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L670-L693
dhermes/bezier
src/bezier/_surface_intersection.py
surface_intersections
def surface_intersections(edge_nodes1, edge_nodes2, all_intersections): """Find all intersections among edges of two surfaces. This treats intersections which have ``s == 1.0`` or ``t == 1.0`` as duplicates. The duplicates may be checked by the caller, e.g. by :func:`verify_duplicates`. Args: ...
python
def surface_intersections(edge_nodes1, edge_nodes2, all_intersections): """Find all intersections among edges of two surfaces. This treats intersections which have ``s == 1.0`` or ``t == 1.0`` as duplicates. The duplicates may be checked by the caller, e.g. by :func:`verify_duplicates`. Args: ...
[ "def", "surface_intersections", "(", "edge_nodes1", ",", "edge_nodes2", ",", "all_intersections", ")", ":", "# NOTE: There is no corresponding \"enable\", but the disable only applies", "# in this lexical scope.", "# pylint: disable=too-many-locals", "intersections", "=", "[", ...
Find all intersections among edges of two surfaces. This treats intersections which have ``s == 1.0`` or ``t == 1.0`` as duplicates. The duplicates may be checked by the caller, e.g. by :func:`verify_duplicates`. Args: edge_nodes1 (Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]): The ...
[ "Find", "all", "intersections", "among", "edges", "of", "two", "surfaces", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L696-L753
dhermes/bezier
src/bezier/_surface_intersection.py
generic_intersect
def generic_intersect( nodes1, degree1, nodes2, degree2, verify, all_intersections ): r"""Find all intersections among edges of two surfaces. This treats intersections which have ``s == 1.0`` or ``t == 1.0`` as duplicates. The duplicates will be checked by :func:`verify_duplicates` if ``verify`` is...
python
def generic_intersect( nodes1, degree1, nodes2, degree2, verify, all_intersections ): r"""Find all intersections among edges of two surfaces. This treats intersections which have ``s == 1.0`` or ``t == 1.0`` as duplicates. The duplicates will be checked by :func:`verify_duplicates` if ``verify`` is...
[ "def", "generic_intersect", "(", "nodes1", ",", "degree1", ",", "nodes2", ",", "degree2", ",", "verify", ",", "all_intersections", ")", ":", "bbox_int", "=", "_geometric_intersection", ".", "bbox_intersect", "(", "nodes1", ",", "nodes2", ")", "if", "bbox_int", ...
r"""Find all intersections among edges of two surfaces. This treats intersections which have ``s == 1.0`` or ``t == 1.0`` as duplicates. The duplicates will be checked by :func:`verify_duplicates` if ``verify`` is :data:`True`. Args: nodes1 (numpy.ndarray): The nodes defining the first surface...
[ "r", "Find", "all", "intersections", "among", "edges", "of", "two", "surfaces", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L756-L810
dhermes/bezier
src/bezier/_surface_intersection.py
_geometric_intersect
def _geometric_intersect(nodes1, degree1, nodes2, degree2, verify): r"""Find all intersections among edges of two surfaces. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Uses :func:`generic_intersect` with the :attr:`~.Intersec...
python
def _geometric_intersect(nodes1, degree1, nodes2, degree2, verify): r"""Find all intersections among edges of two surfaces. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Uses :func:`generic_intersect` with the :attr:`~.Intersec...
[ "def", "_geometric_intersect", "(", "nodes1", ",", "degree1", ",", "nodes2", ",", "degree2", ",", "verify", ")", ":", "all_intersections", "=", "_geometric_intersection", ".", "all_intersections", "return", "generic_intersect", "(", "nodes1", ",", "degree1", ",", ...
r"""Find all intersections among edges of two surfaces. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Uses :func:`generic_intersect` with the :attr:`~.IntersectionStrategy.GEOMETRIC` intersection strategy. Args: nodes1...
[ "r", "Find", "all", "intersections", "among", "edges", "of", "two", "surfaces", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L813-L848
dhermes/bezier
src/bezier/_surface_intersection.py
algebraic_intersect
def algebraic_intersect(nodes1, degree1, nodes2, degree2, verify): r"""Find all intersections among edges of two surfaces. Uses :func:`generic_intersect` with the :attr:`~.IntersectionStrategy.ALGEBRAIC` intersection strategy. Args: nodes1 (numpy.ndarray): The nodes defining the first surface ...
python
def algebraic_intersect(nodes1, degree1, nodes2, degree2, verify): r"""Find all intersections among edges of two surfaces. Uses :func:`generic_intersect` with the :attr:`~.IntersectionStrategy.ALGEBRAIC` intersection strategy. Args: nodes1 (numpy.ndarray): The nodes defining the first surface ...
[ "def", "algebraic_intersect", "(", "nodes1", ",", "degree1", ",", "nodes2", ",", "degree2", ",", "verify", ")", ":", "all_intersections", "=", "_algebraic_intersection", ".", "all_intersections", "return", "generic_intersect", "(", "nodes1", ",", "degree1", ",", "...
r"""Find all intersections among edges of two surfaces. Uses :func:`generic_intersect` with the :attr:`~.IntersectionStrategy.ALGEBRAIC` intersection strategy. Args: nodes1 (numpy.ndarray): The nodes defining the first surface in the intersection (assumed in :math:\mathbf{R}^2`). ...
[ "r", "Find", "all", "intersections", "among", "edges", "of", "two", "surfaces", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L851-L881
dhermes/bezier
src/bezier/__config__.py
modify_path
def modify_path(): """Modify the module search path.""" # Only modify path on Windows. if os.name != "nt": return path = os.environ.get("PATH") if path is None: return try: extra_dll_dir = pkg_resources.resource_filename("bezier", "extra-dll") if os.path.isdir(e...
python
def modify_path(): """Modify the module search path.""" # Only modify path on Windows. if os.name != "nt": return path = os.environ.get("PATH") if path is None: return try: extra_dll_dir = pkg_resources.resource_filename("bezier", "extra-dll") if os.path.isdir(e...
[ "def", "modify_path", "(", ")", ":", "# Only modify path on Windows.", "if", "os", ".", "name", "!=", "\"nt\"", ":", "return", "path", "=", "os", ".", "environ", ".", "get", "(", "\"PATH\"", ")", "if", "path", "is", "None", ":", "return", "try", ":", "...
Modify the module search path.
[ "Modify", "the", "module", "search", "path", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/__config__.py#L30-L45
dhermes/bezier
src/bezier/__config__.py
handle_import_error
def handle_import_error(caught_exc, name): """Allow or re-raise an import error. This is to distinguish between expected and unexpected import errors. If the module is not found, it simply means the Cython / Fortran speedups were not built with the package. If the error message is different, e.g. `...
python
def handle_import_error(caught_exc, name): """Allow or re-raise an import error. This is to distinguish between expected and unexpected import errors. If the module is not found, it simply means the Cython / Fortran speedups were not built with the package. If the error message is different, e.g. `...
[ "def", "handle_import_error", "(", "caught_exc", ",", "name", ")", ":", "for", "template", "in", "TEMPLATES", ":", "expected_msg", "=", "template", ".", "format", "(", "name", ")", "if", "caught_exc", ".", "args", "==", "(", "expected_msg", ",", ")", ":", ...
Allow or re-raise an import error. This is to distinguish between expected and unexpected import errors. If the module is not found, it simply means the Cython / Fortran speedups were not built with the package. If the error message is different, e.g. ``... undefined symbol: __curve_intersection_MOD_al...
[ "Allow", "or", "re", "-", "raise", "an", "import", "error", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/__config__.py#L48-L72
dhermes/bezier
setup_helpers_macos.py
is_macos_gfortran
def is_macos_gfortran(f90_compiler): """Checks if the current build is ``gfortran`` on macOS. Args: f90_compiler (numpy.distutils.fcompiler.FCompiler): A Fortran compiler instance. Returns: bool: Only :data:`True` if * Current OS is macOS (checked via ``sys.platform``)...
python
def is_macos_gfortran(f90_compiler): """Checks if the current build is ``gfortran`` on macOS. Args: f90_compiler (numpy.distutils.fcompiler.FCompiler): A Fortran compiler instance. Returns: bool: Only :data:`True` if * Current OS is macOS (checked via ``sys.platform``)...
[ "def", "is_macos_gfortran", "(", "f90_compiler", ")", ":", "# NOTE: NumPy may not be installed, but we don't want **this** module to", "# cause an import failure.", "from", "numpy", ".", "distutils", ".", "fcompiler", "import", "gnu", "# Only macOS.", "if", "sys", ".", ...
Checks if the current build is ``gfortran`` on macOS. Args: f90_compiler (numpy.distutils.fcompiler.FCompiler): A Fortran compiler instance. Returns: bool: Only :data:`True` if * Current OS is macOS (checked via ``sys.platform``). * ``f90_compiler`` corresponds to ...
[ "Checks", "if", "the", "current", "build", "is", "gfortran", "on", "macOS", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/setup_helpers_macos.py#L23-L48
dhermes/bezier
setup_helpers_macos.py
patch_f90_compiler
def patch_f90_compiler(f90_compiler): """Patch up ``f90_compiler.library_dirs``. On macOS, a Homebrew installed ``gfortran`` needs some help. The ``numpy.distutils`` "default" constructor for ``Gnu95FCompiler`` only has a single library search path, but there are many library paths included in the ...
python
def patch_f90_compiler(f90_compiler): """Patch up ``f90_compiler.library_dirs``. On macOS, a Homebrew installed ``gfortran`` needs some help. The ``numpy.distutils`` "default" constructor for ``Gnu95FCompiler`` only has a single library search path, but there are many library paths included in the ...
[ "def", "patch_f90_compiler", "(", "f90_compiler", ")", ":", "if", "not", "is_macos_gfortran", "(", "f90_compiler", ")", ":", "return", "library_dirs", "=", "f90_compiler", ".", "library_dirs", "# ``library_dirs`` is a list (i.e. mutable), so we can update in place.", "library...
Patch up ``f90_compiler.library_dirs``. On macOS, a Homebrew installed ``gfortran`` needs some help. The ``numpy.distutils`` "default" constructor for ``Gnu95FCompiler`` only has a single library search path, but there are many library paths included in the full ``gcc`` install. Args: f90_...
[ "Patch", "up", "f90_compiler", ".", "library_dirs", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/setup_helpers_macos.py#L51-L68
dhermes/bezier
src/bezier/surface.py
_make_intersection
def _make_intersection(edge_info, all_edge_nodes): """Convert a description of edges into a curved polygon. .. note:: This is a helper used only by :meth:`.Surface.intersect`. Args: edge_info (Tuple[Tuple[int, float, float], ...]): Information describing each edge in the curved...
python
def _make_intersection(edge_info, all_edge_nodes): """Convert a description of edges into a curved polygon. .. note:: This is a helper used only by :meth:`.Surface.intersect`. Args: edge_info (Tuple[Tuple[int, float, float], ...]): Information describing each edge in the curved...
[ "def", "_make_intersection", "(", "edge_info", ",", "all_edge_nodes", ")", ":", "edges", "=", "[", "]", "for", "index", ",", "start", ",", "end", "in", "edge_info", ":", "nodes", "=", "all_edge_nodes", "[", "index", "]", "new_nodes", "=", "_curve_helpers", ...
Convert a description of edges into a curved polygon. .. note:: This is a helper used only by :meth:`.Surface.intersect`. Args: edge_info (Tuple[Tuple[int, float, float], ...]): Information describing each edge in the curved polygon by indicating which surface / edge on...
[ "Convert", "a", "description", "of", "edges", "into", "a", "curved", "polygon", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L1100-L1128
dhermes/bezier
src/bezier/surface.py
Surface.from_nodes
def from_nodes(cls, nodes, _copy=True): """Create a :class:`.Surface` from nodes. Computes the ``degree`` based on the shape of ``nodes``. Args: nodes (numpy.ndarray): The nodes in the surface. The columns represent each node while the rows are the dimension ...
python
def from_nodes(cls, nodes, _copy=True): """Create a :class:`.Surface` from nodes. Computes the ``degree`` based on the shape of ``nodes``. Args: nodes (numpy.ndarray): The nodes in the surface. The columns represent each node while the rows are the dimension ...
[ "def", "from_nodes", "(", "cls", ",", "nodes", ",", "_copy", "=", "True", ")", ":", "_", ",", "num_nodes", "=", "nodes", ".", "shape", "degree", "=", "cls", ".", "_get_degree", "(", "num_nodes", ")", "return", "cls", "(", "nodes", ",", "degree", ",",...
Create a :class:`.Surface` from nodes. Computes the ``degree`` based on the shape of ``nodes``. Args: nodes (numpy.ndarray): The nodes in the surface. The columns represent each node while the rows are the dimension of the ambient space. _copy (b...
[ "Create", "a", ":", "class", ":", ".", "Surface", "from", "nodes", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L193-L211
dhermes/bezier
src/bezier/surface.py
Surface._get_degree
def _get_degree(num_nodes): """Get the degree of the current surface. Args: num_nodes (int): The number of control points for a B |eacute| zier surface. Returns: int: The degree :math:`d` such that :math:`(d + 1)(d + 2)/2` equals ``num_nodes`...
python
def _get_degree(num_nodes): """Get the degree of the current surface. Args: num_nodes (int): The number of control points for a B |eacute| zier surface. Returns: int: The degree :math:`d` such that :math:`(d + 1)(d + 2)/2` equals ``num_nodes`...
[ "def", "_get_degree", "(", "num_nodes", ")", ":", "# 8 * num_nodes = 4(d + 1)(d + 2)", "# = 4d^2 + 12d + 8", "# = (2d + 3)^2 - 1", "d_float", "=", "0.5", "*", "(", "np", ".", "sqrt", "(", "8.0", "*", "num_nodes", "+", "1.0", ")", "-", "3....
Get the degree of the current surface. Args: num_nodes (int): The number of control points for a B |eacute| zier surface. Returns: int: The degree :math:`d` such that :math:`(d + 1)(d + 2)/2` equals ``num_nodes``. Raises: ValueEr...
[ "Get", "the", "degree", "of", "the", "current", "surface", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L214-L237
dhermes/bezier
src/bezier/surface.py
Surface.area
def area(self): r"""The area of the current surface. For surfaces in :math:`\mathbf{R}^2`, this computes the area via Green's theorem. Using the vector field :math:`\mathbf{F} = \left[-y, x\right]^T`, since :math:`\partial_x(x) - \partial_y(-y) = 2` Green's theorem says twice th...
python
def area(self): r"""The area of the current surface. For surfaces in :math:`\mathbf{R}^2`, this computes the area via Green's theorem. Using the vector field :math:`\mathbf{F} = \left[-y, x\right]^T`, since :math:`\partial_x(x) - \partial_y(-y) = 2` Green's theorem says twice th...
[ "def", "area", "(", "self", ")", ":", "if", "self", ".", "_dimension", "!=", "2", ":", "raise", "NotImplementedError", "(", "\"2D is the only supported dimension\"", ",", "\"Current dimension\"", ",", "self", ".", "_dimension", ",", ")", "edge1", ",", "edge2", ...
r"""The area of the current surface. For surfaces in :math:`\mathbf{R}^2`, this computes the area via Green's theorem. Using the vector field :math:`\mathbf{F} = \left[-y, x\right]^T`, since :math:`\partial_x(x) - \partial_y(-y) = 2` Green's theorem says twice the area is equal to ...
[ "r", "The", "area", "of", "the", "current", "surface", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L240-L286
dhermes/bezier
src/bezier/surface.py
Surface._compute_edges
def _compute_edges(self): """Compute the edges of the current surface. Returns: Tuple[~curve.Curve, ~curve.Curve, ~curve.Curve]: The edges of the surface. """ nodes1, nodes2, nodes3 = _surface_helpers.compute_edge_nodes( self._nodes, self._degree ...
python
def _compute_edges(self): """Compute the edges of the current surface. Returns: Tuple[~curve.Curve, ~curve.Curve, ~curve.Curve]: The edges of the surface. """ nodes1, nodes2, nodes3 = _surface_helpers.compute_edge_nodes( self._nodes, self._degree ...
[ "def", "_compute_edges", "(", "self", ")", ":", "nodes1", ",", "nodes2", ",", "nodes3", "=", "_surface_helpers", ".", "compute_edge_nodes", "(", "self", ".", "_nodes", ",", "self", ".", "_degree", ")", "edge1", "=", "_curve_mod", ".", "Curve", "(", "nodes1...
Compute the edges of the current surface. Returns: Tuple[~curve.Curve, ~curve.Curve, ~curve.Curve]: The edges of the surface.
[ "Compute", "the", "edges", "of", "the", "current", "surface", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L288-L301
dhermes/bezier
src/bezier/surface.py
Surface._get_edges
def _get_edges(self): """Get the edges for the current surface. If they haven't been computed yet, first compute and store them. This is provided as a means for internal calls to get the edges without copying (since :attr:`.edges` copies before giving to a user to keep the stor...
python
def _get_edges(self): """Get the edges for the current surface. If they haven't been computed yet, first compute and store them. This is provided as a means for internal calls to get the edges without copying (since :attr:`.edges` copies before giving to a user to keep the stor...
[ "def", "_get_edges", "(", "self", ")", ":", "if", "self", ".", "_edges", "is", "None", ":", "self", ".", "_edges", "=", "self", ".", "_compute_edges", "(", ")", "return", "self", ".", "_edges" ]
Get the edges for the current surface. If they haven't been computed yet, first compute and store them. This is provided as a means for internal calls to get the edges without copying (since :attr:`.edges` copies before giving to a user to keep the stored data immutable). Retu...
[ "Get", "the", "edges", "for", "the", "current", "surface", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L303-L319
dhermes/bezier
src/bezier/surface.py
Surface.edges
def edges(self): """The edges of the surface. .. doctest:: surface-edges :options: +NORMALIZE_WHITESPACE >>> nodes = np.asfortranarray([ ... [0.0, 0.5 , 1.0, 0.1875, 0.625, 0.0], ... [0.0, -0.1875, 0.0, 0.5 , 0.625, 1.0], ... ]) ...
python
def edges(self): """The edges of the surface. .. doctest:: surface-edges :options: +NORMALIZE_WHITESPACE >>> nodes = np.asfortranarray([ ... [0.0, 0.5 , 1.0, 0.1875, 0.625, 0.0], ... [0.0, -0.1875, 0.0, 0.5 , 0.625, 1.0], ... ]) ...
[ "def", "edges", "(", "self", ")", ":", "edge1", ",", "edge2", ",", "edge3", "=", "self", ".", "_get_edges", "(", ")", "# NOTE: It is crucial that we return copies here. Since the edges", "# are cached, if they were mutable, callers could", "# inadvertently mutate th...
The edges of the surface. .. doctest:: surface-edges :options: +NORMALIZE_WHITESPACE >>> nodes = np.asfortranarray([ ... [0.0, 0.5 , 1.0, 0.1875, 0.625, 0.0], ... [0.0, -0.1875, 0.0, 0.5 , 0.625, 1.0], ... ]) >>> surface = bezier.S...
[ "The", "edges", "of", "the", "surface", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L322-L352
dhermes/bezier
src/bezier/surface.py
Surface._verify_barycentric
def _verify_barycentric(lambda1, lambda2, lambda3): """Verifies that weights are barycentric and on the reference triangle. I.e., checks that they sum to one and are all non-negative. Args: lambda1 (float): Parameter along the reference triangle. lambda2 (float): Parame...
python
def _verify_barycentric(lambda1, lambda2, lambda3): """Verifies that weights are barycentric and on the reference triangle. I.e., checks that they sum to one and are all non-negative. Args: lambda1 (float): Parameter along the reference triangle. lambda2 (float): Parame...
[ "def", "_verify_barycentric", "(", "lambda1", ",", "lambda2", ",", "lambda3", ")", ":", "weights_total", "=", "lambda1", "+", "lambda2", "+", "lambda3", "if", "not", "np", ".", "allclose", "(", "weights_total", ",", "1.0", ",", "atol", "=", "0.0", ")", "...
Verifies that weights are barycentric and on the reference triangle. I.e., checks that they sum to one and are all non-negative. Args: lambda1 (float): Parameter along the reference triangle. lambda2 (float): Parameter along the reference triangle. lambda3 (float): ...
[ "Verifies", "that", "weights", "are", "barycentric", "and", "on", "the", "reference", "triangle", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L355-L379
dhermes/bezier
src/bezier/surface.py
Surface.evaluate_barycentric
def evaluate_barycentric(self, lambda1, lambda2, lambda3, _verify=True): r"""Compute a point on the surface. Evaluates :math:`B\left(\lambda_1, \lambda_2, \lambda_3\right)`. .. image:: ../../images/surface_evaluate_barycentric.png :align: center .. testsetup:: surface-baryc...
python
def evaluate_barycentric(self, lambda1, lambda2, lambda3, _verify=True): r"""Compute a point on the surface. Evaluates :math:`B\left(\lambda_1, \lambda_2, \lambda_3\right)`. .. image:: ../../images/surface_evaluate_barycentric.png :align: center .. testsetup:: surface-baryc...
[ "def", "evaluate_barycentric", "(", "self", ",", "lambda1", ",", "lambda2", ",", "lambda3", ",", "_verify", "=", "True", ")", ":", "if", "_verify", ":", "self", ".", "_verify_barycentric", "(", "lambda1", ",", "lambda2", ",", "lambda3", ")", "return", "_su...
r"""Compute a point on the surface. Evaluates :math:`B\left(\lambda_1, \lambda_2, \lambda_3\right)`. .. image:: ../../images/surface_evaluate_barycentric.png :align: center .. testsetup:: surface-barycentric, surface-barycentric-fail1, surface-barycentric-fai...
[ "r", "Compute", "a", "point", "on", "the", "surface", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L381-L475
dhermes/bezier
src/bezier/surface.py
Surface.evaluate_barycentric_multi
def evaluate_barycentric_multi(self, param_vals, _verify=True): r"""Compute multiple points on the surface. Assumes ``param_vals`` has three columns of barycentric coordinates. See :meth:`evaluate_barycentric` for more details on how each row of parameter values is evaluated. ....
python
def evaluate_barycentric_multi(self, param_vals, _verify=True): r"""Compute multiple points on the surface. Assumes ``param_vals`` has three columns of barycentric coordinates. See :meth:`evaluate_barycentric` for more details on how each row of parameter values is evaluated. ....
[ "def", "evaluate_barycentric_multi", "(", "self", ",", "param_vals", ",", "_verify", "=", "True", ")", ":", "if", "_verify", ":", "if", "param_vals", ".", "ndim", "!=", "2", ":", "raise", "ValueError", "(", "\"Parameter values must be 2D array\"", ")", "for", ...
r"""Compute multiple points on the surface. Assumes ``param_vals`` has three columns of barycentric coordinates. See :meth:`evaluate_barycentric` for more details on how each row of parameter values is evaluated. .. image:: ../../images/surface_evaluate_barycentric_multi.png ...
[ "r", "Compute", "multiple", "points", "on", "the", "surface", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L477-L536
dhermes/bezier
src/bezier/surface.py
Surface._verify_cartesian
def _verify_cartesian(s, t): """Verifies that a point is in the reference triangle. I.e., checks that they sum to <= one and are each non-negative. Args: s (float): Parameter along the reference triangle. t (float): Parameter along the reference triangle. Raise...
python
def _verify_cartesian(s, t): """Verifies that a point is in the reference triangle. I.e., checks that they sum to <= one and are each non-negative. Args: s (float): Parameter along the reference triangle. t (float): Parameter along the reference triangle. Raise...
[ "def", "_verify_cartesian", "(", "s", ",", "t", ")", ":", "if", "s", "<", "0.0", "or", "t", "<", "0.0", "or", "s", "+", "t", ">", "1.0", ":", "raise", "ValueError", "(", "\"Point lies outside reference triangle\"", ",", "s", ",", "t", ")" ]
Verifies that a point is in the reference triangle. I.e., checks that they sum to <= one and are each non-negative. Args: s (float): Parameter along the reference triangle. t (float): Parameter along the reference triangle. Raises: ValueError: If the point ...
[ "Verifies", "that", "a", "point", "is", "in", "the", "reference", "triangle", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L539-L552
dhermes/bezier
src/bezier/surface.py
Surface.evaluate_cartesian
def evaluate_cartesian(self, s, t, _verify=True): r"""Compute a point on the surface. Evaluates :math:`B\left(1 - s - t, s, t\right)` by calling :meth:`evaluate_barycentric`: This method acts as a (partial) inverse to :meth:`locate`. .. testsetup:: surface-cartesian ...
python
def evaluate_cartesian(self, s, t, _verify=True): r"""Compute a point on the surface. Evaluates :math:`B\left(1 - s - t, s, t\right)` by calling :meth:`evaluate_barycentric`: This method acts as a (partial) inverse to :meth:`locate`. .. testsetup:: surface-cartesian ...
[ "def", "evaluate_cartesian", "(", "self", ",", "s", ",", "t", ",", "_verify", "=", "True", ")", ":", "if", "_verify", ":", "self", ".", "_verify_cartesian", "(", "s", ",", "t", ")", "return", "_surface_helpers", ".", "evaluate_barycentric", "(", "self", ...
r"""Compute a point on the surface. Evaluates :math:`B\left(1 - s - t, s, t\right)` by calling :meth:`evaluate_barycentric`: This method acts as a (partial) inverse to :meth:`locate`. .. testsetup:: surface-cartesian import numpy as np import bezier .. ...
[ "r", "Compute", "a", "point", "on", "the", "surface", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L554-L598
dhermes/bezier
src/bezier/surface.py
Surface.evaluate_cartesian_multi
def evaluate_cartesian_multi(self, param_vals, _verify=True): r"""Compute multiple points on the surface. Assumes ``param_vals`` has two columns of Cartesian coordinates. See :meth:`evaluate_cartesian` for more details on how each row of parameter values is evaluated. .. image:...
python
def evaluate_cartesian_multi(self, param_vals, _verify=True): r"""Compute multiple points on the surface. Assumes ``param_vals`` has two columns of Cartesian coordinates. See :meth:`evaluate_cartesian` for more details on how each row of parameter values is evaluated. .. image:...
[ "def", "evaluate_cartesian_multi", "(", "self", ",", "param_vals", ",", "_verify", "=", "True", ")", ":", "if", "_verify", ":", "if", "param_vals", ".", "ndim", "!=", "2", ":", "raise", "ValueError", "(", "\"Parameter values must be 2D array\"", ")", "for", "s...
r"""Compute multiple points on the surface. Assumes ``param_vals`` has two columns of Cartesian coordinates. See :meth:`evaluate_cartesian` for more details on how each row of parameter values is evaluated. .. image:: ../../images/surface_evaluate_cartesian_multi.png :align:...
[ "r", "Compute", "multiple", "points", "on", "the", "surface", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L600-L658
dhermes/bezier
src/bezier/surface.py
Surface.plot
def plot(self, pts_per_edge, color=None, ax=None, with_nodes=False): """Plot the current surface. Args: pts_per_edge (int): Number of points to plot per edge. color (Optional[Tuple[float, float, float]]): Color as RGB profile. ax (Optional[matplotlib.artist.Artist]):...
python
def plot(self, pts_per_edge, color=None, ax=None, with_nodes=False): """Plot the current surface. Args: pts_per_edge (int): Number of points to plot per edge. color (Optional[Tuple[float, float, float]]): Color as RGB profile. ax (Optional[matplotlib.artist.Artist]):...
[ "def", "plot", "(", "self", ",", "pts_per_edge", ",", "color", "=", "None", ",", "ax", "=", "None", ",", "with_nodes", "=", "False", ")", ":", "if", "self", ".", "_dimension", "!=", "2", ":", "raise", "NotImplementedError", "(", "\"2D is the only supported...
Plot the current surface. Args: pts_per_edge (int): Number of points to plot per edge. color (Optional[Tuple[float, float, float]]): Color as RGB profile. ax (Optional[matplotlib.artist.Artist]): matplotlib axis object to add plot to. with_nodes (...
[ "Plot", "the", "current", "surface", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L660-L696
dhermes/bezier
src/bezier/surface.py
Surface.subdivide
def subdivide(self): r"""Split the surface into four sub-surfaces. Does so by taking the unit triangle (i.e. the domain of the surface) and splitting it into four sub-triangles .. image:: ../../images/surface_subdivide1.png :align: center Then the surface is re-para...
python
def subdivide(self): r"""Split the surface into four sub-surfaces. Does so by taking the unit triangle (i.e. the domain of the surface) and splitting it into four sub-triangles .. image:: ../../images/surface_subdivide1.png :align: center Then the surface is re-para...
[ "def", "subdivide", "(", "self", ")", ":", "nodes_a", ",", "nodes_b", ",", "nodes_c", ",", "nodes_d", "=", "_surface_helpers", ".", "subdivide_nodes", "(", "self", ".", "_nodes", ",", "self", ".", "_degree", ")", "return", "(", "Surface", "(", "nodes_a", ...
r"""Split the surface into four sub-surfaces. Does so by taking the unit triangle (i.e. the domain of the surface) and splitting it into four sub-triangles .. image:: ../../images/surface_subdivide1.png :align: center Then the surface is re-parameterized via the map to / fr...
[ "r", "Split", "the", "surface", "into", "four", "sub", "-", "surfaces", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L698-L748
dhermes/bezier
src/bezier/surface.py
Surface._compute_valid
def _compute_valid(self): r"""Determines if the current surface is "valid". Does this by checking if the Jacobian of the map from the reference triangle is everywhere positive. Returns: bool: Flag indicating if the current surface is valid. Raises: NotI...
python
def _compute_valid(self): r"""Determines if the current surface is "valid". Does this by checking if the Jacobian of the map from the reference triangle is everywhere positive. Returns: bool: Flag indicating if the current surface is valid. Raises: NotI...
[ "def", "_compute_valid", "(", "self", ")", ":", "if", "self", ".", "_dimension", "!=", "2", ":", "raise", "NotImplementedError", "(", "\"Validity check only implemented in R^2\"", ")", "poly_sign", "=", "None", "if", "self", ".", "_degree", "==", "1", ":", "# ...
r"""Determines if the current surface is "valid". Does this by checking if the Jacobian of the map from the reference triangle is everywhere positive. Returns: bool: Flag indicating if the current surface is valid. Raises: NotImplementedError: If the surface is...
[ "r", "Determines", "if", "the", "current", "surface", "is", "valid", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L750-L784
dhermes/bezier
src/bezier/surface.py
Surface.locate
def locate(self, point, _verify=True): r"""Find a point on the current surface. Solves for :math:`s` and :math:`t` in :math:`B(s, t) = p`. This method acts as a (partial) inverse to :meth:`evaluate_cartesian`. .. warning:: A unique solution is only guaranteed if the curren...
python
def locate(self, point, _verify=True): r"""Find a point on the current surface. Solves for :math:`s` and :math:`t` in :math:`B(s, t) = p`. This method acts as a (partial) inverse to :meth:`evaluate_cartesian`. .. warning:: A unique solution is only guaranteed if the curren...
[ "def", "locate", "(", "self", ",", "point", ",", "_verify", "=", "True", ")", ":", "if", "_verify", ":", "if", "self", ".", "_dimension", "!=", "2", ":", "raise", "NotImplementedError", "(", "\"Only 2D surfaces supported.\"", ")", "if", "point", ".", "shap...
r"""Find a point on the current surface. Solves for :math:`s` and :math:`t` in :math:`B(s, t) = p`. This method acts as a (partial) inverse to :meth:`evaluate_cartesian`. .. warning:: A unique solution is only guaranteed if the current surface is valid. This code assume...
[ "r", "Find", "a", "point", "on", "the", "current", "surface", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L877-L946
dhermes/bezier
src/bezier/surface.py
Surface.intersect
def intersect(self, other, strategy=_STRATEGY.GEOMETRIC, _verify=True): """Find the common intersection with another surface. Args: other (Surface): Other surface to intersect with. strategy (Optional[~bezier.curve.IntersectionStrategy]): The intersection algorit...
python
def intersect(self, other, strategy=_STRATEGY.GEOMETRIC, _verify=True): """Find the common intersection with another surface. Args: other (Surface): Other surface to intersect with. strategy (Optional[~bezier.curve.IntersectionStrategy]): The intersection algorit...
[ "def", "intersect", "(", "self", ",", "other", ",", "strategy", "=", "_STRATEGY", ".", "GEOMETRIC", ",", "_verify", "=", "True", ")", ":", "if", "_verify", ":", "if", "not", "isinstance", "(", "other", ",", "Surface", ")", ":", "raise", "TypeError", "(...
Find the common intersection with another surface. Args: other (Surface): Other surface to intersect with. strategy (Optional[~bezier.curve.IntersectionStrategy]): The intersection algorithm to use. Defaults to geometric. _verify (Optional[bool]): Indicates i...
[ "Find", "the", "common", "intersection", "with", "another", "surface", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L948-L1005
dhermes/bezier
src/bezier/surface.py
Surface.elevate
def elevate(self): r"""Return a degree-elevated version of the current surface. Does this by converting the current nodes :math:`\left\{v_{i, j, k}\right\}_{i + j + k = d}` to new nodes :math:`\left\{w_{i, j, k}\right\}_{i + j + k = d + 1}`. Does so by re-writing .. mat...
python
def elevate(self): r"""Return a degree-elevated version of the current surface. Does this by converting the current nodes :math:`\left\{v_{i, j, k}\right\}_{i + j + k = d}` to new nodes :math:`\left\{w_{i, j, k}\right\}_{i + j + k = d + 1}`. Does so by re-writing .. mat...
[ "def", "elevate", "(", "self", ")", ":", "_", ",", "num_nodes", "=", "self", ".", "_nodes", ".", "shape", "# (d + 1)(d + 2)/2 --> (d + 2)(d + 3)/2", "num_new", "=", "num_nodes", "+", "self", ".", "_degree", "+", "2", "new_nodes", "=", "np", ".", "zeros", "...
r"""Return a degree-elevated version of the current surface. Does this by converting the current nodes :math:`\left\{v_{i, j, k}\right\}_{i + j + k = d}` to new nodes :math:`\left\{w_{i, j, k}\right\}_{i + j + k = d + 1}`. Does so by re-writing .. math:: E\left(\lam...
[ "r", "Return", "a", "degree", "-", "elevated", "version", "of", "the", "current", "surface", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L1007-L1097
dhermes/bezier
src/bezier/_intersection_helpers.py
_newton_refine
def _newton_refine(s, nodes1, t, nodes2): r"""Apply one step of 2D Newton's method. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. We want to use Newton's method on the function .. math:: F(s, t) = B_1(s) - B_2(t) ...
python
def _newton_refine(s, nodes1, t, nodes2): r"""Apply one step of 2D Newton's method. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. We want to use Newton's method on the function .. math:: F(s, t) = B_1(s) - B_2(t) ...
[ "def", "_newton_refine", "(", "s", ",", "nodes1", ",", "t", ",", "nodes2", ")", ":", "# NOTE: We form -F(s, t) since we want to solve -DF^{-1} F(s, t).", "func_val", "=", "_curve_helpers", ".", "evaluate_multi", "(", "nodes2", ",", "np", ".", "asfortranarray", "(", ...
r"""Apply one step of 2D Newton's method. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. We want to use Newton's method on the function .. math:: F(s, t) = B_1(s) - B_2(t) to refine :math:`\left(s_{\ast}, t_{\ast}\righ...
[ "r", "Apply", "one", "step", "of", "2D", "Newton", "s", "method", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_intersection_helpers.py#L67-L427
dhermes/bezier
src/bezier/_intersection_helpers.py
newton_iterate
def newton_iterate(evaluate_fn, s, t): r"""Perform a Newton iteration. In this function, we assume that :math:`s` and :math:`t` are nonzero, this makes convergence easier to detect since "relative error" at ``0.0`` is not a useful measure. There are several tolerance / threshold quantities used be...
python
def newton_iterate(evaluate_fn, s, t): r"""Perform a Newton iteration. In this function, we assume that :math:`s` and :math:`t` are nonzero, this makes convergence easier to detect since "relative error" at ``0.0`` is not a useful measure. There are several tolerance / threshold quantities used be...
[ "def", "newton_iterate", "(", "evaluate_fn", ",", "s", ",", "t", ")", ":", "# Several quantities will be tracked throughout the iteration:", "# * norm_update_prev: ||p{n} - p{n-1}|| = ||dp{n-1}||", "# * norm_update : ||p{n+1} - p{n} || = ||dp{n} ||", "# * linear_updates : This is ...
r"""Perform a Newton iteration. In this function, we assume that :math:`s` and :math:`t` are nonzero, this makes convergence easier to detect since "relative error" at ``0.0`` is not a useful measure. There are several tolerance / threshold quantities used below: * :math:`10` (:attr:`MAX_NEWTON_I...
[ "r", "Perform", "a", "Newton", "iteration", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_intersection_helpers.py#L645-L732
dhermes/bezier
src/bezier/_intersection_helpers.py
full_newton_nonzero
def full_newton_nonzero(s, nodes1, t, nodes2): r"""Perform a Newton iteration until convergence to a solution. This is the "implementation" for :func:`full_newton`. In this function, we assume that :math:`s` and :math:`t` are nonzero. Args: s (float): The parameter along the first curve where ...
python
def full_newton_nonzero(s, nodes1, t, nodes2): r"""Perform a Newton iteration until convergence to a solution. This is the "implementation" for :func:`full_newton`. In this function, we assume that :math:`s` and :math:`t` are nonzero. Args: s (float): The parameter along the first curve where ...
[ "def", "full_newton_nonzero", "(", "s", ",", "nodes1", ",", "t", ",", "nodes2", ")", ":", "# NOTE: We somewhat replicate code in ``evaluate_hodograph()``", "# here. This is so we don't re-compute the nodes for the first", "# (and possibly second) derivatives every time they a...
r"""Perform a Newton iteration until convergence to a solution. This is the "implementation" for :func:`full_newton`. In this function, we assume that :math:`s` and :math:`t` are nonzero. Args: s (float): The parameter along the first curve where the iteration will start. nodes...
[ "r", "Perform", "a", "Newton", "iteration", "until", "convergence", "to", "a", "solution", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_intersection_helpers.py#L735-L790
dhermes/bezier
src/bezier/_intersection_helpers.py
full_newton
def full_newton(s, nodes1, t, nodes2): r"""Perform a Newton iteration until convergence to a solution. This assumes :math:`s` and :math:`t` are sufficiently close to an intersection. It **does not** govern the maximum distance away that the solution can lie, though the subdivided intervals that contain...
python
def full_newton(s, nodes1, t, nodes2): r"""Perform a Newton iteration until convergence to a solution. This assumes :math:`s` and :math:`t` are sufficiently close to an intersection. It **does not** govern the maximum distance away that the solution can lie, though the subdivided intervals that contain...
[ "def", "full_newton", "(", "s", ",", "nodes1", ",", "t", ",", "nodes2", ")", ":", "if", "s", "<", "ZERO_THRESHOLD", ":", "reversed1", "=", "np", ".", "asfortranarray", "(", "nodes1", "[", ":", ",", ":", ":", "-", "1", "]", ")", "if", "t", "<", ...
r"""Perform a Newton iteration until convergence to a solution. This assumes :math:`s` and :math:`t` are sufficiently close to an intersection. It **does not** govern the maximum distance away that the solution can lie, though the subdivided intervals that contain :math:`s` and :math:`t` could be used....
[ "r", "Perform", "a", "Newton", "iteration", "until", "convergence", "to", "a", "solution", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_intersection_helpers.py#L793-L842
dhermes/bezier
setup_helpers.py
gfortran_search_path
def gfortran_search_path(library_dirs): """Get the library directory paths for ``gfortran``. Looks for ``libraries: =`` in the output of ``gfortran -print-search-dirs`` and then parses the paths. If this fails for any reason, this method will print an error and return ``library_dirs``. Args: ...
python
def gfortran_search_path(library_dirs): """Get the library directory paths for ``gfortran``. Looks for ``libraries: =`` in the output of ``gfortran -print-search-dirs`` and then parses the paths. If this fails for any reason, this method will print an error and return ``library_dirs``. Args: ...
[ "def", "gfortran_search_path", "(", "library_dirs", ")", ":", "cmd", "=", "(", "\"gfortran\"", ",", "\"-print-search-dirs\"", ")", "process", "=", "subprocess", ".", "Popen", "(", "cmd", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", "return_code", "=", ...
Get the library directory paths for ``gfortran``. Looks for ``libraries: =`` in the output of ``gfortran -print-search-dirs`` and then parses the paths. If this fails for any reason, this method will print an error and return ``library_dirs``. Args: library_dirs (List[str]): Existing library d...
[ "Get", "the", "library", "directory", "paths", "for", "gfortran", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/setup_helpers.py#L96-L140
dhermes/bezier
setup_helpers.py
_update_flags
def _update_flags(compiler_flags, remove_flags=()): """Update a given set of compiler flags. Args: compiler_flags (List[str]): Existing flags associated with a compiler. remove_flags (Optional[Container[str]]): A container of flags to remove that will override any of the defaults. ...
python
def _update_flags(compiler_flags, remove_flags=()): """Update a given set of compiler flags. Args: compiler_flags (List[str]): Existing flags associated with a compiler. remove_flags (Optional[Container[str]]): A container of flags to remove that will override any of the defaults. ...
[ "def", "_update_flags", "(", "compiler_flags", ",", "remove_flags", "=", "(", ")", ")", ":", "for", "flag", "in", "GFORTRAN_SHARED_FLAGS", ":", "if", "flag", "not", "in", "compiler_flags", ":", "compiler_flags", ".", "append", "(", "flag", ")", "if", "DEBUG_...
Update a given set of compiler flags. Args: compiler_flags (List[str]): Existing flags associated with a compiler. remove_flags (Optional[Container[str]]): A container of flags to remove that will override any of the defaults. Returns: List[str]: The modified list (i.e. som...
[ "Update", "a", "given", "set", "of", "compiler", "flags", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/setup_helpers.py#L178-L207
dhermes/bezier
setup_helpers.py
patch_f90_compiler
def patch_f90_compiler(f90_compiler): """Patch up ``f90_compiler``. For now, only updates the flags for ``gfortran``. In this case, it add any of ``GFORTRAN_SHARED_FLAGS`` that are missing. In debug mode, it also adds any flags in ``GFORTRAN_DEBUG_FLAGS`` and makes sure none of the flags in ``GFORT...
python
def patch_f90_compiler(f90_compiler): """Patch up ``f90_compiler``. For now, only updates the flags for ``gfortran``. In this case, it add any of ``GFORTRAN_SHARED_FLAGS`` that are missing. In debug mode, it also adds any flags in ``GFORTRAN_DEBUG_FLAGS`` and makes sure none of the flags in ``GFORT...
[ "def", "patch_f90_compiler", "(", "f90_compiler", ")", ":", "# NOTE: NumPy may not be installed, but we don't want **this** module to", "# cause an import failure in ``setup.py``.", "from", "numpy", ".", "distutils", ".", "fcompiler", "import", "gnu", "# Only ``gfortran``.", ...
Patch up ``f90_compiler``. For now, only updates the flags for ``gfortran``. In this case, it add any of ``GFORTRAN_SHARED_FLAGS`` that are missing. In debug mode, it also adds any flags in ``GFORTRAN_DEBUG_FLAGS`` and makes sure none of the flags in ``GFORTRAN_OPTIMIZE_FLAGS`` are present. In standard...
[ "Patch", "up", "f90_compiler", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/setup_helpers.py#L210-L235
dhermes/bezier
setup_helpers.py
BuildFortranThenExt.start_journaling
def start_journaling(self): """Capture calls to the system by compilers. See: https://github.com/numpy/numpy/blob/v1.15.2/\ numpy/distutils/ccompiler.py#L154 Intercepts all calls to ``CCompiler.spawn`` and keeps the arguments around to be stored in the local ``commands`` ...
python
def start_journaling(self): """Capture calls to the system by compilers. See: https://github.com/numpy/numpy/blob/v1.15.2/\ numpy/distutils/ccompiler.py#L154 Intercepts all calls to ``CCompiler.spawn`` and keeps the arguments around to be stored in the local ``commands`` ...
[ "def", "start_journaling", "(", "self", ")", ":", "import", "numpy", ".", "distutils", ".", "ccompiler", "if", "self", ".", "journal_file", "is", "None", ":", "return", "def", "journaled_spawn", "(", "patched_self", ",", "cmd", ",", "display", "=", "None", ...
Capture calls to the system by compilers. See: https://github.com/numpy/numpy/blob/v1.15.2/\ numpy/distutils/ccompiler.py#L154 Intercepts all calls to ``CCompiler.spawn`` and keeps the arguments around to be stored in the local ``commands`` instance attribute.
[ "Capture", "calls", "to", "the", "system", "by", "compilers", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/setup_helpers.py#L321-L344
dhermes/bezier
setup_helpers.py
BuildFortranThenExt.save_journal
def save_journal(self): """Save journaled commands to file. If there is no active journal, does nothing. If saving the commands to a file fails, a message will be printed to STDERR but the failure will be swallowed so that the extension can be built successfully. """ ...
python
def save_journal(self): """Save journaled commands to file. If there is no active journal, does nothing. If saving the commands to a file fails, a message will be printed to STDERR but the failure will be swallowed so that the extension can be built successfully. """ ...
[ "def", "save_journal", "(", "self", ")", ":", "if", "self", ".", "journal_file", "is", "None", ":", "return", "try", ":", "as_text", "=", "self", ".", "_commands_to_text", "(", ")", "with", "open", "(", "self", ".", "journal_file", ",", "\"w\"", ")", "...
Save journaled commands to file. If there is no active journal, does nothing. If saving the commands to a file fails, a message will be printed to STDERR but the failure will be swallowed so that the extension can be built successfully.
[ "Save", "journaled", "commands", "to", "file", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/setup_helpers.py#L368-L386
dhermes/bezier
setup_helpers.py
BuildFortranThenExt._default_static_lib
def _default_static_lib(self, obj_files): """Create a static library (i.e. a ``.a`` / ``.lib`` file). Args: obj_files (List[str]): List of paths of compiled object files. """ c_compiler = self.F90_COMPILER.c_compiler static_lib_dir = os.path.join(self.build_lib, "bez...
python
def _default_static_lib(self, obj_files): """Create a static library (i.e. a ``.a`` / ``.lib`` file). Args: obj_files (List[str]): List of paths of compiled object files. """ c_compiler = self.F90_COMPILER.c_compiler static_lib_dir = os.path.join(self.build_lib, "bez...
[ "def", "_default_static_lib", "(", "self", ",", "obj_files", ")", ":", "c_compiler", "=", "self", ".", "F90_COMPILER", ".", "c_compiler", "static_lib_dir", "=", "os", ".", "path", ".", "join", "(", "self", ".", "build_lib", ",", "\"bezier\"", ",", "\"lib\"",...
Create a static library (i.e. a ``.a`` / ``.lib`` file). Args: obj_files (List[str]): List of paths of compiled object files.
[ "Create", "a", "static", "library", "(", "i", ".", "e", ".", "a", ".", "a", "/", ".", "lib", "file", ")", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/setup_helpers.py#L388-L408
dhermes/bezier
setup_helpers.py
BuildFortranThenExt._default_cleanup
def _default_cleanup(self): """Default cleanup after :meth:`run`. For in-place builds, moves the built shared library into the source directory. """ if not self.inplace: return shutil.move( os.path.join(self.build_lib, "bezier", "lib"), ...
python
def _default_cleanup(self): """Default cleanup after :meth:`run`. For in-place builds, moves the built shared library into the source directory. """ if not self.inplace: return shutil.move( os.path.join(self.build_lib, "bezier", "lib"), ...
[ "def", "_default_cleanup", "(", "self", ")", ":", "if", "not", "self", ".", "inplace", ":", "return", "shutil", ".", "move", "(", "os", ".", "path", ".", "join", "(", "self", ".", "build_lib", ",", "\"bezier\"", ",", "\"lib\"", ")", ",", "os", ".", ...
Default cleanup after :meth:`run`. For in-place builds, moves the built shared library into the source directory.
[ "Default", "cleanup", "after", ":", "meth", ":", "run", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/setup_helpers.py#L434-L446
dhermes/bezier
src/bezier/curved_polygon.py
CurvedPolygon._verify_pair
def _verify_pair(prev, curr): """Verify a pair of sides share an endpoint. .. note:: This currently checks that edge endpoints match **exactly** but allowing some roundoff may be desired. Args: prev (.Curve): "Previous" curve at piecewise junction. ...
python
def _verify_pair(prev, curr): """Verify a pair of sides share an endpoint. .. note:: This currently checks that edge endpoints match **exactly** but allowing some roundoff may be desired. Args: prev (.Curve): "Previous" curve at piecewise junction. ...
[ "def", "_verify_pair", "(", "prev", ",", "curr", ")", ":", "if", "prev", ".", "_dimension", "!=", "2", ":", "raise", "ValueError", "(", "\"Curve not in R^2\"", ",", "prev", ")", "end", "=", "prev", ".", "_nodes", "[", ":", ",", "-", "1", "]", "start"...
Verify a pair of sides share an endpoint. .. note:: This currently checks that edge endpoints match **exactly** but allowing some roundoff may be desired. Args: prev (.Curve): "Previous" curve at piecewise junction. curr (.Curve): "Next" curve at piecewis...
[ "Verify", "a", "pair", "of", "sides", "share", "an", "endpoint", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/curved_polygon.py#L146-L173
dhermes/bezier
src/bezier/curved_polygon.py
CurvedPolygon._verify
def _verify(self): """Verify that the edges define a curved polygon. This may not be entirely comprehensive, e.g. won't check self-intersection of the defined polygon. .. note:: This currently checks that edge endpoints match **exactly** but allowing some roundof...
python
def _verify(self): """Verify that the edges define a curved polygon. This may not be entirely comprehensive, e.g. won't check self-intersection of the defined polygon. .. note:: This currently checks that edge endpoints match **exactly** but allowing some roundof...
[ "def", "_verify", "(", "self", ")", ":", "if", "self", ".", "_num_sides", "<", "2", ":", "raise", "ValueError", "(", "\"At least two sides required.\"", ")", "for", "prev", ",", "curr", "in", "six", ".", "moves", ".", "zip", "(", "self", ".", "_edges", ...
Verify that the edges define a curved polygon. This may not be entirely comprehensive, e.g. won't check self-intersection of the defined polygon. .. note:: This currently checks that edge endpoints match **exactly** but allowing some roundoff may be desired. Rai...
[ "Verify", "that", "the", "edges", "define", "a", "curved", "polygon", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/curved_polygon.py#L175-L199
dhermes/bezier
src/bezier/curved_polygon.py
CurvedPolygon.area
def area(self): r"""The area of the current curved polygon. This assumes, but does not check, that the current curved polygon is valid (i.e. it is bounded by the edges). This computes the area via Green's theorem. Using the vector field :math:`\mathbf{F} = \left[-y, x\right]^T`...
python
def area(self): r"""The area of the current curved polygon. This assumes, but does not check, that the current curved polygon is valid (i.e. it is bounded by the edges). This computes the area via Green's theorem. Using the vector field :math:`\mathbf{F} = \left[-y, x\right]^T`...
[ "def", "area", "(", "self", ")", ":", "edges", "=", "tuple", "(", "edge", ".", "_nodes", "for", "edge", "in", "self", ".", "_edges", ")", "return", "_surface_helpers", ".", "compute_area", "(", "edges", ")" ]
r"""The area of the current curved polygon. This assumes, but does not check, that the current curved polygon is valid (i.e. it is bounded by the edges). This computes the area via Green's theorem. Using the vector field :math:`\mathbf{F} = \left[-y, x\right]^T`, since :math:`\...
[ "r", "The", "area", "of", "the", "current", "curved", "polygon", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/curved_polygon.py#L220-L252
dhermes/bezier
src/bezier/curved_polygon.py
CurvedPolygon.plot
def plot(self, pts_per_edge, color=None, ax=None): """Plot the current curved polygon. Args: pts_per_edge (int): Number of points to plot per curved edge. color (Optional[Tuple[float, float, float]]): Color as RGB profile. ax (Optional[matplotlib.artist.Artist]): mat...
python
def plot(self, pts_per_edge, color=None, ax=None): """Plot the current curved polygon. Args: pts_per_edge (int): Number of points to plot per curved edge. color (Optional[Tuple[float, float, float]]): Color as RGB profile. ax (Optional[matplotlib.artist.Artist]): mat...
[ "def", "plot", "(", "self", ",", "pts_per_edge", ",", "color", "=", "None", ",", "ax", "=", "None", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "_plot_helpers", ".", "new_axis", "(", ")", "_plot_helpers", ".", "add_patch", "(", "ax", ",", "...
Plot the current curved polygon. Args: pts_per_edge (int): Number of points to plot per curved edge. color (Optional[Tuple[float, float, float]]): Color as RGB profile. ax (Optional[matplotlib.artist.Artist]): matplotlib axis object to add plot to. R...
[ "Plot", "the", "current", "curved", "polygon", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/curved_polygon.py#L264-L280
dhermes/bezier
src/bezier/_clipping.py
compute_implicit_line
def compute_implicit_line(nodes): """Compute the implicit form of the line connecting curve endpoints. .. note:: This assumes, but does not check, that the first and last nodes in ``nodes`` are different. Computes :math:`a, b` and :math:`c` in the normalized implicit equation for the li...
python
def compute_implicit_line(nodes): """Compute the implicit form of the line connecting curve endpoints. .. note:: This assumes, but does not check, that the first and last nodes in ``nodes`` are different. Computes :math:`a, b` and :math:`c` in the normalized implicit equation for the li...
[ "def", "compute_implicit_line", "(", "nodes", ")", ":", "delta", "=", "nodes", "[", ":", ",", "-", "1", "]", "-", "nodes", "[", ":", ",", "0", "]", "length", "=", "np", ".", "linalg", ".", "norm", "(", "delta", ",", "ord", "=", "2", ")", "# Nor...
Compute the implicit form of the line connecting curve endpoints. .. note:: This assumes, but does not check, that the first and last nodes in ``nodes`` are different. Computes :math:`a, b` and :math:`c` in the normalized implicit equation for the line .. math:: ax + by + c = 0...
[ "Compute", "the", "implicit", "form", "of", "the", "line", "connecting", "curve", "endpoints", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_clipping.py#L41-L78
dhermes/bezier
src/bezier/_clipping.py
compute_fat_line
def compute_fat_line(nodes): """Compute the "fat line" around a B |eacute| zier curve. Both computes the implicit (normalized) form .. math:: ax + by + c = 0 for the line connecting the first and last node in ``nodes``. Also computes the maximum and minimum distances to that line from...
python
def compute_fat_line(nodes): """Compute the "fat line" around a B |eacute| zier curve. Both computes the implicit (normalized) form .. math:: ax + by + c = 0 for the line connecting the first and last node in ``nodes``. Also computes the maximum and minimum distances to that line from...
[ "def", "compute_fat_line", "(", "nodes", ")", ":", "coeff_a", ",", "coeff_b", ",", "coeff_c", "=", "compute_implicit_line", "(", "nodes", ")", "# NOTE: This assumes, but does not check, that there are two rows.", "_", ",", "num_nodes", "=", "nodes", ".", "shape", "d_m...
Compute the "fat line" around a B |eacute| zier curve. Both computes the implicit (normalized) form .. math:: ax + by + c = 0 for the line connecting the first and last node in ``nodes``. Also computes the maximum and minimum distances to that line from each control point. Args: ...
[ "Compute", "the", "fat", "line", "around", "a", "B", "|eacute|", "zier", "curve", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_clipping.py#L81-L119
dhermes/bezier
src/bezier/_clipping.py
_update_parameters
def _update_parameters(s_min, s_max, start0, end0, start1, end1): """Update clipped parameter range. .. note:: This is a helper for :func:`clip_range`. Does so by intersecting one of the two fat lines with an edge of the convex hull of the distance polynomial of the curve being clipped. ...
python
def _update_parameters(s_min, s_max, start0, end0, start1, end1): """Update clipped parameter range. .. note:: This is a helper for :func:`clip_range`. Does so by intersecting one of the two fat lines with an edge of the convex hull of the distance polynomial of the curve being clipped. ...
[ "def", "_update_parameters", "(", "s_min", ",", "s_max", ",", "start0", ",", "end0", ",", "start1", ",", "end1", ")", ":", "s", ",", "t", ",", "success", "=", "_geometric_intersection", ".", "segment_intersection", "(", "start0", ",", "end0", ",", "start1"...
Update clipped parameter range. .. note:: This is a helper for :func:`clip_range`. Does so by intersecting one of the two fat lines with an edge of the convex hull of the distance polynomial of the curve being clipped. If both of ``s_min`` and ``s_max`` are "unset", then any :math:`s` ...
[ "Update", "clipped", "parameter", "range", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_clipping.py#L122-L179
dhermes/bezier
src/bezier/_clipping.py
_check_parameter_range
def _check_parameter_range(s_min, s_max): r"""Performs a final check on a clipped parameter range. .. note:: This is a helper for :func:`clip_range`. If both values are unchanged from the "unset" default, this returns the whole interval :math:`\left[0.0, 1.0\right]`. If only one of the va...
python
def _check_parameter_range(s_min, s_max): r"""Performs a final check on a clipped parameter range. .. note:: This is a helper for :func:`clip_range`. If both values are unchanged from the "unset" default, this returns the whole interval :math:`\left[0.0, 1.0\right]`. If only one of the va...
[ "def", "_check_parameter_range", "(", "s_min", ",", "s_max", ")", ":", "if", "s_min", "==", "DEFAULT_S_MIN", ":", "# Based on the way ``_update_parameters`` works, we know", "# both parameters must be unset if ``s_min``.", "return", "0.0", ",", "1.0", "if", "s_max", "==", ...
r"""Performs a final check on a clipped parameter range. .. note:: This is a helper for :func:`clip_range`. If both values are unchanged from the "unset" default, this returns the whole interval :math:`\left[0.0, 1.0\right]`. If only one of the values is set to some parameter :math:`s`, this ...
[ "r", "Performs", "a", "final", "check", "on", "a", "clipped", "parameter", "range", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_clipping.py#L182-L217
dhermes/bezier
src/bezier/_clipping.py
clip_range
def clip_range(nodes1, nodes2): r"""Reduce the parameter range where two curves can intersect. Does so by using the "fat line" for ``nodes1`` and computing the distance polynomial against ``nodes2``. .. note:: This assumes, but does not check that the curves being considered will only h...
python
def clip_range(nodes1, nodes2): r"""Reduce the parameter range where two curves can intersect. Does so by using the "fat line" for ``nodes1`` and computing the distance polynomial against ``nodes2``. .. note:: This assumes, but does not check that the curves being considered will only h...
[ "def", "clip_range", "(", "nodes1", ",", "nodes2", ")", ":", "# NOTE: There is no corresponding \"enable\", but the disable only applies", "# in this lexical scope.", "# pylint: disable=too-many-locals", "coeff_a", ",", "coeff_b", ",", "coeff_c", ",", "d_min", ",", "d_max...
r"""Reduce the parameter range where two curves can intersect. Does so by using the "fat line" for ``nodes1`` and computing the distance polynomial against ``nodes2``. .. note:: This assumes, but does not check that the curves being considered will only have one intersection in the paramete...
[ "r", "Reduce", "the", "parameter", "range", "where", "two", "curves", "can", "intersect", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_clipping.py#L220-L289
dhermes/bezier
scripts/post_process_journal.py
post_process_travis_macos
def post_process_travis_macos(journal_filename): """Post-process a generated journal file on Travis macOS. Args: journal_filename (str): The name of the journal file. """ travis_build_dir = os.environ.get("TRAVIS_BUILD_DIR", "") with open(journal_filename, "r") as file_obj: content ...
python
def post_process_travis_macos(journal_filename): """Post-process a generated journal file on Travis macOS. Args: journal_filename (str): The name of the journal file. """ travis_build_dir = os.environ.get("TRAVIS_BUILD_DIR", "") with open(journal_filename, "r") as file_obj: content ...
[ "def", "post_process_travis_macos", "(", "journal_filename", ")", ":", "travis_build_dir", "=", "os", ".", "environ", ".", "get", "(", "\"TRAVIS_BUILD_DIR\"", ",", "\"\"", ")", "with", "open", "(", "journal_filename", ",", "\"r\"", ")", "as", "file_obj", ":", ...
Post-process a generated journal file on Travis macOS. Args: journal_filename (str): The name of the journal file.
[ "Post", "-", "process", "a", "generated", "journal", "file", "on", "Travis", "macOS", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/scripts/post_process_journal.py#L23-L34
dhermes/bezier
scripts/check_doc_templates.py
mod_replace
def mod_replace(match, sphinx_modules): """Convert Sphinx ``:mod:`` to plain reST link. Args: match (_sre.SRE_Match): A match (from ``re``) to be used in substitution. sphinx_modules (list): List to be track the modules that have been encountered. Returns: s...
python
def mod_replace(match, sphinx_modules): """Convert Sphinx ``:mod:`` to plain reST link. Args: match (_sre.SRE_Match): A match (from ``re``) to be used in substitution. sphinx_modules (list): List to be track the modules that have been encountered. Returns: s...
[ "def", "mod_replace", "(", "match", ",", "sphinx_modules", ")", ":", "sphinx_modules", ".", "append", "(", "match", ".", "group", "(", "\"module\"", ")", ")", "return", "\"`{}`_\"", ".", "format", "(", "match", ".", "group", "(", "\"value\"", ")", ")" ]
Convert Sphinx ``:mod:`` to plain reST link. Args: match (_sre.SRE_Match): A match (from ``re``) to be used in substitution. sphinx_modules (list): List to be track the modules that have been encountered. Returns: str: The ``match`` converted to a link.
[ "Convert", "Sphinx", ":", "mod", ":", "to", "plain", "reST", "link", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/scripts/check_doc_templates.py#L213-L226
dhermes/bezier
scripts/check_doc_templates.py
doc_replace
def doc_replace(match, sphinx_docs): """Convert Sphinx ``:doc:`` to plain reST link. Args: match (_sre.SRE_Match): A match (from ``re``) to be used in substitution. sphinx_docs (list): List to be track the documents that have been encountered. Returns: str: ...
python
def doc_replace(match, sphinx_docs): """Convert Sphinx ``:doc:`` to plain reST link. Args: match (_sre.SRE_Match): A match (from ``re``) to be used in substitution. sphinx_docs (list): List to be track the documents that have been encountered. Returns: str: ...
[ "def", "doc_replace", "(", "match", ",", "sphinx_docs", ")", ":", "sphinx_docs", ".", "append", "(", "match", ".", "group", "(", "\"path\"", ")", ")", "return", "\"`{}`_\"", ".", "format", "(", "match", ".", "group", "(", "\"value\"", ")", ")" ]
Convert Sphinx ``:doc:`` to plain reST link. Args: match (_sre.SRE_Match): A match (from ``re``) to be used in substitution. sphinx_docs (list): List to be track the documents that have been encountered. Returns: str: The ``match`` converted to a link.
[ "Convert", "Sphinx", ":", "doc", ":", "to", "plain", "reST", "link", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/scripts/check_doc_templates.py#L229-L242
dhermes/bezier
scripts/check_doc_templates.py
get_diff
def get_diff(value1, value2, name1, name2): """Get a diff between two strings. Args: value1 (str): First string to be compared. value2 (str): Second string to be compared. name1 (str): Name of the first string. name2 (str): Name of the second string. Returns: str: T...
python
def get_diff(value1, value2, name1, name2): """Get a diff between two strings. Args: value1 (str): First string to be compared. value2 (str): Second string to be compared. name1 (str): Name of the first string. name2 (str): Name of the second string. Returns: str: T...
[ "def", "get_diff", "(", "value1", ",", "value2", ",", "name1", ",", "name2", ")", ":", "lines1", "=", "[", "line", "+", "\"\\n\"", "for", "line", "in", "value1", ".", "splitlines", "(", ")", "]", "lines2", "=", "[", "line", "+", "\"\\n\"", "for", "...
Get a diff between two strings. Args: value1 (str): First string to be compared. value2 (str): Second string to be compared. name1 (str): Name of the first string. name2 (str): Name of the second string. Returns: str: The full diff.
[ "Get", "a", "diff", "between", "two", "strings", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/scripts/check_doc_templates.py#L245-L262
dhermes/bezier
scripts/check_doc_templates.py
populate_readme
def populate_readme(revision, rtd_version, **extra_kwargs): """Populate README template with values. Args: revision (str): The branch, commit, etc. being referred to (e.g. ``master``). rtd_version (str): The version to use for RTD (Read the Docs) links (e.g. ``latest``)....
python
def populate_readme(revision, rtd_version, **extra_kwargs): """Populate README template with values. Args: revision (str): The branch, commit, etc. being referred to (e.g. ``master``). rtd_version (str): The version to use for RTD (Read the Docs) links (e.g. ``latest``)....
[ "def", "populate_readme", "(", "revision", ",", "rtd_version", ",", "*", "*", "extra_kwargs", ")", ":", "with", "open", "(", "TEMPLATE_FILE", ",", "\"r\"", ")", "as", "file_obj", ":", "template", "=", "file_obj", ".", "read", "(", ")", "img_prefix", "=", ...
Populate README template with values. Args: revision (str): The branch, commit, etc. being referred to (e.g. ``master``). rtd_version (str): The version to use for RTD (Read the Docs) links (e.g. ``latest``). extra_kwargs (Dict[str, str]): Over-ride for template argu...
[ "Populate", "README", "template", "with", "values", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/scripts/check_doc_templates.py#L265-L340
dhermes/bezier
scripts/check_doc_templates.py
readme_verify
def readme_verify(): """Populate the template and compare to ``README``. Raises: ValueError: If the current README doesn't agree with the expected value computed from the template. """ expected = populate_readme(REVISION, RTD_VERSION) # Actually get the stored contents. with...
python
def readme_verify(): """Populate the template and compare to ``README``. Raises: ValueError: If the current README doesn't agree with the expected value computed from the template. """ expected = populate_readme(REVISION, RTD_VERSION) # Actually get the stored contents. with...
[ "def", "readme_verify", "(", ")", ":", "expected", "=", "populate_readme", "(", "REVISION", ",", "RTD_VERSION", ")", "# Actually get the stored contents.", "with", "open", "(", "README_FILE", ",", "\"r\"", ")", "as", "file_obj", ":", "contents", "=", "file_obj", ...
Populate the template and compare to ``README``. Raises: ValueError: If the current README doesn't agree with the expected value computed from the template.
[ "Populate", "the", "template", "and", "compare", "to", "README", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/scripts/check_doc_templates.py#L343-L361
dhermes/bezier
scripts/check_doc_templates.py
release_readme_verify
def release_readme_verify(): """Specialize the template to a PyPI release template. Once populated, compare to ``README.rst.release.template``. Raises: ValueError: If the current template doesn't agree with the expected value specialized from the template. """ version = "{versi...
python
def release_readme_verify(): """Specialize the template to a PyPI release template. Once populated, compare to ``README.rst.release.template``. Raises: ValueError: If the current template doesn't agree with the expected value specialized from the template. """ version = "{versi...
[ "def", "release_readme_verify", "(", ")", ":", "version", "=", "\"{version}\"", "expected", "=", "populate_readme", "(", "version", ",", "version", ",", "pypi", "=", "\"\"", ",", "pypi_img", "=", "\"\"", ",", "versions", "=", "\"\\n\\n\"", ",", "versions_img",...
Specialize the template to a PyPI release template. Once populated, compare to ``README.rst.release.template``. Raises: ValueError: If the current template doesn't agree with the expected value specialized from the template.
[ "Specialize", "the", "template", "to", "a", "PyPI", "release", "template", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/scripts/check_doc_templates.py#L364-L402
dhermes/bezier
scripts/check_doc_templates.py
_index_verify
def _index_verify(index_file, **extra_kwargs): """Populate the template and compare to documentation index file. Used for both ``docs/index.rst`` and ``docs/index.rst.release.template``. Args: index_file (str): Filename to compare against. extra_kwargs (Dict[str, str]): Over-ride for templ...
python
def _index_verify(index_file, **extra_kwargs): """Populate the template and compare to documentation index file. Used for both ``docs/index.rst`` and ``docs/index.rst.release.template``. Args: index_file (str): Filename to compare against. extra_kwargs (Dict[str, str]): Over-ride for templ...
[ "def", "_index_verify", "(", "index_file", ",", "*", "*", "extra_kwargs", ")", ":", "side_effect", "=", "extra_kwargs", ".", "pop", "(", "\"side_effect\"", ",", "None", ")", "with", "open", "(", "TEMPLATE_FILE", ",", "\"r\"", ")", "as", "file_obj", ":", "t...
Populate the template and compare to documentation index file. Used for both ``docs/index.rst`` and ``docs/index.rst.release.template``. Args: index_file (str): Filename to compare against. extra_kwargs (Dict[str, str]): Over-ride for template arguments. One **special** keyword is ...
[ "Populate", "the", "template", "and", "compare", "to", "documentation", "index", "file", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/scripts/check_doc_templates.py#L405-L473
dhermes/bezier
scripts/check_doc_templates.py
release_docs_side_effect
def release_docs_side_effect(content): """Updates the template so that curly braces are escaped correctly. Args: content (str): The template for ``docs/index.rst.release.template``. Returns: str: The updated template with properly escaped curly braces. """ # First replace **all** c...
python
def release_docs_side_effect(content): """Updates the template so that curly braces are escaped correctly. Args: content (str): The template for ``docs/index.rst.release.template``. Returns: str: The updated template with properly escaped curly braces. """ # First replace **all** c...
[ "def", "release_docs_side_effect", "(", "content", ")", ":", "# First replace **all** curly braces.", "result", "=", "content", ".", "replace", "(", "\"{\"", ",", "\"{{\"", ")", ".", "replace", "(", "\"}\"", ",", "\"}}\"", ")", "# Then reset the actual template argume...
Updates the template so that curly braces are escaped correctly. Args: content (str): The template for ``docs/index.rst.release.template``. Returns: str: The updated template with properly escaped curly braces.
[ "Updates", "the", "template", "so", "that", "curly", "braces", "are", "escaped", "correctly", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/scripts/check_doc_templates.py#L486-L503
dhermes/bezier
scripts/check_doc_templates.py
release_docs_index_verify
def release_docs_index_verify(): """Populate template and compare to ``docs/index.rst.release.template``. Raises: ValueError: If the current ``index.rst.release.template`` doesn't agree with the expected value computed from the template. """ version = "{version}" _index_verify( ...
python
def release_docs_index_verify(): """Populate template and compare to ``docs/index.rst.release.template``. Raises: ValueError: If the current ``index.rst.release.template`` doesn't agree with the expected value computed from the template. """ version = "{version}" _index_verify( ...
[ "def", "release_docs_index_verify", "(", ")", ":", "version", "=", "\"{version}\"", "_index_verify", "(", "RELEASE_INDEX_FILE", ",", "side_effect", "=", "release_docs_side_effect", ",", "pypi", "=", "\"\"", ",", "pypi_img", "=", "\"\"", ",", "versions", "=", "\"\\...
Populate template and compare to ``docs/index.rst.release.template``. Raises: ValueError: If the current ``index.rst.release.template`` doesn't agree with the expected value computed from the template.
[ "Populate", "template", "and", "compare", "to", "docs", "/", "index", ".", "rst", ".", "release", ".", "template", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/scripts/check_doc_templates.py#L506-L531
dhermes/bezier
scripts/check_doc_templates.py
development_verify
def development_verify(): """Populate template and compare to ``DEVELOPMENT.rst`` Raises: ValueError: If the current ``DEVELOPMENT.rst`` doesn't agree with the expected value computed from the template. """ with open(DEVELOPMENT_TEMPLATE, "r") as file_obj: template = file_ob...
python
def development_verify(): """Populate template and compare to ``DEVELOPMENT.rst`` Raises: ValueError: If the current ``DEVELOPMENT.rst`` doesn't agree with the expected value computed from the template. """ with open(DEVELOPMENT_TEMPLATE, "r") as file_obj: template = file_ob...
[ "def", "development_verify", "(", ")", ":", "with", "open", "(", "DEVELOPMENT_TEMPLATE", ",", "\"r\"", ")", "as", "file_obj", ":", "template", "=", "file_obj", ".", "read", "(", ")", "expected", "=", "template", ".", "format", "(", "revision", "=", "REVISI...
Populate template and compare to ``DEVELOPMENT.rst`` Raises: ValueError: If the current ``DEVELOPMENT.rst`` doesn't agree with the expected value computed from the template.
[ "Populate", "template", "and", "compare", "to", "DEVELOPMENT", ".", "rst" ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/scripts/check_doc_templates.py#L534-L556
dhermes/bezier
scripts/check_doc_templates.py
native_libraries_verify
def native_libraries_verify(): """Populate the template and compare to ``binary-extension.rst``. Raises: ValueError: If the current ``docs/python/binary-extension.rst`` doesn't agree with the expected value computed from the template. """ with open(BINARY_EXT_TEMPLATE, "r") as file_...
python
def native_libraries_verify(): """Populate the template and compare to ``binary-extension.rst``. Raises: ValueError: If the current ``docs/python/binary-extension.rst`` doesn't agree with the expected value computed from the template. """ with open(BINARY_EXT_TEMPLATE, "r") as file_...
[ "def", "native_libraries_verify", "(", ")", ":", "with", "open", "(", "BINARY_EXT_TEMPLATE", ",", "\"r\"", ")", "as", "file_obj", ":", "template", "=", "file_obj", ".", "read", "(", ")", "expected", "=", "template", ".", "format", "(", "revision", "=", "RE...
Populate the template and compare to ``binary-extension.rst``. Raises: ValueError: If the current ``docs/python/binary-extension.rst`` doesn't agree with the expected value computed from the template.
[ "Populate", "the", "template", "and", "compare", "to", "binary", "-", "extension", ".", "rst", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/scripts/check_doc_templates.py#L559-L581
dhermes/bezier
src/bezier/_algebraic_intersection.py
_evaluate3
def _evaluate3(nodes, x_val, y_val): """Helper for :func:`evaluate` when ``nodes`` is degree 3. Args: nodes (numpy.ndarray): ``2 x 4`` array of nodes in a curve. x_val (float): ``x``-coordinate for evaluation. y_val (float): ``y``-coordinate for evaluation. Returns: float: ...
python
def _evaluate3(nodes, x_val, y_val): """Helper for :func:`evaluate` when ``nodes`` is degree 3. Args: nodes (numpy.ndarray): ``2 x 4`` array of nodes in a curve. x_val (float): ``x``-coordinate for evaluation. y_val (float): ``y``-coordinate for evaluation. Returns: float: ...
[ "def", "_evaluate3", "(", "nodes", ",", "x_val", ",", "y_val", ")", ":", "# NOTE: This may be (a) slower and (b) less precise than", "# hard-coding the determinant.", "sylvester_mat", "=", "np", ".", "zeros", "(", "(", "6", ",", "6", ")", ",", "order", "=", ...
Helper for :func:`evaluate` when ``nodes`` is degree 3. Args: nodes (numpy.ndarray): ``2 x 4`` array of nodes in a curve. x_val (float): ``x``-coordinate for evaluation. y_val (float): ``y``-coordinate for evaluation. Returns: float: The computed value of :math:`f(x, y)`.
[ "Helper", "for", ":", "func", ":", "evaluate", "when", "nodes", "is", "degree", "3", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_algebraic_intersection.py#L120-L141
dhermes/bezier
src/bezier/_algebraic_intersection.py
evaluate
def evaluate(nodes, x_val, y_val): r"""Evaluate the implicitized bivariate polynomial containing the curve. Assumes `algebraic curve`_ containing :math:`B(s, t)` is given by :math:`f(x, y) = 0`. This function evaluates :math:`f(x, y)`. .. note:: This assumes, but doesn't check, that ``nodes`` ...
python
def evaluate(nodes, x_val, y_val): r"""Evaluate the implicitized bivariate polynomial containing the curve. Assumes `algebraic curve`_ containing :math:`B(s, t)` is given by :math:`f(x, y) = 0`. This function evaluates :math:`f(x, y)`. .. note:: This assumes, but doesn't check, that ``nodes`` ...
[ "def", "evaluate", "(", "nodes", ",", "x_val", ",", "y_val", ")", ":", "_", ",", "num_nodes", "=", "nodes", ".", "shape", "if", "num_nodes", "==", "1", ":", "raise", "ValueError", "(", "\"A point cannot be implicitized\"", ")", "elif", "num_nodes", "==", "...
r"""Evaluate the implicitized bivariate polynomial containing the curve. Assumes `algebraic curve`_ containing :math:`B(s, t)` is given by :math:`f(x, y) = 0`. This function evaluates :math:`f(x, y)`. .. note:: This assumes, but doesn't check, that ``nodes`` has 2 rows. .. note:: This...
[ "r", "Evaluate", "the", "implicitized", "bivariate", "polynomial", "containing", "the", "curve", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_algebraic_intersection.py#L144-L212
dhermes/bezier
src/bezier/_algebraic_intersection.py
eval_intersection_polynomial
def eval_intersection_polynomial(nodes1, nodes2, t): r"""Evaluates a parametric curve **on** an implicitized algebraic curve. Uses :func:`evaluate` to evaluate :math:`f_1(x, y)`, the implicitization of ``nodes1``. Then plugs ``t`` into the second parametric curve to get an ``x``- and ``y``-coordinate a...
python
def eval_intersection_polynomial(nodes1, nodes2, t): r"""Evaluates a parametric curve **on** an implicitized algebraic curve. Uses :func:`evaluate` to evaluate :math:`f_1(x, y)`, the implicitization of ``nodes1``. Then plugs ``t`` into the second parametric curve to get an ``x``- and ``y``-coordinate a...
[ "def", "eval_intersection_polynomial", "(", "nodes1", ",", "nodes2", ",", "t", ")", ":", "(", "x_val", ",", ")", ",", "(", "y_val", ",", ")", "=", "_curve_helpers", ".", "evaluate_multi", "(", "nodes2", ",", "np", ".", "asfortranarray", "(", "[", "t", ...
r"""Evaluates a parametric curve **on** an implicitized algebraic curve. Uses :func:`evaluate` to evaluate :math:`f_1(x, y)`, the implicitization of ``nodes1``. Then plugs ``t`` into the second parametric curve to get an ``x``- and ``y``-coordinate and evaluate the **intersection polynomial**: .. ...
[ "r", "Evaluates", "a", "parametric", "curve", "**", "on", "**", "an", "implicitized", "algebraic", "curve", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_algebraic_intersection.py#L215-L239
dhermes/bezier
src/bezier/_algebraic_intersection.py
_to_power_basis11
def _to_power_basis11(nodes1, nodes2): r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that each curve is degree one. In this case, B |eacute| zout's `theorem`_ tells us that the **intersection polynomial** is degree :math:`1 \cdot 1` he...
python
def _to_power_basis11(nodes1, nodes2): r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that each curve is degree one. In this case, B |eacute| zout's `theorem`_ tells us that the **intersection polynomial** is degree :math:`1 \cdot 1` he...
[ "def", "_to_power_basis11", "(", "nodes1", ",", "nodes2", ")", ":", "# We manually invert the Vandermonde matrix:", "# [1 0][c0] = [n0]", "# [1 1][c1] [n1]", "val0", "=", "eval_intersection_polynomial", "(", "nodes1", ",", "nodes2", ",", "0.0", ")", "val1", "=", "eval...
r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that each curve is degree one. In this case, B |eacute| zout's `theorem`_ tells us that the **intersection polynomial** is degree :math:`1 \cdot 1` hence we return two coefficients. Args: ...
[ "r", "Compute", "the", "coefficients", "of", "an", "**", "intersection", "polynomial", "**", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_algebraic_intersection.py#L242-L264
dhermes/bezier
src/bezier/_algebraic_intersection.py
_to_power_basis12
def _to_power_basis12(nodes1, nodes2): r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that the first curve is degree one and the second is degree two. In this case, B |eacute| zout's `theorem`_ tells us that the **intersection polynomial** ...
python
def _to_power_basis12(nodes1, nodes2): r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that the first curve is degree one and the second is degree two. In this case, B |eacute| zout's `theorem`_ tells us that the **intersection polynomial** ...
[ "def", "_to_power_basis12", "(", "nodes1", ",", "nodes2", ")", ":", "# We manually invert the Vandermonde matrix:", "# [1 0 0 ][c0] = [n0]", "# [1 1/2 1/4][c1] [n1]", "# [1 1 1 ][c2] [n2]", "val0", "=", "eval_intersection_polynomial", "(", "nodes1", ",", "nodes2", ","...
r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that the first curve is degree one and the second is degree two. In this case, B |eacute| zout's `theorem`_ tells us that the **intersection polynomial** is degree :math:`1 \cdot 2` hence we re...
[ "r", "Compute", "the", "coefficients", "of", "an", "**", "intersection", "polynomial", "**", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_algebraic_intersection.py#L267-L298
dhermes/bezier
src/bezier/_algebraic_intersection.py
_to_power_basis13
def _to_power_basis13(nodes1, nodes2): r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that the first curve is degree one and the second is degree three. In this case, B |eacute| zout's `theorem`_ tells us that the **intersection polynomial*...
python
def _to_power_basis13(nodes1, nodes2): r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that the first curve is degree one and the second is degree three. In this case, B |eacute| zout's `theorem`_ tells us that the **intersection polynomial*...
[ "def", "_to_power_basis13", "(", "nodes1", ",", "nodes2", ")", ":", "# We manually invert the Vandermonde matrix:", "# Use exact f.p. numbers to avoid round-off wherever possible.", "# [1 0 0 0 ][c0] = [n0]", "# [1 1/4 1/16 1/64 ][c1] [n1]", "# [1 3/4 9/16 27/64][c2] [n2]", "# ...
r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that the first curve is degree one and the second is degree three. In this case, B |eacute| zout's `theorem`_ tells us that the **intersection polynomial** is degree :math:`1 \cdot 3` hence we ...
[ "r", "Compute", "the", "coefficients", "of", "an", "**", "intersection", "polynomial", "**", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_algebraic_intersection.py#L301-L339
dhermes/bezier
src/bezier/_algebraic_intersection.py
_to_power_basis_degree4
def _to_power_basis_degree4(nodes1, nodes2): r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that B |eacute| zout's `theorem`_ tells us the **intersection polynomial** is degree :math:`4`. This happens if the two curves have degrees two and ...
python
def _to_power_basis_degree4(nodes1, nodes2): r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that B |eacute| zout's `theorem`_ tells us the **intersection polynomial** is degree :math:`4`. This happens if the two curves have degrees two and ...
[ "def", "_to_power_basis_degree4", "(", "nodes1", ",", "nodes2", ")", ":", "# We manually invert the Vandermonde matrix:", "# [1 0 0 0 0 ][c0] = [n0]", "# [1 1/4 1/16 1/64 1/256 ][c1] [n1]", "# [1 1/2 1/4 1/8 1/16 ][c2] [n2]", "# [1 3/4 9/16 27/64 81/256][c3] [n3]", ...
r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that B |eacute| zout's `theorem`_ tells us the **intersection polynomial** is degree :math:`4`. This happens if the two curves have degrees two and two or have degrees one and four. Args: ...
[ "r", "Compute", "the", "coefficients", "of", "an", "**", "intersection", "polynomial", "**", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_algebraic_intersection.py#L342-L401
dhermes/bezier
src/bezier/_algebraic_intersection.py
_to_power_basis23
def _to_power_basis23(nodes1, nodes2): r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that the first curve is degree two and the second is degree three. In this case, B |eacute| zout's `theorem`_ tells us that the **intersection polynomial*...
python
def _to_power_basis23(nodes1, nodes2): r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that the first curve is degree two and the second is degree three. In this case, B |eacute| zout's `theorem`_ tells us that the **intersection polynomial*...
[ "def", "_to_power_basis23", "(", "nodes1", ",", "nodes2", ")", ":", "evaluated", "=", "[", "eval_intersection_polynomial", "(", "nodes1", ",", "nodes2", ",", "t_val", ")", "for", "t_val", "in", "_CHEB7", "]", "return", "polynomial", ".", "polyfit", "(", "_CH...
r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that the first curve is degree two and the second is degree three. In this case, B |eacute| zout's `theorem`_ tells us that the **intersection polynomial** is degree :math:`2 \cdot 3` hence we ...
[ "r", "Compute", "the", "coefficients", "of", "an", "**", "intersection", "polynomial", "**", "." ]
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_algebraic_intersection.py#L404-L429