id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
230,300 | orbingol/NURBS-Python | geomdl/visualization/vtk_helpers.py | create_actor_hexahedron | def create_actor_hexahedron(grid, color, **kwargs):
""" Creates a VTK actor for rendering voxels using hexahedron elements.
:param grid: grid
:type grid: ndarray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor
"""
# Keyword arguments
array_name ... | python | def create_actor_hexahedron(grid, color, **kwargs):
""" Creates a VTK actor for rendering voxels using hexahedron elements.
:param grid: grid
:type grid: ndarray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor
"""
# Keyword arguments
array_name ... | [
"def",
"create_actor_hexahedron",
"(",
"grid",
",",
"color",
",",
"*",
"*",
"kwargs",
")",
":",
"# Keyword arguments",
"array_name",
"=",
"kwargs",
".",
"get",
"(",
"'name'",
",",
"\"\"",
")",
"array_index",
"=",
"kwargs",
".",
"get",
"(",
"'index'",
",",
... | Creates a VTK actor for rendering voxels using hexahedron elements.
:param grid: grid
:type grid: ndarray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor | [
"Creates",
"a",
"VTK",
"actor",
"for",
"rendering",
"voxels",
"using",
"hexahedron",
"elements",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/vtk_helpers.py#L289-L336 |
230,301 | orbingol/NURBS-Python | geomdl/visualization/vtk_helpers.py | create_actor_delaunay | def create_actor_delaunay(pts, color, **kwargs):
""" Creates a VTK actor for rendering triangulated plots using Delaunay triangulation.
Keyword Arguments:
* ``d3d``: flag to choose between Delaunay2D (``False``) and Delaunay3D (``True``). *Default: False*
:param pts: points
:type pts: vtkFloat... | python | def create_actor_delaunay(pts, color, **kwargs):
""" Creates a VTK actor for rendering triangulated plots using Delaunay triangulation.
Keyword Arguments:
* ``d3d``: flag to choose between Delaunay2D (``False``) and Delaunay3D (``True``). *Default: False*
:param pts: points
:type pts: vtkFloat... | [
"def",
"create_actor_delaunay",
"(",
"pts",
",",
"color",
",",
"*",
"*",
"kwargs",
")",
":",
"# Keyword arguments",
"array_name",
"=",
"kwargs",
".",
"get",
"(",
"'name'",
",",
"\"\"",
")",
"array_index",
"=",
"kwargs",
".",
"get",
"(",
"'index'",
",",
"... | Creates a VTK actor for rendering triangulated plots using Delaunay triangulation.
Keyword Arguments:
* ``d3d``: flag to choose between Delaunay2D (``False``) and Delaunay3D (``True``). *Default: False*
:param pts: points
:type pts: vtkFloatArray
:param color: actor color
:type color: list... | [
"Creates",
"a",
"VTK",
"actor",
"for",
"rendering",
"triangulated",
"plots",
"using",
"Delaunay",
"triangulation",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/vtk_helpers.py#L339-L381 |
230,302 | orbingol/NURBS-Python | geomdl/compatibility.py | flip_ctrlpts_u | def flip_ctrlpts_u(ctrlpts, size_u, size_v):
""" Flips a list of 1-dimensional control points from u-row order to v-row order.
**u-row order**: each row corresponds to a list of u values
**v-row order**: each row corresponds to a list of v values
:param ctrlpts: control points in u-row order
:typ... | python | def flip_ctrlpts_u(ctrlpts, size_u, size_v):
""" Flips a list of 1-dimensional control points from u-row order to v-row order.
**u-row order**: each row corresponds to a list of u values
**v-row order**: each row corresponds to a list of v values
:param ctrlpts: control points in u-row order
:typ... | [
"def",
"flip_ctrlpts_u",
"(",
"ctrlpts",
",",
"size_u",
",",
"size_v",
")",
":",
"new_ctrlpts",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"size_u",
")",
":",
"for",
"j",
"in",
"range",
"(",
"0",
",",
"size_v",
")",
":",
"temp",
"="... | Flips a list of 1-dimensional control points from u-row order to v-row order.
**u-row order**: each row corresponds to a list of u values
**v-row order**: each row corresponds to a list of v values
:param ctrlpts: control points in u-row order
:type ctrlpts: list, tuple
:param size_u: size in u-d... | [
"Flips",
"a",
"list",
"of",
"1",
"-",
"dimensional",
"control",
"points",
"from",
"u",
"-",
"row",
"order",
"to",
"v",
"-",
"row",
"order",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/compatibility.py#L11-L33 |
230,303 | orbingol/NURBS-Python | geomdl/compatibility.py | generate_ctrlptsw | def generate_ctrlptsw(ctrlpts):
""" Generates weighted control points from unweighted ones in 1-D.
This function
#. Takes in a 1-D control points list whose coordinates are organized in (x, y, z, w) format
#. converts into (x*w, y*w, z*w, w) format
#. Returns the result
:param ctrlpts: 1-D co... | python | def generate_ctrlptsw(ctrlpts):
""" Generates weighted control points from unweighted ones in 1-D.
This function
#. Takes in a 1-D control points list whose coordinates are organized in (x, y, z, w) format
#. converts into (x*w, y*w, z*w, w) format
#. Returns the result
:param ctrlpts: 1-D co... | [
"def",
"generate_ctrlptsw",
"(",
"ctrlpts",
")",
":",
"# Multiply control points by weight",
"new_ctrlpts",
"=",
"[",
"]",
"for",
"cpt",
"in",
"ctrlpts",
":",
"temp",
"=",
"[",
"float",
"(",
"pt",
"*",
"cpt",
"[",
"-",
"1",
"]",
")",
"for",
"pt",
"in",
... | Generates weighted control points from unweighted ones in 1-D.
This function
#. Takes in a 1-D control points list whose coordinates are organized in (x, y, z, w) format
#. converts into (x*w, y*w, z*w, w) format
#. Returns the result
:param ctrlpts: 1-D control points (P)
:type ctrlpts: list... | [
"Generates",
"weighted",
"control",
"points",
"from",
"unweighted",
"ones",
"in",
"1",
"-",
"D",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/compatibility.py#L86-L107 |
230,304 | orbingol/NURBS-Python | geomdl/compatibility.py | generate_ctrlpts_weights | def generate_ctrlpts_weights(ctrlpts):
""" Generates unweighted control points from weighted ones in 1-D.
This function
#. Takes in 1-D control points list whose coordinates are organized in (x*w, y*w, z*w, w) format
#. Converts the input control points list into (x, y, z, w) format
#. Returns the... | python | def generate_ctrlpts_weights(ctrlpts):
""" Generates unweighted control points from weighted ones in 1-D.
This function
#. Takes in 1-D control points list whose coordinates are organized in (x*w, y*w, z*w, w) format
#. Converts the input control points list into (x, y, z, w) format
#. Returns the... | [
"def",
"generate_ctrlpts_weights",
"(",
"ctrlpts",
")",
":",
"# Divide control points by weight",
"new_ctrlpts",
"=",
"[",
"]",
"for",
"cpt",
"in",
"ctrlpts",
":",
"temp",
"=",
"[",
"float",
"(",
"pt",
"/",
"cpt",
"[",
"-",
"1",
"]",
")",
"for",
"pt",
"i... | Generates unweighted control points from weighted ones in 1-D.
This function
#. Takes in 1-D control points list whose coordinates are organized in (x*w, y*w, z*w, w) format
#. Converts the input control points list into (x, y, z, w) format
#. Returns the result
:param ctrlpts: 1-D control points... | [
"Generates",
"unweighted",
"control",
"points",
"from",
"weighted",
"ones",
"in",
"1",
"-",
"D",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/compatibility.py#L139-L160 |
230,305 | orbingol/NURBS-Python | geomdl/compatibility.py | combine_ctrlpts_weights | def combine_ctrlpts_weights(ctrlpts, weights=None):
""" Multiplies control points by the weights to generate weighted control points.
This function is dimension agnostic, i.e. control points can be in any dimension but weights should be 1D.
The ``weights`` function parameter can be set to None to let the ... | python | def combine_ctrlpts_weights(ctrlpts, weights=None):
""" Multiplies control points by the weights to generate weighted control points.
This function is dimension agnostic, i.e. control points can be in any dimension but weights should be 1D.
The ``weights`` function parameter can be set to None to let the ... | [
"def",
"combine_ctrlpts_weights",
"(",
"ctrlpts",
",",
"weights",
"=",
"None",
")",
":",
"if",
"weights",
"is",
"None",
":",
"weights",
"=",
"[",
"1.0",
"for",
"_",
"in",
"range",
"(",
"len",
"(",
"ctrlpts",
")",
")",
"]",
"ctrlptsw",
"=",
"[",
"]",
... | Multiplies control points by the weights to generate weighted control points.
This function is dimension agnostic, i.e. control points can be in any dimension but weights should be 1D.
The ``weights`` function parameter can be set to None to let the function generate a weights vector composed of
1.0 value... | [
"Multiplies",
"control",
"points",
"by",
"the",
"weights",
"to",
"generate",
"weighted",
"control",
"points",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/compatibility.py#L190-L214 |
230,306 | orbingol/NURBS-Python | geomdl/compatibility.py | separate_ctrlpts_weights | def separate_ctrlpts_weights(ctrlptsw):
""" Divides weighted control points by weights to generate unweighted control points and weights vector.
This function is dimension agnostic, i.e. control points can be in any dimension but the last element of the array
should indicate the weight.
:param ctrlpts... | python | def separate_ctrlpts_weights(ctrlptsw):
""" Divides weighted control points by weights to generate unweighted control points and weights vector.
This function is dimension agnostic, i.e. control points can be in any dimension but the last element of the array
should indicate the weight.
:param ctrlpts... | [
"def",
"separate_ctrlpts_weights",
"(",
"ctrlptsw",
")",
":",
"ctrlpts",
"=",
"[",
"]",
"weights",
"=",
"[",
"]",
"for",
"ptw",
"in",
"ctrlptsw",
":",
"temp",
"=",
"[",
"float",
"(",
"pw",
"/",
"ptw",
"[",
"-",
"1",
"]",
")",
"for",
"pw",
"in",
"... | Divides weighted control points by weights to generate unweighted control points and weights vector.
This function is dimension agnostic, i.e. control points can be in any dimension but the last element of the array
should indicate the weight.
:param ctrlptsw: weighted control points
:type ctrlptsw: l... | [
"Divides",
"weighted",
"control",
"points",
"by",
"weights",
"to",
"generate",
"unweighted",
"control",
"points",
"and",
"weights",
"vector",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/compatibility.py#L217-L235 |
230,307 | orbingol/NURBS-Python | geomdl/compatibility.py | flip_ctrlpts2d_file | def flip_ctrlpts2d_file(file_in='', file_out='ctrlpts_flip.txt'):
""" Flips u and v directions of a 2D control points file and saves flipped coordinates to a file.
:param file_in: name of the input file (to be read)
:type file_in: str
:param file_out: name of the output file (to be saved)
:type fil... | python | def flip_ctrlpts2d_file(file_in='', file_out='ctrlpts_flip.txt'):
""" Flips u and v directions of a 2D control points file and saves flipped coordinates to a file.
:param file_in: name of the input file (to be read)
:type file_in: str
:param file_out: name of the output file (to be saved)
:type fil... | [
"def",
"flip_ctrlpts2d_file",
"(",
"file_in",
"=",
"''",
",",
"file_out",
"=",
"'ctrlpts_flip.txt'",
")",
":",
"# Read control points",
"ctrlpts2d",
",",
"size_u",
",",
"size_v",
"=",
"_read_ctrltps2d_file",
"(",
"file_in",
")",
"# Flip control points array",
"new_ctr... | Flips u and v directions of a 2D control points file and saves flipped coordinates to a file.
:param file_in: name of the input file (to be read)
:type file_in: str
:param file_out: name of the output file (to be saved)
:type file_out: str
:raises IOError: an error occurred reading or writing the f... | [
"Flips",
"u",
"and",
"v",
"directions",
"of",
"a",
"2D",
"control",
"points",
"file",
"and",
"saves",
"flipped",
"coordinates",
"to",
"a",
"file",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/compatibility.py#L238-L254 |
230,308 | orbingol/NURBS-Python | geomdl/compatibility.py | generate_ctrlptsw2d_file | def generate_ctrlptsw2d_file(file_in='', file_out='ctrlptsw.txt'):
""" Generates weighted control points from unweighted ones in 2-D.
This function
#. Takes in a 2-D control points file whose coordinates are organized in (x, y, z, w) format
#. Converts into (x*w, y*w, z*w, w) format
#. Saves the r... | python | def generate_ctrlptsw2d_file(file_in='', file_out='ctrlptsw.txt'):
""" Generates weighted control points from unweighted ones in 2-D.
This function
#. Takes in a 2-D control points file whose coordinates are organized in (x, y, z, w) format
#. Converts into (x*w, y*w, z*w, w) format
#. Saves the r... | [
"def",
"generate_ctrlptsw2d_file",
"(",
"file_in",
"=",
"''",
",",
"file_out",
"=",
"'ctrlptsw.txt'",
")",
":",
"# Read control points",
"ctrlpts2d",
",",
"size_u",
",",
"size_v",
"=",
"_read_ctrltps2d_file",
"(",
"file_in",
")",
"# Multiply control points by weight",
... | Generates weighted control points from unweighted ones in 2-D.
This function
#. Takes in a 2-D control points file whose coordinates are organized in (x, y, z, w) format
#. Converts into (x*w, y*w, z*w, w) format
#. Saves the result to a file
Therefore, the resultant file could be a direct input ... | [
"Generates",
"weighted",
"control",
"points",
"from",
"unweighted",
"ones",
"in",
"2",
"-",
"D",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/compatibility.py#L257-L281 |
230,309 | orbingol/NURBS-Python | geomdl/visualization/VisVTK.py | VisConfig.keypress_callback | def keypress_callback(self, obj, ev):
""" VTK callback for keypress events.
Keypress events:
* ``e``: exit the application
* ``p``: pick object (hover the mouse and then press to pick)
* ``f``: fly to point (click somewhere in the window and press to fly)
... | python | def keypress_callback(self, obj, ev):
""" VTK callback for keypress events.
Keypress events:
* ``e``: exit the application
* ``p``: pick object (hover the mouse and then press to pick)
* ``f``: fly to point (click somewhere in the window and press to fly)
... | [
"def",
"keypress_callback",
"(",
"self",
",",
"obj",
",",
"ev",
")",
":",
"key",
"=",
"obj",
".",
"GetKeySym",
"(",
")",
"# pressed key (as str)",
"render_window",
"=",
"obj",
".",
"GetRenderWindow",
"(",
")",
"# vtkRenderWindow",
"renderer",
"=",
"render_wind... | VTK callback for keypress events.
Keypress events:
* ``e``: exit the application
* ``p``: pick object (hover the mouse and then press to pick)
* ``f``: fly to point (click somewhere in the window and press to fly)
* ``r``: reset the camera
* ``s`` and... | [
"VTK",
"callback",
"for",
"keypress",
"events",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/VisVTK.py#L46-L112 |
230,310 | orbingol/NURBS-Python | geomdl/_voxelize.py | generate_voxel_grid | def generate_voxel_grid(bbox, szval, use_cubes=False):
""" Generates the voxel grid with the desired size.
:param bbox: bounding box
:type bbox: list, tuple
:param szval: size in x-, y-, z-directions
:type szval: list, tuple
:param use_cubes: use cube voxels instead of cuboid ones
:type use... | python | def generate_voxel_grid(bbox, szval, use_cubes=False):
""" Generates the voxel grid with the desired size.
:param bbox: bounding box
:type bbox: list, tuple
:param szval: size in x-, y-, z-directions
:type szval: list, tuple
:param use_cubes: use cube voxels instead of cuboid ones
:type use... | [
"def",
"generate_voxel_grid",
"(",
"bbox",
",",
"szval",
",",
"use_cubes",
"=",
"False",
")",
":",
"# Input validation",
"if",
"szval",
"[",
"0",
"]",
"<=",
"1",
"or",
"szval",
"[",
"1",
"]",
"<=",
"1",
"or",
"szval",
"[",
"2",
"]",
"<=",
"1",
":",... | Generates the voxel grid with the desired size.
:param bbox: bounding box
:type bbox: list, tuple
:param szval: size in x-, y-, z-directions
:type szval: list, tuple
:param use_cubes: use cube voxels instead of cuboid ones
:type use_cubes: bool
:return: voxel grid
:rtype: list | [
"Generates",
"the",
"voxel",
"grid",
"with",
"the",
"desired",
"size",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_voxelize.py#L49-L83 |
230,311 | orbingol/NURBS-Python | geomdl/_exchange.py | process_template | def process_template(file_src):
""" Process Jinja2 template input
:param file_src: file contents
:type file_src: str
"""
def tmpl_sqrt(x):
""" Square-root of 'x' """
return math.sqrt(x)
def tmpl_cubert(x):
""" Cube-root of 'x' """
return x ** (1.0 / 3.0) if x >=... | python | def process_template(file_src):
""" Process Jinja2 template input
:param file_src: file contents
:type file_src: str
"""
def tmpl_sqrt(x):
""" Square-root of 'x' """
return math.sqrt(x)
def tmpl_cubert(x):
""" Cube-root of 'x' """
return x ** (1.0 / 3.0) if x >=... | [
"def",
"process_template",
"(",
"file_src",
")",
":",
"def",
"tmpl_sqrt",
"(",
"x",
")",
":",
"\"\"\" Square-root of 'x' \"\"\"",
"return",
"math",
".",
"sqrt",
"(",
"x",
")",
"def",
"tmpl_cubert",
"(",
"x",
")",
":",
"\"\"\" Cube-root of 'x' \"\"\"",
"return",
... | Process Jinja2 template input
:param file_src: file contents
:type file_src: str | [
"Process",
"Jinja2",
"template",
"input"
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_exchange.py#L21-L67 |
230,312 | orbingol/NURBS-Python | geomdl/_exchange.py | import_surf_mesh | def import_surf_mesh(file_name):
""" Generates a NURBS surface object from a mesh file.
:param file_name: input mesh file
:type file_name: str
:return: a NURBS surface
:rtype: NURBS.Surface
"""
raw_content = read_file(file_name)
raw_content = raw_content.split("\n")
content = []
... | python | def import_surf_mesh(file_name):
""" Generates a NURBS surface object from a mesh file.
:param file_name: input mesh file
:type file_name: str
:return: a NURBS surface
:rtype: NURBS.Surface
"""
raw_content = read_file(file_name)
raw_content = raw_content.split("\n")
content = []
... | [
"def",
"import_surf_mesh",
"(",
"file_name",
")",
":",
"raw_content",
"=",
"read_file",
"(",
"file_name",
")",
"raw_content",
"=",
"raw_content",
".",
"split",
"(",
"\"\\n\"",
")",
"content",
"=",
"[",
"]",
"for",
"rc",
"in",
"raw_content",
":",
"temp",
"=... | Generates a NURBS surface object from a mesh file.
:param file_name: input mesh file
:type file_name: str
:return: a NURBS surface
:rtype: NURBS.Surface | [
"Generates",
"a",
"NURBS",
"surface",
"object",
"from",
"a",
"mesh",
"file",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_exchange.py#L102-L150 |
230,313 | orbingol/NURBS-Python | geomdl/_exchange.py | import_vol_mesh | def import_vol_mesh(file_name):
""" Generates a NURBS volume object from a mesh file.
:param file_name: input mesh file
:type file_name: str
:return: a NURBS volume
:rtype: NURBS.Volume
"""
raw_content = read_file(file_name)
raw_content = raw_content.split("\n")
content = []
for... | python | def import_vol_mesh(file_name):
""" Generates a NURBS volume object from a mesh file.
:param file_name: input mesh file
:type file_name: str
:return: a NURBS volume
:rtype: NURBS.Volume
"""
raw_content = read_file(file_name)
raw_content = raw_content.split("\n")
content = []
for... | [
"def",
"import_vol_mesh",
"(",
"file_name",
")",
":",
"raw_content",
"=",
"read_file",
"(",
"file_name",
")",
"raw_content",
"=",
"raw_content",
".",
"split",
"(",
"\"\\n\"",
")",
"content",
"=",
"[",
"]",
"for",
"rc",
"in",
"raw_content",
":",
"temp",
"="... | Generates a NURBS volume object from a mesh file.
:param file_name: input mesh file
:type file_name: str
:return: a NURBS volume
:rtype: NURBS.Volume | [
"Generates",
"a",
"NURBS",
"volume",
"object",
"from",
"a",
"mesh",
"file",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_exchange.py#L153-L207 |
230,314 | orbingol/NURBS-Python | geomdl/exchange.py | import_txt | def import_txt(file_name, two_dimensional=False, **kwargs):
""" Reads control points from a text file and generates a 1-dimensional list of control points.
The following code examples illustrate importing different types of text files for curves and surfaces:
.. code-block:: python
:linenos:
... | python | def import_txt(file_name, two_dimensional=False, **kwargs):
""" Reads control points from a text file and generates a 1-dimensional list of control points.
The following code examples illustrate importing different types of text files for curves and surfaces:
.. code-block:: python
:linenos:
... | [
"def",
"import_txt",
"(",
"file_name",
",",
"two_dimensional",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# Read file",
"content",
"=",
"exch",
".",
"read_file",
"(",
"file_name",
")",
"# Are we using a Jinja2 template?",
"j2tmpl",
"=",
"kwargs",
".",
"... | Reads control points from a text file and generates a 1-dimensional list of control points.
The following code examples illustrate importing different types of text files for curves and surfaces:
.. code-block:: python
:linenos:
# Import curve control points from a text file
curve_ctr... | [
"Reads",
"control",
"points",
"from",
"a",
"text",
"file",
"and",
"generates",
"a",
"1",
"-",
"dimensional",
"list",
"of",
"control",
"points",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L21-L89 |
230,315 | orbingol/NURBS-Python | geomdl/exchange.py | export_txt | def export_txt(obj, file_name, two_dimensional=False, **kwargs):
""" Exports control points as a text file.
For curves the output is always a list of control points. For surfaces, it is possible to generate a 2-dimensional
control point output file using ``two_dimensional``.
Please see :py:func:`.exch... | python | def export_txt(obj, file_name, two_dimensional=False, **kwargs):
""" Exports control points as a text file.
For curves the output is always a list of control points. For surfaces, it is possible to generate a 2-dimensional
control point output file using ``two_dimensional``.
Please see :py:func:`.exch... | [
"def",
"export_txt",
"(",
"obj",
",",
"file_name",
",",
"two_dimensional",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# Check if the user has set any control points",
"if",
"obj",
".",
"ctrlpts",
"is",
"None",
"or",
"len",
"(",
"obj",
".",
"ctrlpts",
... | Exports control points as a text file.
For curves the output is always a list of control points. For surfaces, it is possible to generate a 2-dimensional
control point output file using ``two_dimensional``.
Please see :py:func:`.exchange.import_txt()` for detailed description of the keyword arguments.
... | [
"Exports",
"control",
"points",
"as",
"a",
"text",
"file",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L93-L123 |
230,316 | orbingol/NURBS-Python | geomdl/exchange.py | import_csv | def import_csv(file_name, **kwargs):
""" Reads control points from a CSV file and generates a 1-dimensional list of control points.
It is possible to use a different value separator via ``separator`` keyword argument. The following code segment
illustrates the usage of ``separator`` keyword argument.
... | python | def import_csv(file_name, **kwargs):
""" Reads control points from a CSV file and generates a 1-dimensional list of control points.
It is possible to use a different value separator via ``separator`` keyword argument. The following code segment
illustrates the usage of ``separator`` keyword argument.
... | [
"def",
"import_csv",
"(",
"file_name",
",",
"*",
"*",
"kwargs",
")",
":",
"# File delimiters",
"sep",
"=",
"kwargs",
".",
"get",
"(",
"'separator'",
",",
"\",\"",
")",
"content",
"=",
"exch",
".",
"read_file",
"(",
"file_name",
",",
"skip_lines",
"=",
"1... | Reads control points from a CSV file and generates a 1-dimensional list of control points.
It is possible to use a different value separator via ``separator`` keyword argument. The following code segment
illustrates the usage of ``separator`` keyword argument.
.. code-block:: python
:linenos:
... | [
"Reads",
"control",
"points",
"from",
"a",
"CSV",
"file",
"and",
"generates",
"a",
"1",
"-",
"dimensional",
"list",
"of",
"control",
"points",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L127-L155 |
230,317 | orbingol/NURBS-Python | geomdl/exchange.py | export_csv | def export_csv(obj, file_name, point_type='evalpts', **kwargs):
""" Exports control points or evaluated points as a CSV file.
:param obj: a spline geometry object
:type obj: abstract.SplineGeometry
:param file_name: output file name
:type file_name: str
:param point_type: ``ctrlpts`` for contro... | python | def export_csv(obj, file_name, point_type='evalpts', **kwargs):
""" Exports control points or evaluated points as a CSV file.
:param obj: a spline geometry object
:type obj: abstract.SplineGeometry
:param file_name: output file name
:type file_name: str
:param point_type: ``ctrlpts`` for contro... | [
"def",
"export_csv",
"(",
"obj",
",",
"file_name",
",",
"point_type",
"=",
"'evalpts'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"0",
"<",
"obj",
".",
"pdimension",
"<",
"3",
":",
"raise",
"exch",
".",
"GeomdlException",
"(",
"\"Input object shoul... | Exports control points or evaluated points as a CSV file.
:param obj: a spline geometry object
:type obj: abstract.SplineGeometry
:param file_name: output file name
:type file_name: str
:param point_type: ``ctrlpts`` for control points or ``evalpts`` for evaluated points
:type point_type: str
... | [
"Exports",
"control",
"points",
"or",
"evaluated",
"points",
"as",
"a",
"CSV",
"file",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L159-L193 |
230,318 | orbingol/NURBS-Python | geomdl/exchange.py | import_cfg | def import_cfg(file_name, **kwargs):
""" Imports curves and surfaces from files in libconfig format.
.. note::
Requires `libconf <https://pypi.org/project/libconf/>`_ package.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param fi... | python | def import_cfg(file_name, **kwargs):
""" Imports curves and surfaces from files in libconfig format.
.. note::
Requires `libconf <https://pypi.org/project/libconf/>`_ package.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param fi... | [
"def",
"import_cfg",
"(",
"file_name",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"callback",
"(",
"data",
")",
":",
"return",
"libconf",
".",
"loads",
"(",
"data",
")",
"# Check if it is possible to import 'libconf'",
"try",
":",
"import",
"libconf",
"except",... | Imports curves and surfaces from files in libconfig format.
.. note::
Requires `libconf <https://pypi.org/project/libconf/>`_ package.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param file_name: name of the input file
:type fil... | [
"Imports",
"curves",
"and",
"surfaces",
"from",
"files",
"in",
"libconfig",
"format",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L197-L229 |
230,319 | orbingol/NURBS-Python | geomdl/exchange.py | export_cfg | def export_cfg(obj, file_name):
""" Exports curves and surfaces in libconfig format.
.. note::
Requires `libconf <https://pypi.org/project/libconf/>`_ package.
Libconfig format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input sh... | python | def export_cfg(obj, file_name):
""" Exports curves and surfaces in libconfig format.
.. note::
Requires `libconf <https://pypi.org/project/libconf/>`_ package.
Libconfig format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input sh... | [
"def",
"export_cfg",
"(",
"obj",
",",
"file_name",
")",
":",
"def",
"callback",
"(",
"data",
")",
":",
"return",
"libconf",
".",
"dumps",
"(",
"data",
")",
"# Check if it is possible to import 'libconf'",
"try",
":",
"import",
"libconf",
"except",
"ImportError",... | Exports curves and surfaces in libconfig format.
.. note::
Requires `libconf <https://pypi.org/project/libconf/>`_ package.
Libconfig format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input shape data from the command line.
:pa... | [
"Exports",
"curves",
"and",
"surfaces",
"in",
"libconfig",
"format",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L233-L262 |
230,320 | orbingol/NURBS-Python | geomdl/exchange.py | import_yaml | def import_yaml(file_name, **kwargs):
""" Imports curves and surfaces from files in YAML format.
.. note::
Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:para... | python | def import_yaml(file_name, **kwargs):
""" Imports curves and surfaces from files in YAML format.
.. note::
Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:para... | [
"def",
"import_yaml",
"(",
"file_name",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"callback",
"(",
"data",
")",
":",
"yaml",
"=",
"YAML",
"(",
")",
"return",
"yaml",
".",
"load",
"(",
"data",
")",
"# Check if it is possible to import 'ruamel.yaml'",
"try",
... | Imports curves and surfaces from files in YAML format.
.. note::
Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param file_name: name of the input file
:type ... | [
"Imports",
"curves",
"and",
"surfaces",
"from",
"files",
"in",
"YAML",
"format",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L266-L299 |
230,321 | orbingol/NURBS-Python | geomdl/exchange.py | export_yaml | def export_yaml(obj, file_name):
""" Exports curves and surfaces in YAML format.
.. note::
Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.
YAML format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input sha... | python | def export_yaml(obj, file_name):
""" Exports curves and surfaces in YAML format.
.. note::
Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.
YAML format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input sha... | [
"def",
"export_yaml",
"(",
"obj",
",",
"file_name",
")",
":",
"def",
"callback",
"(",
"data",
")",
":",
"# Ref: https://yaml.readthedocs.io/en/latest/example.html#output-of-dump-as-a-string",
"stream",
"=",
"StringIO",
"(",
")",
"yaml",
"=",
"YAML",
"(",
")",
"yaml"... | Exports curves and surfaces in YAML format.
.. note::
Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.
YAML format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input shape data from the command line.
:para... | [
"Exports",
"curves",
"and",
"surfaces",
"in",
"YAML",
"format",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L303-L336 |
230,322 | orbingol/NURBS-Python | geomdl/exchange.py | import_json | def import_json(file_name, **kwargs):
""" Imports curves and surfaces from files in JSON format.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param file_name: name of the input file
:type file_name: str
:return: a list of rational spli... | python | def import_json(file_name, **kwargs):
""" Imports curves and surfaces from files in JSON format.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param file_name: name of the input file
:type file_name: str
:return: a list of rational spli... | [
"def",
"import_json",
"(",
"file_name",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"callback",
"(",
"data",
")",
":",
"return",
"json",
".",
"loads",
"(",
"data",
")",
"# Get keyword arguments",
"delta",
"=",
"kwargs",
".",
"get",
"(",
"'delta'",
",",
"... | Imports curves and surfaces from files in JSON format.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param file_name: name of the input file
:type file_name: str
:return: a list of rational spline geometries
:rtype: list
:raises Geo... | [
"Imports",
"curves",
"and",
"surfaces",
"from",
"files",
"in",
"JSON",
"format",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L340-L362 |
230,323 | orbingol/NURBS-Python | geomdl/exchange.py | export_json | def export_json(obj, file_name):
""" Exports curves and surfaces in JSON format.
JSON format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input shape data from the command line.
:param obj: input geometry
:type obj: abstract.SplineGeom... | python | def export_json(obj, file_name):
""" Exports curves and surfaces in JSON format.
JSON format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input shape data from the command line.
:param obj: input geometry
:type obj: abstract.SplineGeom... | [
"def",
"export_json",
"(",
"obj",
",",
"file_name",
")",
":",
"def",
"callback",
"(",
"data",
")",
":",
"return",
"json",
".",
"dumps",
"(",
"data",
",",
"indent",
"=",
"4",
")",
"# Export data",
"exported_data",
"=",
"exch",
".",
"export_dict_str",
"(",... | Exports curves and surfaces in JSON format.
JSON format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input shape data from the command line.
:param obj: input geometry
:type obj: abstract.SplineGeometry, multi.AbstractContainer
:param ... | [
"Exports",
"curves",
"and",
"surfaces",
"in",
"JSON",
"format",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L366-L385 |
230,324 | orbingol/NURBS-Python | geomdl/exchange.py | import_obj | def import_obj(file_name, **kwargs):
""" Reads .obj files and generates faces.
Keyword Arguments:
* ``callback``: reference to the function that processes the faces for customized output
The structure of the callback function is shown below:
.. code-block:: python
def my_callback_fun... | python | def import_obj(file_name, **kwargs):
""" Reads .obj files and generates faces.
Keyword Arguments:
* ``callback``: reference to the function that processes the faces for customized output
The structure of the callback function is shown below:
.. code-block:: python
def my_callback_fun... | [
"def",
"import_obj",
"(",
"file_name",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"default_callback",
"(",
"face_list",
")",
":",
"return",
"face_list",
"# Keyword arguments",
"callback_func",
"=",
"kwargs",
".",
"get",
"(",
"'callback'",
",",
"default_callback",... | Reads .obj files and generates faces.
Keyword Arguments:
* ``callback``: reference to the function that processes the faces for customized output
The structure of the callback function is shown below:
.. code-block:: python
def my_callback_function(face_list):
# "face_list" w... | [
"Reads",
".",
"obj",
"files",
"and",
"generates",
"faces",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange.py#L389-L460 |
230,325 | orbingol/NURBS-Python | geomdl/multi.py | select_color | def select_color(cpcolor, evalcolor, idx=0):
""" Selects item color for plotting.
:param cpcolor: color for control points grid item
:type cpcolor: str, list, tuple
:param evalcolor: color for evaluated points grid item
:type evalcolor: str, list, tuple
:param idx: index of the current geometry... | python | def select_color(cpcolor, evalcolor, idx=0):
""" Selects item color for plotting.
:param cpcolor: color for control points grid item
:type cpcolor: str, list, tuple
:param evalcolor: color for evaluated points grid item
:type evalcolor: str, list, tuple
:param idx: index of the current geometry... | [
"def",
"select_color",
"(",
"cpcolor",
",",
"evalcolor",
",",
"idx",
"=",
"0",
")",
":",
"# Random colors by default",
"color",
"=",
"utilities",
".",
"color_generator",
"(",
")",
"# Constant color for control points grid",
"if",
"isinstance",
"(",
"cpcolor",
",",
... | Selects item color for plotting.
:param cpcolor: color for control points grid item
:type cpcolor: str, list, tuple
:param evalcolor: color for evaluated points grid item
:type evalcolor: str, list, tuple
:param idx: index of the current geometry object
:type idx: int
:return: a list of col... | [
"Selects",
"item",
"color",
"for",
"plotting",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/multi.py#L1080-L1111 |
230,326 | orbingol/NURBS-Python | geomdl/multi.py | process_tessellate | def process_tessellate(elem, update_delta, delta, **kwargs):
""" Tessellates surfaces.
.. note:: Helper function required for ``multiprocessing``
:param elem: surface
:type elem: abstract.Surface
:param update_delta: flag to control evaluation delta updates
:type update_delta: bool
:param ... | python | def process_tessellate(elem, update_delta, delta, **kwargs):
""" Tessellates surfaces.
.. note:: Helper function required for ``multiprocessing``
:param elem: surface
:type elem: abstract.Surface
:param update_delta: flag to control evaluation delta updates
:type update_delta: bool
:param ... | [
"def",
"process_tessellate",
"(",
"elem",
",",
"update_delta",
",",
"delta",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"update_delta",
":",
"elem",
".",
"delta",
"=",
"delta",
"elem",
".",
"evaluate",
"(",
")",
"elem",
".",
"tessellate",
"(",
"*",
"*",
... | Tessellates surfaces.
.. note:: Helper function required for ``multiprocessing``
:param elem: surface
:type elem: abstract.Surface
:param update_delta: flag to control evaluation delta updates
:type update_delta: bool
:param delta: evaluation delta
:type delta: list, tuple
:return: upd... | [
"Tessellates",
"surfaces",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/multi.py#L1114-L1132 |
230,327 | orbingol/NURBS-Python | geomdl/multi.py | process_elements_surface | def process_elements_surface(elem, mconf, colorval, idx, force_tsl, update_delta, delta, reset_names):
""" Processes visualization elements for surfaces.
.. note:: Helper function required for ``multiprocessing``
:param elem: surface
:type elem: abstract.Surface
:param mconf: visualization module ... | python | def process_elements_surface(elem, mconf, colorval, idx, force_tsl, update_delta, delta, reset_names):
""" Processes visualization elements for surfaces.
.. note:: Helper function required for ``multiprocessing``
:param elem: surface
:type elem: abstract.Surface
:param mconf: visualization module ... | [
"def",
"process_elements_surface",
"(",
"elem",
",",
"mconf",
",",
"colorval",
",",
"idx",
",",
"force_tsl",
",",
"update_delta",
",",
"delta",
",",
"reset_names",
")",
":",
"if",
"idx",
"<",
"0",
":",
"lock",
".",
"acquire",
"(",
")",
"idx",
"=",
"cou... | Processes visualization elements for surfaces.
.. note:: Helper function required for ``multiprocessing``
:param elem: surface
:type elem: abstract.Surface
:param mconf: visualization module configuration
:type mconf: dict
:param colorval: color values
:type colorval: tuple
:param idx:... | [
"Processes",
"visualization",
"elements",
"for",
"surfaces",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/multi.py#L1135-L1224 |
230,328 | orbingol/NURBS-Python | geomdl/helpers.py | find_span_binsearch | def find_span_binsearch(degree, knot_vector, num_ctrlpts, knot, **kwargs):
""" Finds the span of the knot over the input knot vector using binary search.
Implementation of Algorithm A2.1 from The NURBS Book by Piegl & Tiller.
The NURBS Book states that the knot span index always starts from zero, i.e. for... | python | def find_span_binsearch(degree, knot_vector, num_ctrlpts, knot, **kwargs):
""" Finds the span of the knot over the input knot vector using binary search.
Implementation of Algorithm A2.1 from The NURBS Book by Piegl & Tiller.
The NURBS Book states that the knot span index always starts from zero, i.e. for... | [
"def",
"find_span_binsearch",
"(",
"degree",
",",
"knot_vector",
",",
"num_ctrlpts",
",",
"knot",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get tolerance value",
"tol",
"=",
"kwargs",
".",
"get",
"(",
"'tol'",
",",
"10e-6",
")",
"# In The NURBS Book; number of knots... | Finds the span of the knot over the input knot vector using binary search.
Implementation of Algorithm A2.1 from The NURBS Book by Piegl & Tiller.
The NURBS Book states that the knot span index always starts from zero, i.e. for a knot vector [0, 0, 1, 1];
if FindSpan returns 1, then the knot is between th... | [
"Finds",
"the",
"span",
"of",
"the",
"knot",
"over",
"the",
"input",
"knot",
"vector",
"using",
"binary",
"search",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L20-L68 |
230,329 | orbingol/NURBS-Python | geomdl/helpers.py | find_span_linear | def find_span_linear(degree, knot_vector, num_ctrlpts, knot, **kwargs):
""" Finds the span of a single knot over the knot vector using linear search.
Alternative implementation for the Algorithm A2.1 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param k... | python | def find_span_linear(degree, knot_vector, num_ctrlpts, knot, **kwargs):
""" Finds the span of a single knot over the knot vector using linear search.
Alternative implementation for the Algorithm A2.1 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param k... | [
"def",
"find_span_linear",
"(",
"degree",
",",
"knot_vector",
",",
"num_ctrlpts",
",",
"knot",
",",
"*",
"*",
"kwargs",
")",
":",
"span",
"=",
"0",
"# Knot span index starts from zero",
"while",
"span",
"<",
"num_ctrlpts",
"and",
"knot_vector",
"[",
"span",
"]... | Finds the span of a single knot over the knot vector using linear search.
Alternative implementation for the Algorithm A2.1 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param... | [
"Finds",
"the",
"span",
"of",
"a",
"single",
"knot",
"over",
"the",
"knot",
"vector",
"using",
"linear",
"search",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L71-L91 |
230,330 | orbingol/NURBS-Python | geomdl/helpers.py | find_spans | def find_spans(degree, knot_vector, num_ctrlpts, knots, func=find_span_linear):
""" Finds spans of a list of knots over the knot vector.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param num_ctrlpts: number of con... | python | def find_spans(degree, knot_vector, num_ctrlpts, knots, func=find_span_linear):
""" Finds spans of a list of knots over the knot vector.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param num_ctrlpts: number of con... | [
"def",
"find_spans",
"(",
"degree",
",",
"knot_vector",
",",
"num_ctrlpts",
",",
"knots",
",",
"func",
"=",
"find_span_linear",
")",
":",
"spans",
"=",
"[",
"]",
"for",
"knot",
"in",
"knots",
":",
"spans",
".",
"append",
"(",
"func",
"(",
"degree",
","... | Finds spans of a list of knots over the knot vector.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param num_ctrlpts: number of control points, :math:`n + 1`
:type num_ctrlpts: int
:param knots: list of knots or... | [
"Finds",
"spans",
"of",
"a",
"list",
"of",
"knots",
"over",
"the",
"knot",
"vector",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L94-L112 |
230,331 | orbingol/NURBS-Python | geomdl/helpers.py | find_multiplicity | def find_multiplicity(knot, knot_vector, **kwargs):
""" Finds knot multiplicity over the knot vector.
Keyword Arguments:
* ``tol``: tolerance (delta) value for equality checking
:param knot: knot or parameter, :math:`u`
:type knot: float
:param knot_vector: knot vector, :math:`U`
:type... | python | def find_multiplicity(knot, knot_vector, **kwargs):
""" Finds knot multiplicity over the knot vector.
Keyword Arguments:
* ``tol``: tolerance (delta) value for equality checking
:param knot: knot or parameter, :math:`u`
:type knot: float
:param knot_vector: knot vector, :math:`U`
:type... | [
"def",
"find_multiplicity",
"(",
"knot",
",",
"knot_vector",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get tolerance value",
"tol",
"=",
"kwargs",
".",
"get",
"(",
"'tol'",
",",
"10e-8",
")",
"mult",
"=",
"0",
"# initial multiplicity",
"for",
"kv",
"in",
"knot... | Finds knot multiplicity over the knot vector.
Keyword Arguments:
* ``tol``: tolerance (delta) value for equality checking
:param knot: knot or parameter, :math:`u`
:type knot: float
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:return: knot multiplicity, :m... | [
"Finds",
"knot",
"multiplicity",
"over",
"the",
"knot",
"vector",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L115-L137 |
230,332 | orbingol/NURBS-Python | geomdl/helpers.py | basis_function | def basis_function(degree, knot_vector, span, knot):
""" Computes the non-vanishing basis functions for a single parameter.
Implementation of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:typ... | python | def basis_function(degree, knot_vector, span, knot):
""" Computes the non-vanishing basis functions for a single parameter.
Implementation of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:typ... | [
"def",
"basis_function",
"(",
"degree",
",",
"knot_vector",
",",
"span",
",",
"knot",
")",
":",
"left",
"=",
"[",
"0.0",
"for",
"_",
"in",
"range",
"(",
"degree",
"+",
"1",
")",
"]",
"right",
"=",
"[",
"0.0",
"for",
"_",
"in",
"range",
"(",
"degr... | Computes the non-vanishing basis functions for a single parameter.
Implementation of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param span: knot span, :math:... | [
"Computes",
"the",
"non",
"-",
"vanishing",
"basis",
"functions",
"for",
"a",
"single",
"parameter",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L140-L170 |
230,333 | orbingol/NURBS-Python | geomdl/helpers.py | basis_functions | def basis_functions(degree, knot_vector, spans, knots):
""" Computes the non-vanishing basis functions for a list of parameters.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param spans: list of knot spans
:typ... | python | def basis_functions(degree, knot_vector, spans, knots):
""" Computes the non-vanishing basis functions for a list of parameters.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param spans: list of knot spans
:typ... | [
"def",
"basis_functions",
"(",
"degree",
",",
"knot_vector",
",",
"spans",
",",
"knots",
")",
":",
"basis",
"=",
"[",
"]",
"for",
"span",
",",
"knot",
"in",
"zip",
"(",
"spans",
",",
"knots",
")",
":",
"basis",
".",
"append",
"(",
"basis_function",
"... | Computes the non-vanishing basis functions for a list of parameters.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param spans: list of knot spans
:type spans: list, tuple
:param knots: list of knots or paramet... | [
"Computes",
"the",
"non",
"-",
"vanishing",
"basis",
"functions",
"for",
"a",
"list",
"of",
"parameters",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L173-L190 |
230,334 | orbingol/NURBS-Python | geomdl/helpers.py | basis_function_all | def basis_function_all(degree, knot_vector, span, knot):
""" Computes all non-zero basis functions of all degrees from 0 up to the input degree for a single parameter.
A slightly modified version of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: in... | python | def basis_function_all(degree, knot_vector, span, knot):
""" Computes all non-zero basis functions of all degrees from 0 up to the input degree for a single parameter.
A slightly modified version of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: in... | [
"def",
"basis_function_all",
"(",
"degree",
",",
"knot_vector",
",",
"span",
",",
"knot",
")",
":",
"N",
"=",
"[",
"[",
"None",
"for",
"_",
"in",
"range",
"(",
"degree",
"+",
"1",
")",
"]",
"for",
"_",
"in",
"range",
"(",
"degree",
"+",
"1",
")",... | Computes all non-zero basis functions of all degrees from 0 up to the input degree for a single parameter.
A slightly modified version of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_... | [
"Computes",
"all",
"non",
"-",
"zero",
"basis",
"functions",
"of",
"all",
"degrees",
"from",
"0",
"up",
"to",
"the",
"input",
"degree",
"for",
"a",
"single",
"parameter",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L193-L214 |
230,335 | orbingol/NURBS-Python | geomdl/helpers.py | basis_functions_ders | def basis_functions_ders(degree, knot_vector, spans, knots, order):
""" Computes derivatives of the basis functions for a list of parameters.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param spans: list of knot s... | python | def basis_functions_ders(degree, knot_vector, spans, knots, order):
""" Computes derivatives of the basis functions for a list of parameters.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param spans: list of knot s... | [
"def",
"basis_functions_ders",
"(",
"degree",
",",
"knot_vector",
",",
"spans",
",",
"knots",
",",
"order",
")",
":",
"basis_ders",
"=",
"[",
"]",
"for",
"span",
",",
"knot",
"in",
"zip",
"(",
"spans",
",",
"knots",
")",
":",
"basis_ders",
".",
"append... | Computes derivatives of the basis functions for a list of parameters.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param spans: list of knot spans
:type spans: list, tuple
:param knots: list of knots or parame... | [
"Computes",
"derivatives",
"of",
"the",
"basis",
"functions",
"for",
"a",
"list",
"of",
"parameters",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L307-L326 |
230,336 | orbingol/NURBS-Python | geomdl/helpers.py | basis_function_one | def basis_function_one(degree, knot_vector, span, knot):
""" Computes the value of a basis function for a single parameter.
Implementation of Algorithm 2.4 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector
:type knot_vecto... | python | def basis_function_one(degree, knot_vector, span, knot):
""" Computes the value of a basis function for a single parameter.
Implementation of Algorithm 2.4 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector
:type knot_vecto... | [
"def",
"basis_function_one",
"(",
"degree",
",",
"knot_vector",
",",
"span",
",",
"knot",
")",
":",
"# Special case at boundaries",
"if",
"(",
"span",
"==",
"0",
"and",
"knot",
"==",
"knot_vector",
"[",
"0",
"]",
")",
"or",
"(",
"span",
"==",
"len",
"(",... | Computes the value of a basis function for a single parameter.
Implementation of Algorithm 2.4 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector
:type knot_vector: list, tuple
:param span: knot span, :math:`i`
:type sp... | [
"Computes",
"the",
"value",
"of",
"a",
"basis",
"function",
"for",
"a",
"single",
"parameter",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/helpers.py#L329-L381 |
230,337 | orbingol/NURBS-Python | geomdl/visualization/VisMPL.py | VisConfig.set_axes_equal | def set_axes_equal(ax):
""" Sets equal aspect ratio across the three axes of a 3D plot.
Contributed by Xuefeng Zhao.
:param ax: a Matplotlib axis, e.g., as output from plt.gca().
"""
bounds = [ax.get_xlim3d(), ax.get_ylim3d(), ax.get_zlim3d()]
ranges = [abs(bound[1] - b... | python | def set_axes_equal(ax):
""" Sets equal aspect ratio across the three axes of a 3D plot.
Contributed by Xuefeng Zhao.
:param ax: a Matplotlib axis, e.g., as output from plt.gca().
"""
bounds = [ax.get_xlim3d(), ax.get_ylim3d(), ax.get_zlim3d()]
ranges = [abs(bound[1] - b... | [
"def",
"set_axes_equal",
"(",
"ax",
")",
":",
"bounds",
"=",
"[",
"ax",
".",
"get_xlim3d",
"(",
")",
",",
"ax",
".",
"get_ylim3d",
"(",
")",
",",
"ax",
".",
"get_zlim3d",
"(",
")",
"]",
"ranges",
"=",
"[",
"abs",
"(",
"bound",
"[",
"1",
"]",
"-... | Sets equal aspect ratio across the three axes of a 3D plot.
Contributed by Xuefeng Zhao.
:param ax: a Matplotlib axis, e.g., as output from plt.gca(). | [
"Sets",
"equal",
"aspect",
"ratio",
"across",
"the",
"three",
"axes",
"of",
"a",
"3D",
"plot",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/VisMPL.py#L88-L103 |
230,338 | orbingol/NURBS-Python | geomdl/visualization/VisMPL.py | VisSurface.animate | def animate(self, **kwargs):
""" Animates the surface.
This function only animates the triangulated surface. There will be no other elements, such as control points
grid or bounding box.
Keyword arguments:
* ``colormap``: applies colormap to the surface
Colormaps a... | python | def animate(self, **kwargs):
""" Animates the surface.
This function only animates the triangulated surface. There will be no other elements, such as control points
grid or bounding box.
Keyword arguments:
* ``colormap``: applies colormap to the surface
Colormaps a... | [
"def",
"animate",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Calling parent render function",
"super",
"(",
"VisSurface",
",",
"self",
")",
".",
"render",
"(",
"*",
"*",
"kwargs",
")",
"# Colormaps",
"surf_cmaps",
"=",
"kwargs",
".",
"get",
"(",
... | Animates the surface.
This function only animates the triangulated surface. There will be no other elements, such as control points
grid or bounding box.
Keyword arguments:
* ``colormap``: applies colormap to the surface
Colormaps are a visualization feature of Matplotlib.... | [
"Animates",
"the",
"surface",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/VisMPL.py#L298-L402 |
230,339 | orbingol/NURBS-Python | geomdl/_operations.py | tangent_curve_single_list | def tangent_curve_single_list(obj, param_list, normalize):
""" Evaluates the curve tangent vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned v... | python | def tangent_curve_single_list(obj, param_list, normalize):
""" Evaluates the curve tangent vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned v... | [
"def",
"tangent_curve_single_list",
"(",
"obj",
",",
"param_list",
",",
"normalize",
")",
":",
"ret_vector",
"=",
"[",
"]",
"for",
"param",
"in",
"param_list",
":",
"temp",
"=",
"tangent_curve_single",
"(",
"obj",
",",
"param",
",",
"normalize",
")",
"ret_ve... | Evaluates the curve tangent vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vector is converted to a unit vector
:type normalize: bool
:... | [
"Evaluates",
"the",
"curve",
"tangent",
"vectors",
"at",
"the",
"given",
"list",
"of",
"parameter",
"values",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L41-L57 |
230,340 | orbingol/NURBS-Python | geomdl/_operations.py | normal_curve_single | def normal_curve_single(obj, u, normalize):
""" Evaluates the curve normal vector at the input parameter, u.
Curve normal is calculated from the 2nd derivative of the curve at the input parameter, u.
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
... | python | def normal_curve_single(obj, u, normalize):
""" Evaluates the curve normal vector at the input parameter, u.
Curve normal is calculated from the 2nd derivative of the curve at the input parameter, u.
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
... | [
"def",
"normal_curve_single",
"(",
"obj",
",",
"u",
",",
"normalize",
")",
":",
"# 2nd derivative of the curve gives the normal",
"ders",
"=",
"obj",
".",
"derivatives",
"(",
"u",
",",
"2",
")",
"point",
"=",
"ders",
"[",
"0",
"]",
"vector",
"=",
"linalg",
... | Evaluates the curve normal vector at the input parameter, u.
Curve normal is calculated from the 2nd derivative of the curve at the input parameter, u.
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
:param obj: input curve
:type obj: abstract... | [
"Evaluates",
"the",
"curve",
"normal",
"vector",
"at",
"the",
"input",
"parameter",
"u",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L60-L81 |
230,341 | orbingol/NURBS-Python | geomdl/_operations.py | normal_curve_single_list | def normal_curve_single_list(obj, param_list, normalize):
""" Evaluates the curve normal vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vec... | python | def normal_curve_single_list(obj, param_list, normalize):
""" Evaluates the curve normal vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vec... | [
"def",
"normal_curve_single_list",
"(",
"obj",
",",
"param_list",
",",
"normalize",
")",
":",
"ret_vector",
"=",
"[",
"]",
"for",
"param",
"in",
"param_list",
":",
"temp",
"=",
"normal_curve_single",
"(",
"obj",
",",
"param",
",",
"normalize",
")",
"ret_vect... | Evaluates the curve normal vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vector is converted to a unit vector
:type normalize: bool
:r... | [
"Evaluates",
"the",
"curve",
"normal",
"vectors",
"at",
"the",
"given",
"list",
"of",
"parameter",
"values",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L84-L100 |
230,342 | orbingol/NURBS-Python | geomdl/_operations.py | binormal_curve_single | def binormal_curve_single(obj, u, normalize):
""" Evaluates the curve binormal vector at the given u parameter.
Curve binormal is the cross product of the normal and the tangent vectors.
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
:param o... | python | def binormal_curve_single(obj, u, normalize):
""" Evaluates the curve binormal vector at the given u parameter.
Curve binormal is the cross product of the normal and the tangent vectors.
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
:param o... | [
"def",
"binormal_curve_single",
"(",
"obj",
",",
"u",
",",
"normalize",
")",
":",
"# Cross product of tangent and normal vectors gives binormal vector",
"tan_vector",
"=",
"tangent_curve_single",
"(",
"obj",
",",
"u",
",",
"normalize",
")",
"norm_vector",
"=",
"normal_c... | Evaluates the curve binormal vector at the given u parameter.
Curve binormal is the cross product of the normal and the tangent vectors.
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
:param obj: input curve
:type obj: abstract.Curve
:par... | [
"Evaluates",
"the",
"curve",
"binormal",
"vector",
"at",
"the",
"given",
"u",
"parameter",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L103-L126 |
230,343 | orbingol/NURBS-Python | geomdl/_operations.py | binormal_curve_single_list | def binormal_curve_single_list(obj, param_list, normalize):
""" Evaluates the curve binormal vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned... | python | def binormal_curve_single_list(obj, param_list, normalize):
""" Evaluates the curve binormal vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned... | [
"def",
"binormal_curve_single_list",
"(",
"obj",
",",
"param_list",
",",
"normalize",
")",
":",
"ret_vector",
"=",
"[",
"]",
"for",
"param",
"in",
"param_list",
":",
"temp",
"=",
"binormal_curve_single",
"(",
"obj",
",",
"param",
",",
"normalize",
")",
"ret_... | Evaluates the curve binormal vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vector is converted to a unit vector
:type normalize: bool
... | [
"Evaluates",
"the",
"curve",
"binormal",
"vectors",
"at",
"the",
"given",
"list",
"of",
"parameter",
"values",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L129-L145 |
230,344 | orbingol/NURBS-Python | geomdl/_operations.py | tangent_surface_single_list | def tangent_surface_single_list(obj, param_list, normalize):
""" Evaluates the surface tangent vectors at the given list of parameter values.
:param obj: input surface
:type obj: abstract.Surface
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the re... | python | def tangent_surface_single_list(obj, param_list, normalize):
""" Evaluates the surface tangent vectors at the given list of parameter values.
:param obj: input surface
:type obj: abstract.Surface
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the re... | [
"def",
"tangent_surface_single_list",
"(",
"obj",
",",
"param_list",
",",
"normalize",
")",
":",
"ret_vector",
"=",
"[",
"]",
"for",
"param",
"in",
"param_list",
":",
"temp",
"=",
"tangent_surface_single",
"(",
"obj",
",",
"param",
",",
"normalize",
")",
"re... | Evaluates the surface tangent vectors at the given list of parameter values.
:param obj: input surface
:type obj: abstract.Surface
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vector is converted to a unit vector
:type normalize: bool... | [
"Evaluates",
"the",
"surface",
"tangent",
"vectors",
"at",
"the",
"given",
"list",
"of",
"parameter",
"values",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L172-L188 |
230,345 | orbingol/NURBS-Python | geomdl/_operations.py | normal_surface_single_list | def normal_surface_single_list(obj, param_list, normalize):
""" Evaluates the surface normal vectors at the given list of parameter values.
:param obj: input surface
:type obj: abstract.Surface
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the retu... | python | def normal_surface_single_list(obj, param_list, normalize):
""" Evaluates the surface normal vectors at the given list of parameter values.
:param obj: input surface
:type obj: abstract.Surface
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the retu... | [
"def",
"normal_surface_single_list",
"(",
"obj",
",",
"param_list",
",",
"normalize",
")",
":",
"ret_vector",
"=",
"[",
"]",
"for",
"param",
"in",
"param_list",
":",
"temp",
"=",
"normal_surface_single",
"(",
"obj",
",",
"param",
",",
"normalize",
")",
"ret_... | Evaluates the surface normal vectors at the given list of parameter values.
:param obj: input surface
:type obj: abstract.Surface
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vector is converted to a unit vector
:type normalize: bool
... | [
"Evaluates",
"the",
"surface",
"normal",
"vectors",
"at",
"the",
"given",
"list",
"of",
"parameter",
"values",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L215-L231 |
230,346 | orbingol/NURBS-Python | geomdl/_operations.py | find_ctrlpts_curve | def find_ctrlpts_curve(t, curve, **kwargs):
""" Finds the control points involved in the evaluation of the curve point defined by the input parameter.
This function uses a modified version of the algorithm *A3.1 CurvePoint* from The NURBS Book by Piegl & Tiller.
:param t: parameter
:type t: float
... | python | def find_ctrlpts_curve(t, curve, **kwargs):
""" Finds the control points involved in the evaluation of the curve point defined by the input parameter.
This function uses a modified version of the algorithm *A3.1 CurvePoint* from The NURBS Book by Piegl & Tiller.
:param t: parameter
:type t: float
... | [
"def",
"find_ctrlpts_curve",
"(",
"t",
",",
"curve",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get keyword arguments",
"span_func",
"=",
"kwargs",
".",
"get",
"(",
"'find_span_func'",
",",
"helpers",
".",
"find_span_linear",
")",
"# Find spans and the constant index",
... | Finds the control points involved in the evaluation of the curve point defined by the input parameter.
This function uses a modified version of the algorithm *A3.1 CurvePoint* from The NURBS Book by Piegl & Tiller.
:param t: parameter
:type t: float
:param curve: input curve object
:type curve: ab... | [
"Finds",
"the",
"control",
"points",
"involved",
"in",
"the",
"evaluation",
"of",
"the",
"curve",
"point",
"defined",
"by",
"the",
"input",
"parameter",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L234-L259 |
230,347 | orbingol/NURBS-Python | geomdl/_operations.py | find_ctrlpts_surface | def find_ctrlpts_surface(t_u, t_v, surf, **kwargs):
""" Finds the control points involved in the evaluation of the surface point defined by the input parameter pair.
This function uses a modified version of the algorithm *A3.5 SurfacePoint* from The NURBS Book by Piegl & Tiller.
:param t_u: parameter on t... | python | def find_ctrlpts_surface(t_u, t_v, surf, **kwargs):
""" Finds the control points involved in the evaluation of the surface point defined by the input parameter pair.
This function uses a modified version of the algorithm *A3.5 SurfacePoint* from The NURBS Book by Piegl & Tiller.
:param t_u: parameter on t... | [
"def",
"find_ctrlpts_surface",
"(",
"t_u",
",",
"t_v",
",",
"surf",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get keyword arguments",
"span_func",
"=",
"kwargs",
".",
"get",
"(",
"'find_span_func'",
",",
"helpers",
".",
"find_span_linear",
")",
"# Find spans",
"sp... | Finds the control points involved in the evaluation of the surface point defined by the input parameter pair.
This function uses a modified version of the algorithm *A3.5 SurfacePoint* from The NURBS Book by Piegl & Tiller.
:param t_u: parameter on the u-direction
:type t_u: float
:param t_v: paramete... | [
"Finds",
"the",
"control",
"points",
"involved",
"in",
"the",
"evaluation",
"of",
"the",
"surface",
"point",
"defined",
"by",
"the",
"input",
"parameter",
"pair",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L262-L296 |
230,348 | orbingol/NURBS-Python | geomdl/_operations.py | link_curves | def link_curves(*args, **kwargs):
""" Links the input curves together.
The end control point of the curve k has to be the same with the start control point of the curve k + 1.
Keyword Arguments:
* ``tol``: tolerance value for checking equality. *Default: 10e-8*
* ``validate``: flag to enab... | python | def link_curves(*args, **kwargs):
""" Links the input curves together.
The end control point of the curve k has to be the same with the start control point of the curve k + 1.
Keyword Arguments:
* ``tol``: tolerance value for checking equality. *Default: 10e-8*
* ``validate``: flag to enab... | [
"def",
"link_curves",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get keyword arguments",
"tol",
"=",
"kwargs",
".",
"get",
"(",
"'tol'",
",",
"10e-8",
")",
"validate",
"=",
"kwargs",
".",
"get",
"(",
"'validate'",
",",
"False",
")",
"# Val... | Links the input curves together.
The end control point of the curve k has to be the same with the start control point of the curve k + 1.
Keyword Arguments:
* ``tol``: tolerance value for checking equality. *Default: 10e-8*
* ``validate``: flag to enable input validation. *Default: False*
... | [
"Links",
"the",
"input",
"curves",
"together",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L299-L357 |
230,349 | orbingol/NURBS-Python | geomdl/operations.py | add_dimension | def add_dimension(obj, **kwargs):
""" Elevates the spatial dimension of the spline geometry.
If you pass ``inplace=True`` keyword argument, the input will be updated. Otherwise, this function does not
change the input but returns a new instance with the updated data.
:param obj: spline geometry
:t... | python | def add_dimension(obj, **kwargs):
""" Elevates the spatial dimension of the spline geometry.
If you pass ``inplace=True`` keyword argument, the input will be updated. Otherwise, this function does not
change the input but returns a new instance with the updated data.
:param obj: spline geometry
:t... | [
"def",
"add_dimension",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"obj",
",",
"abstract",
".",
"SplineGeometry",
")",
":",
"raise",
"GeomdlException",
"(",
"\"Can only operate on spline geometry objects\"",
")",
"# Keyword argu... | Elevates the spatial dimension of the spline geometry.
If you pass ``inplace=True`` keyword argument, the input will be updated. Otherwise, this function does not
change the input but returns a new instance with the updated data.
:param obj: spline geometry
:type obj: abstract.SplineGeometry
:retu... | [
"Elevates",
"the",
"spatial",
"dimension",
"of",
"the",
"spline",
"geometry",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/operations.py#L877-L909 |
230,350 | orbingol/NURBS-Python | geomdl/operations.py | split_curve | def split_curve(obj, param, **kwargs):
""" Splits the curve at the input parametric coordinate.
This method splits the curve into two pieces at the given parametric coordinate, generates two different
curve objects and returns them. It does not modify the input curve.
Keyword Arguments:
* ``fi... | python | def split_curve(obj, param, **kwargs):
""" Splits the curve at the input parametric coordinate.
This method splits the curve into two pieces at the given parametric coordinate, generates two different
curve objects and returns them. It does not modify the input curve.
Keyword Arguments:
* ``fi... | [
"def",
"split_curve",
"(",
"obj",
",",
"param",
",",
"*",
"*",
"kwargs",
")",
":",
"# Validate input",
"if",
"not",
"isinstance",
"(",
"obj",
",",
"abstract",
".",
"Curve",
")",
":",
"raise",
"GeomdlException",
"(",
"\"Input shape must be an instance of abstract... | Splits the curve at the input parametric coordinate.
This method splits the curve into two pieces at the given parametric coordinate, generates two different
curve objects and returns them. It does not modify the input curve.
Keyword Arguments:
* ``find_span_func``: FindSpan implementation. *Defau... | [
"Splits",
"the",
"curve",
"at",
"the",
"input",
"parametric",
"coordinate",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/operations.py#L913-L979 |
230,351 | orbingol/NURBS-Python | geomdl/operations.py | decompose_curve | def decompose_curve(obj, **kwargs):
""" Decomposes the curve into Bezier curve segments of the same degree.
This operation does not modify the input curve, instead it returns the split curve segments.
Keyword Arguments:
* ``find_span_func``: FindSpan implementation. *Default:* :func:`.helpers.find... | python | def decompose_curve(obj, **kwargs):
""" Decomposes the curve into Bezier curve segments of the same degree.
This operation does not modify the input curve, instead it returns the split curve segments.
Keyword Arguments:
* ``find_span_func``: FindSpan implementation. *Default:* :func:`.helpers.find... | [
"def",
"decompose_curve",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"obj",
",",
"abstract",
".",
"Curve",
")",
":",
"raise",
"GeomdlException",
"(",
"\"Input shape must be an instance of abstract.Curve class\"",
")",
"multi_cur... | Decomposes the curve into Bezier curve segments of the same degree.
This operation does not modify the input curve, instead it returns the split curve segments.
Keyword Arguments:
* ``find_span_func``: FindSpan implementation. *Default:* :func:`.helpers.find_span_linear`
* ``insert_knot_func``... | [
"Decomposes",
"the",
"curve",
"into",
"Bezier",
"curve",
"segments",
"of",
"the",
"same",
"degree",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/operations.py#L983-L1011 |
230,352 | orbingol/NURBS-Python | geomdl/operations.py | length_curve | def length_curve(obj):
""" Computes the approximate length of the parametric curve.
Uses the following equation to compute the approximate length:
.. math::
\\sum_{i=0}^{n-1} \\sqrt{P_{i + 1}^2-P_{i}^2}
where :math:`n` is number of evaluated curve points and :math:`P` is the n-dimensional po... | python | def length_curve(obj):
""" Computes the approximate length of the parametric curve.
Uses the following equation to compute the approximate length:
.. math::
\\sum_{i=0}^{n-1} \\sqrt{P_{i + 1}^2-P_{i}^2}
where :math:`n` is number of evaluated curve points and :math:`P` is the n-dimensional po... | [
"def",
"length_curve",
"(",
"obj",
")",
":",
"if",
"not",
"isinstance",
"(",
"obj",
",",
"abstract",
".",
"Curve",
")",
":",
"raise",
"GeomdlException",
"(",
"\"Input shape must be an instance of abstract.Curve class\"",
")",
"length",
"=",
"0.0",
"evalpts",
"=",
... | Computes the approximate length of the parametric curve.
Uses the following equation to compute the approximate length:
.. math::
\\sum_{i=0}^{n-1} \\sqrt{P_{i + 1}^2-P_{i}^2}
where :math:`n` is number of evaluated curve points and :math:`P` is the n-dimensional point.
:param obj: input cur... | [
"Computes",
"the",
"approximate",
"length",
"of",
"the",
"parametric",
"curve",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/operations.py#L1054-L1078 |
230,353 | orbingol/NURBS-Python | geomdl/operations.py | split_surface_u | def split_surface_u(obj, param, **kwargs):
""" Splits the surface at the input parametric coordinate on the u-direction.
This method splits the surface into two pieces at the given parametric coordinate on the u-direction,
generates two different surface objects and returns them. It does not modify the inp... | python | def split_surface_u(obj, param, **kwargs):
""" Splits the surface at the input parametric coordinate on the u-direction.
This method splits the surface into two pieces at the given parametric coordinate on the u-direction,
generates two different surface objects and returns them. It does not modify the inp... | [
"def",
"split_surface_u",
"(",
"obj",
",",
"param",
",",
"*",
"*",
"kwargs",
")",
":",
"# Validate input",
"if",
"not",
"isinstance",
"(",
"obj",
",",
"abstract",
".",
"Surface",
")",
":",
"raise",
"GeomdlException",
"(",
"\"Input shape must be an instance of ab... | Splits the surface at the input parametric coordinate on the u-direction.
This method splits the surface into two pieces at the given parametric coordinate on the u-direction,
generates two different surface objects and returns them. It does not modify the input surface.
Keyword Arguments:
* ``fin... | [
"Splits",
"the",
"surface",
"at",
"the",
"input",
"parametric",
"coordinate",
"on",
"the",
"u",
"-",
"direction",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/operations.py#L1082-L1151 |
230,354 | orbingol/NURBS-Python | geomdl/operations.py | decompose_surface | def decompose_surface(obj, **kwargs):
""" Decomposes the surface into Bezier surface patches of the same degree.
This operation does not modify the input surface, instead it returns the surface patches.
Keyword Arguments:
* ``find_span_func``: FindSpan implementation. *Default:* :func:`.helpers.fi... | python | def decompose_surface(obj, **kwargs):
""" Decomposes the surface into Bezier surface patches of the same degree.
This operation does not modify the input surface, instead it returns the surface patches.
Keyword Arguments:
* ``find_span_func``: FindSpan implementation. *Default:* :func:`.helpers.fi... | [
"def",
"decompose_surface",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"decompose",
"(",
"srf",
",",
"idx",
",",
"split_func_list",
",",
"*",
"*",
"kws",
")",
":",
"srf_list",
"=",
"[",
"]",
"knots",
"=",
"srf",
".",
"knotvector",
"[",
"... | Decomposes the surface into Bezier surface patches of the same degree.
This operation does not modify the input surface, instead it returns the surface patches.
Keyword Arguments:
* ``find_span_func``: FindSpan implementation. *Default:* :func:`.helpers.find_span_linear`
* ``insert_knot_func``... | [
"Decomposes",
"the",
"surface",
"into",
"Bezier",
"surface",
"patches",
"of",
"the",
"same",
"degree",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/operations.py#L1234-L1293 |
230,355 | orbingol/NURBS-Python | geomdl/operations.py | tangent | def tangent(obj, params, **kwargs):
""" Evaluates the tangent vector of the curves or surfaces at the input parameter values.
This function is designed to evaluate tangent vectors of the B-Spline and NURBS shapes at single or
multiple parameter positions.
:param obj: input shape
:type obj: abstrac... | python | def tangent(obj, params, **kwargs):
""" Evaluates the tangent vector of the curves or surfaces at the input parameter values.
This function is designed to evaluate tangent vectors of the B-Spline and NURBS shapes at single or
multiple parameter positions.
:param obj: input shape
:type obj: abstrac... | [
"def",
"tangent",
"(",
"obj",
",",
"params",
",",
"*",
"*",
"kwargs",
")",
":",
"normalize",
"=",
"kwargs",
".",
"get",
"(",
"'normalize'",
",",
"True",
")",
"if",
"isinstance",
"(",
"obj",
",",
"abstract",
".",
"Curve",
")",
":",
"if",
"isinstance",... | Evaluates the tangent vector of the curves or surfaces at the input parameter values.
This function is designed to evaluate tangent vectors of the B-Spline and NURBS shapes at single or
multiple parameter positions.
:param obj: input shape
:type obj: abstract.Curve or abstract.Surface
:param param... | [
"Evaluates",
"the",
"tangent",
"vector",
"of",
"the",
"curves",
"or",
"surfaces",
"at",
"the",
"input",
"parameter",
"values",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/operations.py#L1392-L1415 |
230,356 | orbingol/NURBS-Python | geomdl/operations.py | normal | def normal(obj, params, **kwargs):
""" Evaluates the normal vector of the curves or surfaces at the input parameter values.
This function is designed to evaluate normal vectors of the B-Spline and NURBS shapes at single or
multiple parameter positions.
:param obj: input geometry
:type obj: abstrac... | python | def normal(obj, params, **kwargs):
""" Evaluates the normal vector of the curves or surfaces at the input parameter values.
This function is designed to evaluate normal vectors of the B-Spline and NURBS shapes at single or
multiple parameter positions.
:param obj: input geometry
:type obj: abstrac... | [
"def",
"normal",
"(",
"obj",
",",
"params",
",",
"*",
"*",
"kwargs",
")",
":",
"normalize",
"=",
"kwargs",
".",
"get",
"(",
"'normalize'",
",",
"True",
")",
"if",
"isinstance",
"(",
"obj",
",",
"abstract",
".",
"Curve",
")",
":",
"if",
"isinstance",
... | Evaluates the normal vector of the curves or surfaces at the input parameter values.
This function is designed to evaluate normal vectors of the B-Spline and NURBS shapes at single or
multiple parameter positions.
:param obj: input geometry
:type obj: abstract.Curve or abstract.Surface
:param para... | [
"Evaluates",
"the",
"normal",
"vector",
"of",
"the",
"curves",
"or",
"surfaces",
"at",
"the",
"input",
"parameter",
"values",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/operations.py#L1419-L1442 |
230,357 | orbingol/NURBS-Python | geomdl/operations.py | binormal | def binormal(obj, params, **kwargs):
""" Evaluates the binormal vector of the curves or surfaces at the input parameter values.
This function is designed to evaluate binormal vectors of the B-Spline and NURBS shapes at single or
multiple parameter positions.
:param obj: input shape
:type obj: abst... | python | def binormal(obj, params, **kwargs):
""" Evaluates the binormal vector of the curves or surfaces at the input parameter values.
This function is designed to evaluate binormal vectors of the B-Spline and NURBS shapes at single or
multiple parameter positions.
:param obj: input shape
:type obj: abst... | [
"def",
"binormal",
"(",
"obj",
",",
"params",
",",
"*",
"*",
"kwargs",
")",
":",
"normalize",
"=",
"kwargs",
".",
"get",
"(",
"'normalize'",
",",
"True",
")",
"if",
"isinstance",
"(",
"obj",
",",
"abstract",
".",
"Curve",
")",
":",
"if",
"isinstance"... | Evaluates the binormal vector of the curves or surfaces at the input parameter values.
This function is designed to evaluate binormal vectors of the B-Spline and NURBS shapes at single or
multiple parameter positions.
:param obj: input shape
:type obj: abstract.Curve or abstract.Surface
:param par... | [
"Evaluates",
"the",
"binormal",
"vector",
"of",
"the",
"curves",
"or",
"surfaces",
"at",
"the",
"input",
"parameter",
"values",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/operations.py#L1446-L1466 |
230,358 | orbingol/NURBS-Python | geomdl/operations.py | translate | def translate(obj, vec, **kwargs):
""" Translates curves, surface or volumes by the input vector.
Keyword Arguments:
* ``inplace``: if False, operation applied to a copy of the object. *Default: False*
:param obj: input geometry
:type obj: abstract.SplineGeometry or multi.AbstractContainer
... | python | def translate(obj, vec, **kwargs):
""" Translates curves, surface or volumes by the input vector.
Keyword Arguments:
* ``inplace``: if False, operation applied to a copy of the object. *Default: False*
:param obj: input geometry
:type obj: abstract.SplineGeometry or multi.AbstractContainer
... | [
"def",
"translate",
"(",
"obj",
",",
"vec",
",",
"*",
"*",
"kwargs",
")",
":",
"# Input validity checks",
"if",
"not",
"vec",
"or",
"not",
"isinstance",
"(",
"vec",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"raise",
"GeomdlException",
"(",
"\"The ... | Translates curves, surface or volumes by the input vector.
Keyword Arguments:
* ``inplace``: if False, operation applied to a copy of the object. *Default: False*
:param obj: input geometry
:type obj: abstract.SplineGeometry or multi.AbstractContainer
:param vec: translation vector
:type v... | [
"Translates",
"curves",
"surface",
"or",
"volumes",
"by",
"the",
"input",
"vector",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/operations.py#L1470-L1506 |
230,359 | orbingol/NURBS-Python | geomdl/operations.py | scale | def scale(obj, multiplier, **kwargs):
""" Scales curves, surfaces or volumes by the input multiplier.
Keyword Arguments:
* ``inplace``: if False, operation applied to a copy of the object. *Default: False*
:param obj: input geometry
:type obj: abstract.SplineGeometry, multi.AbstractGeometry
... | python | def scale(obj, multiplier, **kwargs):
""" Scales curves, surfaces or volumes by the input multiplier.
Keyword Arguments:
* ``inplace``: if False, operation applied to a copy of the object. *Default: False*
:param obj: input geometry
:type obj: abstract.SplineGeometry, multi.AbstractGeometry
... | [
"def",
"scale",
"(",
"obj",
",",
"multiplier",
",",
"*",
"*",
"kwargs",
")",
":",
"# Input validity checks",
"if",
"not",
"isinstance",
"(",
"multiplier",
",",
"(",
"int",
",",
"float",
")",
")",
":",
"raise",
"GeomdlException",
"(",
"\"The multiplier must b... | Scales curves, surfaces or volumes by the input multiplier.
Keyword Arguments:
* ``inplace``: if False, operation applied to a copy of the object. *Default: False*
:param obj: input geometry
:type obj: abstract.SplineGeometry, multi.AbstractGeometry
:param multiplier: scaling multiplier
:t... | [
"Scales",
"curves",
"surfaces",
"or",
"volumes",
"by",
"the",
"input",
"multiplier",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/operations.py#L1607-L1638 |
230,360 | orbingol/NURBS-Python | geomdl/voxelize.py | voxelize | def voxelize(obj, **kwargs):
""" Generates binary voxel representation of the surfaces and volumes.
Keyword Arguments:
* ``grid_size``: size of the voxel grid. *Default: (8, 8, 8)*
* ``padding``: voxel padding for in-outs finding. *Default: 10e-8*
* ``use_cubes``: use cube voxels instea... | python | def voxelize(obj, **kwargs):
""" Generates binary voxel representation of the surfaces and volumes.
Keyword Arguments:
* ``grid_size``: size of the voxel grid. *Default: (8, 8, 8)*
* ``padding``: voxel padding for in-outs finding. *Default: 10e-8*
* ``use_cubes``: use cube voxels instea... | [
"def",
"voxelize",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get keyword arguments",
"grid_size",
"=",
"kwargs",
".",
"pop",
"(",
"'grid_size'",
",",
"(",
"8",
",",
"8",
",",
"8",
")",
")",
"use_cubes",
"=",
"kwargs",
".",
"pop",
"(",
"'use_c... | Generates binary voxel representation of the surfaces and volumes.
Keyword Arguments:
* ``grid_size``: size of the voxel grid. *Default: (8, 8, 8)*
* ``padding``: voxel padding for in-outs finding. *Default: 10e-8*
* ``use_cubes``: use cube voxels instead of cuboid ones. *Default: False*
... | [
"Generates",
"binary",
"voxel",
"representation",
"of",
"the",
"surfaces",
"and",
"volumes",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/voxelize.py#L16-L56 |
230,361 | orbingol/NURBS-Python | geomdl/voxelize.py | convert_bb_to_faces | def convert_bb_to_faces(voxel_grid):
""" Converts a voxel grid defined by min and max coordinates to a voxel grid defined by faces.
:param voxel_grid: voxel grid defined by the bounding box of all voxels
:return: voxel grid with face data
"""
new_vg = []
for v in voxel_grid:
# Vertices
... | python | def convert_bb_to_faces(voxel_grid):
""" Converts a voxel grid defined by min and max coordinates to a voxel grid defined by faces.
:param voxel_grid: voxel grid defined by the bounding box of all voxels
:return: voxel grid with face data
"""
new_vg = []
for v in voxel_grid:
# Vertices
... | [
"def",
"convert_bb_to_faces",
"(",
"voxel_grid",
")",
":",
"new_vg",
"=",
"[",
"]",
"for",
"v",
"in",
"voxel_grid",
":",
"# Vertices",
"p1",
"=",
"v",
"[",
"0",
"]",
"p2",
"=",
"[",
"v",
"[",
"1",
"]",
"[",
"0",
"]",
",",
"v",
"[",
"0",
"]",
... | Converts a voxel grid defined by min and max coordinates to a voxel grid defined by faces.
:param voxel_grid: voxel grid defined by the bounding box of all voxels
:return: voxel grid with face data | [
"Converts",
"a",
"voxel",
"grid",
"defined",
"by",
"min",
"and",
"max",
"coordinates",
"to",
"a",
"voxel",
"grid",
"defined",
"by",
"faces",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/voxelize.py#L59-L85 |
230,362 | orbingol/NURBS-Python | geomdl/voxelize.py | save_voxel_grid | def save_voxel_grid(voxel_grid, file_name):
""" Saves binary voxel grid as a binary file.
The binary file is structured in little-endian unsigned int format.
:param voxel_grid: binary voxel grid
:type voxel_grid: list, tuple
:param file_name: file name to save
:type file_name: str
"""
... | python | def save_voxel_grid(voxel_grid, file_name):
""" Saves binary voxel grid as a binary file.
The binary file is structured in little-endian unsigned int format.
:param voxel_grid: binary voxel grid
:type voxel_grid: list, tuple
:param file_name: file name to save
:type file_name: str
"""
... | [
"def",
"save_voxel_grid",
"(",
"voxel_grid",
",",
"file_name",
")",
":",
"try",
":",
"with",
"open",
"(",
"file_name",
",",
"'wb'",
")",
"as",
"fp",
":",
"for",
"voxel",
"in",
"voxel_grid",
":",
"fp",
".",
"write",
"(",
"struct",
".",
"pack",
"(",
"\... | Saves binary voxel grid as a binary file.
The binary file is structured in little-endian unsigned int format.
:param voxel_grid: binary voxel grid
:type voxel_grid: list, tuple
:param file_name: file name to save
:type file_name: str | [
"Saves",
"binary",
"voxel",
"grid",
"as",
"a",
"binary",
"file",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/voxelize.py#L89-L107 |
230,363 | orbingol/NURBS-Python | geomdl/linalg.py | vector_cross | def vector_cross(vector1, vector2):
""" Computes the cross-product of the input vectors.
:param vector1: input vector 1
:type vector1: list, tuple
:param vector2: input vector 2
:type vector2: list, tuple
:return: result of the cross product
:rtype: tuple
"""
try:
if vector1... | python | def vector_cross(vector1, vector2):
""" Computes the cross-product of the input vectors.
:param vector1: input vector 1
:type vector1: list, tuple
:param vector2: input vector 2
:type vector2: list, tuple
:return: result of the cross product
:rtype: tuple
"""
try:
if vector1... | [
"def",
"vector_cross",
"(",
"vector1",
",",
"vector2",
")",
":",
"try",
":",
"if",
"vector1",
"is",
"None",
"or",
"len",
"(",
"vector1",
")",
"==",
"0",
"or",
"vector2",
"is",
"None",
"or",
"len",
"(",
"vector2",
")",
"==",
"0",
":",
"raise",
"Valu... | Computes the cross-product of the input vectors.
:param vector1: input vector 1
:type vector1: list, tuple
:param vector2: input vector 2
:type vector2: list, tuple
:return: result of the cross product
:rtype: tuple | [
"Computes",
"the",
"cross",
"-",
"product",
"of",
"the",
"input",
"vectors",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L20-L59 |
230,364 | orbingol/NURBS-Python | geomdl/linalg.py | vector_dot | def vector_dot(vector1, vector2):
""" Computes the dot-product of the input vectors.
:param vector1: input vector 1
:type vector1: list, tuple
:param vector2: input vector 2
:type vector2: list, tuple
:return: result of the dot product
:rtype: float
"""
try:
if vector1 is No... | python | def vector_dot(vector1, vector2):
""" Computes the dot-product of the input vectors.
:param vector1: input vector 1
:type vector1: list, tuple
:param vector2: input vector 2
:type vector2: list, tuple
:return: result of the dot product
:rtype: float
"""
try:
if vector1 is No... | [
"def",
"vector_dot",
"(",
"vector1",
",",
"vector2",
")",
":",
"try",
":",
"if",
"vector1",
"is",
"None",
"or",
"len",
"(",
"vector1",
")",
"==",
"0",
"or",
"vector2",
"is",
"None",
"or",
"len",
"(",
"vector2",
")",
"==",
"0",
":",
"raise",
"ValueE... | Computes the dot-product of the input vectors.
:param vector1: input vector 1
:type vector1: list, tuple
:param vector2: input vector 2
:type vector2: list, tuple
:return: result of the dot product
:rtype: float | [
"Computes",
"the",
"dot",
"-",
"product",
"of",
"the",
"input",
"vectors",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L62-L87 |
230,365 | orbingol/NURBS-Python | geomdl/linalg.py | vector_sum | def vector_sum(vector1, vector2, coeff=1.0):
""" Sums the vectors.
This function computes the result of the vector operation :math:`\\overline{v}_{1} + c * \\overline{v}_{2}`, where
:math:`\\overline{v}_{1}` is ``vector1``, :math:`\\overline{v}_{2}` is ``vector2`` and :math:`c` is ``coeff``.
:param v... | python | def vector_sum(vector1, vector2, coeff=1.0):
""" Sums the vectors.
This function computes the result of the vector operation :math:`\\overline{v}_{1} + c * \\overline{v}_{2}`, where
:math:`\\overline{v}_{1}` is ``vector1``, :math:`\\overline{v}_{2}` is ``vector2`` and :math:`c` is ``coeff``.
:param v... | [
"def",
"vector_sum",
"(",
"vector1",
",",
"vector2",
",",
"coeff",
"=",
"1.0",
")",
":",
"summed_vector",
"=",
"[",
"v1",
"+",
"(",
"coeff",
"*",
"v2",
")",
"for",
"v1",
",",
"v2",
"in",
"zip",
"(",
"vector1",
",",
"vector2",
")",
"]",
"return",
... | Sums the vectors.
This function computes the result of the vector operation :math:`\\overline{v}_{1} + c * \\overline{v}_{2}`, where
:math:`\\overline{v}_{1}` is ``vector1``, :math:`\\overline{v}_{2}` is ``vector2`` and :math:`c` is ``coeff``.
:param vector1: vector 1
:type vector1: list, tuple
:... | [
"Sums",
"the",
"vectors",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L106-L122 |
230,366 | orbingol/NURBS-Python | geomdl/linalg.py | vector_normalize | def vector_normalize(vector_in, decimals=18):
""" Generates a unit vector from the input.
:param vector_in: vector to be normalized
:type vector_in: list, tuple
:param decimals: number of significands
:type decimals: int
:return: the normalized vector (i.e. the unit vector)
:rtype: list
... | python | def vector_normalize(vector_in, decimals=18):
""" Generates a unit vector from the input.
:param vector_in: vector to be normalized
:type vector_in: list, tuple
:param decimals: number of significands
:type decimals: int
:return: the normalized vector (i.e. the unit vector)
:rtype: list
... | [
"def",
"vector_normalize",
"(",
"vector_in",
",",
"decimals",
"=",
"18",
")",
":",
"try",
":",
"if",
"vector_in",
"is",
"None",
"or",
"len",
"(",
"vector_in",
")",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"\"Input vector cannot be empty\"",
")",
"except",... | Generates a unit vector from the input.
:param vector_in: vector to be normalized
:type vector_in: list, tuple
:param decimals: number of significands
:type decimals: int
:return: the normalized vector (i.e. the unit vector)
:rtype: list | [
"Generates",
"a",
"unit",
"vector",
"from",
"the",
"input",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L125-L156 |
230,367 | orbingol/NURBS-Python | geomdl/linalg.py | vector_generate | def vector_generate(start_pt, end_pt, normalize=False):
""" Generates a vector from 2 input points.
:param start_pt: start point of the vector
:type start_pt: list, tuple
:param end_pt: end point of the vector
:type end_pt: list, tuple
:param normalize: if True, the generated vector is normaliz... | python | def vector_generate(start_pt, end_pt, normalize=False):
""" Generates a vector from 2 input points.
:param start_pt: start point of the vector
:type start_pt: list, tuple
:param end_pt: end point of the vector
:type end_pt: list, tuple
:param normalize: if True, the generated vector is normaliz... | [
"def",
"vector_generate",
"(",
"start_pt",
",",
"end_pt",
",",
"normalize",
"=",
"False",
")",
":",
"try",
":",
"if",
"start_pt",
"is",
"None",
"or",
"len",
"(",
"start_pt",
")",
"==",
"0",
"or",
"end_pt",
"is",
"None",
"or",
"len",
"(",
"end_pt",
")... | Generates a vector from 2 input points.
:param start_pt: start point of the vector
:type start_pt: list, tuple
:param end_pt: end point of the vector
:type end_pt: list, tuple
:param normalize: if True, the generated vector is normalized
:type normalize: bool
:return: a vector from start_pt... | [
"Generates",
"a",
"vector",
"from",
"2",
"input",
"points",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L159-L186 |
230,368 | orbingol/NURBS-Python | geomdl/linalg.py | vector_magnitude | def vector_magnitude(vector_in):
""" Computes the magnitude of the input vector.
:param vector_in: input vector
:type vector_in: list, tuple
:return: magnitude of the vector
:rtype: float
"""
sq_sum = 0.0
for vin in vector_in:
sq_sum += vin**2
return math.sqrt(sq_sum) | python | def vector_magnitude(vector_in):
""" Computes the magnitude of the input vector.
:param vector_in: input vector
:type vector_in: list, tuple
:return: magnitude of the vector
:rtype: float
"""
sq_sum = 0.0
for vin in vector_in:
sq_sum += vin**2
return math.sqrt(sq_sum) | [
"def",
"vector_magnitude",
"(",
"vector_in",
")",
":",
"sq_sum",
"=",
"0.0",
"for",
"vin",
"in",
"vector_in",
":",
"sq_sum",
"+=",
"vin",
"**",
"2",
"return",
"math",
".",
"sqrt",
"(",
"sq_sum",
")"
] | Computes the magnitude of the input vector.
:param vector_in: input vector
:type vector_in: list, tuple
:return: magnitude of the vector
:rtype: float | [
"Computes",
"the",
"magnitude",
"of",
"the",
"input",
"vector",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L223-L234 |
230,369 | orbingol/NURBS-Python | geomdl/linalg.py | vector_angle_between | def vector_angle_between(vector1, vector2, **kwargs):
""" Computes the angle between the two input vectors.
If the keyword argument ``degrees`` is set to *True*, then the angle will be in degrees. Otherwise, it will be
in radians. By default, ``degrees`` is set to *True*.
:param vector1: vector
:t... | python | def vector_angle_between(vector1, vector2, **kwargs):
""" Computes the angle between the two input vectors.
If the keyword argument ``degrees`` is set to *True*, then the angle will be in degrees. Otherwise, it will be
in radians. By default, ``degrees`` is set to *True*.
:param vector1: vector
:t... | [
"def",
"vector_angle_between",
"(",
"vector1",
",",
"vector2",
",",
"*",
"*",
"kwargs",
")",
":",
"degrees",
"=",
"kwargs",
".",
"get",
"(",
"'degrees'",
",",
"True",
")",
"magn1",
"=",
"vector_magnitude",
"(",
"vector1",
")",
"magn2",
"=",
"vector_magnitu... | Computes the angle between the two input vectors.
If the keyword argument ``degrees`` is set to *True*, then the angle will be in degrees. Otherwise, it will be
in radians. By default, ``degrees`` is set to *True*.
:param vector1: vector
:type vector1: list, tuple
:param vector2: vector
:type ... | [
"Computes",
"the",
"angle",
"between",
"the",
"two",
"input",
"vectors",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L237-L258 |
230,370 | orbingol/NURBS-Python | geomdl/linalg.py | vector_is_zero | def vector_is_zero(vector_in, tol=10e-8):
""" Checks if the input vector is a zero vector.
:param vector_in: input vector
:type vector_in: list, tuple
:param tol: tolerance value
:type tol: float
:return: True if the input vector is zero, False otherwise
:rtype: bool
"""
if not isin... | python | def vector_is_zero(vector_in, tol=10e-8):
""" Checks if the input vector is a zero vector.
:param vector_in: input vector
:type vector_in: list, tuple
:param tol: tolerance value
:type tol: float
:return: True if the input vector is zero, False otherwise
:rtype: bool
"""
if not isin... | [
"def",
"vector_is_zero",
"(",
"vector_in",
",",
"tol",
"=",
"10e-8",
")",
":",
"if",
"not",
"isinstance",
"(",
"vector_in",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"raise",
"TypeError",
"(",
"\"Input vector must be a list or a tuple\"",
")",
"res",
"=... | Checks if the input vector is a zero vector.
:param vector_in: input vector
:type vector_in: list, tuple
:param tol: tolerance value
:type tol: float
:return: True if the input vector is zero, False otherwise
:rtype: bool | [
"Checks",
"if",
"the",
"input",
"vector",
"is",
"a",
"zero",
"vector",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L261-L278 |
230,371 | orbingol/NURBS-Python | geomdl/linalg.py | point_translate | def point_translate(point_in, vector_in):
""" Translates the input points using the input vector.
:param point_in: input point
:type point_in: list, tuple
:param vector_in: input vector
:type vector_in: list, tuple
:return: translated point
:rtype: list
"""
try:
if point_in ... | python | def point_translate(point_in, vector_in):
""" Translates the input points using the input vector.
:param point_in: input point
:type point_in: list, tuple
:param vector_in: input vector
:type vector_in: list, tuple
:return: translated point
:rtype: list
"""
try:
if point_in ... | [
"def",
"point_translate",
"(",
"point_in",
",",
"vector_in",
")",
":",
"try",
":",
"if",
"point_in",
"is",
"None",
"or",
"len",
"(",
"point_in",
")",
"==",
"0",
"or",
"vector_in",
"is",
"None",
"or",
"len",
"(",
"vector_in",
")",
"==",
"0",
":",
"rai... | Translates the input points using the input vector.
:param point_in: input point
:type point_in: list, tuple
:param vector_in: input vector
:type vector_in: list, tuple
:return: translated point
:rtype: list | [
"Translates",
"the",
"input",
"points",
"using",
"the",
"input",
"vector",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L281-L303 |
230,372 | orbingol/NURBS-Python | geomdl/linalg.py | point_distance | def point_distance(pt1, pt2):
""" Computes distance between two points.
:param pt1: point 1
:type pt1: list, tuple
:param pt2: point 2
:type pt2: list, tuple
:return: distance between input points
:rtype: float
"""
if len(pt1) != len(pt2):
raise ValueError("The input points ... | python | def point_distance(pt1, pt2):
""" Computes distance between two points.
:param pt1: point 1
:type pt1: list, tuple
:param pt2: point 2
:type pt2: list, tuple
:return: distance between input points
:rtype: float
"""
if len(pt1) != len(pt2):
raise ValueError("The input points ... | [
"def",
"point_distance",
"(",
"pt1",
",",
"pt2",
")",
":",
"if",
"len",
"(",
"pt1",
")",
"!=",
"len",
"(",
"pt2",
")",
":",
"raise",
"ValueError",
"(",
"\"The input points should have the same dimension\"",
")",
"dist_vector",
"=",
"vector_generate",
"(",
"pt1... | Computes distance between two points.
:param pt1: point 1
:type pt1: list, tuple
:param pt2: point 2
:type pt2: list, tuple
:return: distance between input points
:rtype: float | [
"Computes",
"distance",
"between",
"two",
"points",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L306-L321 |
230,373 | orbingol/NURBS-Python | geomdl/linalg.py | point_mid | def point_mid(pt1, pt2):
""" Computes the midpoint of the input points.
:param pt1: point 1
:type pt1: list, tuple
:param pt2: point 2
:type pt2: list, tuple
:return: midpoint
:rtype: list
"""
if len(pt1) != len(pt2):
raise ValueError("The input points should have the same d... | python | def point_mid(pt1, pt2):
""" Computes the midpoint of the input points.
:param pt1: point 1
:type pt1: list, tuple
:param pt2: point 2
:type pt2: list, tuple
:return: midpoint
:rtype: list
"""
if len(pt1) != len(pt2):
raise ValueError("The input points should have the same d... | [
"def",
"point_mid",
"(",
"pt1",
",",
"pt2",
")",
":",
"if",
"len",
"(",
"pt1",
")",
"!=",
"len",
"(",
"pt2",
")",
":",
"raise",
"ValueError",
"(",
"\"The input points should have the same dimension\"",
")",
"dist_vector",
"=",
"vector_generate",
"(",
"pt1",
... | Computes the midpoint of the input points.
:param pt1: point 1
:type pt1: list, tuple
:param pt2: point 2
:type pt2: list, tuple
:return: midpoint
:rtype: list | [
"Computes",
"the",
"midpoint",
"of",
"the",
"input",
"points",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L324-L339 |
230,374 | orbingol/NURBS-Python | geomdl/linalg.py | matrix_transpose | def matrix_transpose(m):
""" Transposes the input matrix.
The input matrix :math:`m` is a 2-dimensional array.
:param m: input matrix with dimensions :math:`(n \\times m)`
:type m: list, tuple
:return: transpose matrix with dimensions :math:`(m \\times n)`
:rtype: list
"""
num_cols = l... | python | def matrix_transpose(m):
""" Transposes the input matrix.
The input matrix :math:`m` is a 2-dimensional array.
:param m: input matrix with dimensions :math:`(n \\times m)`
:type m: list, tuple
:return: transpose matrix with dimensions :math:`(m \\times n)`
:rtype: list
"""
num_cols = l... | [
"def",
"matrix_transpose",
"(",
"m",
")",
":",
"num_cols",
"=",
"len",
"(",
"m",
")",
"num_rows",
"=",
"len",
"(",
"m",
"[",
"0",
"]",
")",
"m_t",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"num_rows",
")",
":",
"temp",
"=",
"[",
"]",
"fo... | Transposes the input matrix.
The input matrix :math:`m` is a 2-dimensional array.
:param m: input matrix with dimensions :math:`(n \\times m)`
:type m: list, tuple
:return: transpose matrix with dimensions :math:`(m \\times n)`
:rtype: list | [
"Transposes",
"the",
"input",
"matrix",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L342-L360 |
230,375 | orbingol/NURBS-Python | geomdl/linalg.py | triangle_center | def triangle_center(tri, uv=False):
""" Computes the center of mass of the input triangle.
:param tri: triangle object
:type tri: elements.Triangle
:param uv: if True, then finds parametric position of the center of mass
:type uv: bool
:return: center of mass of the triangle
:rtype: tuple
... | python | def triangle_center(tri, uv=False):
""" Computes the center of mass of the input triangle.
:param tri: triangle object
:type tri: elements.Triangle
:param uv: if True, then finds parametric position of the center of mass
:type uv: bool
:return: center of mass of the triangle
:rtype: tuple
... | [
"def",
"triangle_center",
"(",
"tri",
",",
"uv",
"=",
"False",
")",
":",
"if",
"uv",
":",
"data",
"=",
"[",
"t",
".",
"uv",
"for",
"t",
"in",
"tri",
"]",
"mid",
"=",
"[",
"0.0",
",",
"0.0",
"]",
"else",
":",
"data",
"=",
"tri",
".",
"vertices... | Computes the center of mass of the input triangle.
:param tri: triangle object
:type tri: elements.Triangle
:param uv: if True, then finds parametric position of the center of mass
:type uv: bool
:return: center of mass of the triangle
:rtype: tuple | [
"Computes",
"the",
"center",
"of",
"mass",
"of",
"the",
"input",
"triangle",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L396-L415 |
230,376 | orbingol/NURBS-Python | geomdl/linalg.py | lu_decomposition | def lu_decomposition(matrix_a):
""" LU-Factorization method using Doolittle's Method for solution of linear systems.
Decomposes the matrix :math:`A` such that :math:`A = LU`.
The input matrix is represented by a list or a tuple. The input matrix is **2-dimensional**, i.e. list of lists of
integers and... | python | def lu_decomposition(matrix_a):
""" LU-Factorization method using Doolittle's Method for solution of linear systems.
Decomposes the matrix :math:`A` such that :math:`A = LU`.
The input matrix is represented by a list or a tuple. The input matrix is **2-dimensional**, i.e. list of lists of
integers and... | [
"def",
"lu_decomposition",
"(",
"matrix_a",
")",
":",
"# Check if the 2-dimensional input matrix is a square matrix",
"q",
"=",
"len",
"(",
"matrix_a",
")",
"for",
"idx",
",",
"m_a",
"in",
"enumerate",
"(",
"matrix_a",
")",
":",
"if",
"len",
"(",
"m_a",
")",
"... | LU-Factorization method using Doolittle's Method for solution of linear systems.
Decomposes the matrix :math:`A` such that :math:`A = LU`.
The input matrix is represented by a list or a tuple. The input matrix is **2-dimensional**, i.e. list of lists of
integers and/or floats.
:param matrix_a: Input ... | [
"LU",
"-",
"Factorization",
"method",
"using",
"Doolittle",
"s",
"Method",
"for",
"solution",
"of",
"linear",
"systems",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L441-L462 |
230,377 | orbingol/NURBS-Python | geomdl/linalg.py | forward_substitution | def forward_substitution(matrix_l, matrix_b):
""" Forward substitution method for the solution of linear systems.
Solves the equation :math:`Ly = b` using forward substitution method
where :math:`L` is a lower triangular matrix and :math:`b` is a column matrix.
:param matrix_l: L, lower triangular mat... | python | def forward_substitution(matrix_l, matrix_b):
""" Forward substitution method for the solution of linear systems.
Solves the equation :math:`Ly = b` using forward substitution method
where :math:`L` is a lower triangular matrix and :math:`b` is a column matrix.
:param matrix_l: L, lower triangular mat... | [
"def",
"forward_substitution",
"(",
"matrix_l",
",",
"matrix_b",
")",
":",
"q",
"=",
"len",
"(",
"matrix_b",
")",
"matrix_y",
"=",
"[",
"0.0",
"for",
"_",
"in",
"range",
"(",
"q",
")",
"]",
"matrix_y",
"[",
"0",
"]",
"=",
"float",
"(",
"matrix_b",
... | Forward substitution method for the solution of linear systems.
Solves the equation :math:`Ly = b` using forward substitution method
where :math:`L` is a lower triangular matrix and :math:`b` is a column matrix.
:param matrix_l: L, lower triangular matrix
:type matrix_l: list, tuple
:param matrix_... | [
"Forward",
"substitution",
"method",
"for",
"the",
"solution",
"of",
"linear",
"systems",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L465-L484 |
230,378 | orbingol/NURBS-Python | geomdl/linalg.py | backward_substitution | def backward_substitution(matrix_u, matrix_y):
""" Backward substitution method for the solution of linear systems.
Solves the equation :math:`Ux = y` using backward substitution method
where :math:`U` is a upper triangular matrix and :math:`y` is a column matrix.
:param matrix_u: U, upper triangular ... | python | def backward_substitution(matrix_u, matrix_y):
""" Backward substitution method for the solution of linear systems.
Solves the equation :math:`Ux = y` using backward substitution method
where :math:`U` is a upper triangular matrix and :math:`y` is a column matrix.
:param matrix_u: U, upper triangular ... | [
"def",
"backward_substitution",
"(",
"matrix_u",
",",
"matrix_y",
")",
":",
"q",
"=",
"len",
"(",
"matrix_y",
")",
"matrix_x",
"=",
"[",
"0.0",
"for",
"_",
"in",
"range",
"(",
"q",
")",
"]",
"matrix_x",
"[",
"q",
"-",
"1",
"]",
"=",
"float",
"(",
... | Backward substitution method for the solution of linear systems.
Solves the equation :math:`Ux = y` using backward substitution method
where :math:`U` is a upper triangular matrix and :math:`y` is a column matrix.
:param matrix_u: U, upper triangular matrix
:type matrix_u: list, tuple
:param matri... | [
"Backward",
"substitution",
"method",
"for",
"the",
"solution",
"of",
"linear",
"systems",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L487-L506 |
230,379 | orbingol/NURBS-Python | geomdl/linalg.py | linspace | def linspace(start, stop, num, decimals=18):
""" Returns a list of evenly spaced numbers over a specified interval.
Inspired from Numpy's linspace function: https://github.com/numpy/numpy/blob/master/numpy/core/function_base.py
:param start: starting value
:type start: float
:param stop: end value... | python | def linspace(start, stop, num, decimals=18):
""" Returns a list of evenly spaced numbers over a specified interval.
Inspired from Numpy's linspace function: https://github.com/numpy/numpy/blob/master/numpy/core/function_base.py
:param start: starting value
:type start: float
:param stop: end value... | [
"def",
"linspace",
"(",
"start",
",",
"stop",
",",
"num",
",",
"decimals",
"=",
"18",
")",
":",
"start",
"=",
"float",
"(",
"start",
")",
"stop",
"=",
"float",
"(",
"stop",
")",
"if",
"abs",
"(",
"start",
"-",
"stop",
")",
"<=",
"10e-8",
":",
"... | Returns a list of evenly spaced numbers over a specified interval.
Inspired from Numpy's linspace function: https://github.com/numpy/numpy/blob/master/numpy/core/function_base.py
:param start: starting value
:type start: float
:param stop: end value
:type stop: float
:param num: number of samp... | [
"Returns",
"a",
"list",
"of",
"evenly",
"spaced",
"numbers",
"over",
"a",
"specified",
"interval",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L509-L535 |
230,380 | orbingol/NURBS-Python | geomdl/linalg.py | convex_hull | def convex_hull(points):
""" Returns points on convex hull in counterclockwise order according to Graham's scan algorithm.
Reference: https://gist.github.com/arthur-e/5cf52962341310f438e96c1f3c3398b8
.. note:: This implementation only works in 2-dimensional space.
:param points: list of 2-dimensional... | python | def convex_hull(points):
""" Returns points on convex hull in counterclockwise order according to Graham's scan algorithm.
Reference: https://gist.github.com/arthur-e/5cf52962341310f438e96c1f3c3398b8
.. note:: This implementation only works in 2-dimensional space.
:param points: list of 2-dimensional... | [
"def",
"convex_hull",
"(",
"points",
")",
":",
"turn_left",
",",
"turn_right",
",",
"turn_none",
"=",
"(",
"1",
",",
"-",
"1",
",",
"0",
")",
"def",
"cmp",
"(",
"a",
",",
"b",
")",
":",
"return",
"(",
"a",
">",
"b",
")",
"-",
"(",
"a",
"<",
... | Returns points on convex hull in counterclockwise order according to Graham's scan algorithm.
Reference: https://gist.github.com/arthur-e/5cf52962341310f438e96c1f3c3398b8
.. note:: This implementation only works in 2-dimensional space.
:param points: list of 2-dimensional points
:type points: list, t... | [
"Returns",
"points",
"on",
"convex",
"hull",
"in",
"counterclockwise",
"order",
"according",
"to",
"Graham",
"s",
"scan",
"algorithm",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L565-L595 |
230,381 | orbingol/NURBS-Python | geomdl/linalg.py | is_left | def is_left(point0, point1, point2):
""" Tests if a point is Left|On|Right of an infinite line.
Ported from the C++ version: on http://geomalgorithms.com/a03-_inclusion.html
.. note:: This implementation only works in 2-dimensional space.
:param point0: Point P0
:param point1: Point P1
:param... | python | def is_left(point0, point1, point2):
""" Tests if a point is Left|On|Right of an infinite line.
Ported from the C++ version: on http://geomalgorithms.com/a03-_inclusion.html
.. note:: This implementation only works in 2-dimensional space.
:param point0: Point P0
:param point1: Point P1
:param... | [
"def",
"is_left",
"(",
"point0",
",",
"point1",
",",
"point2",
")",
":",
"return",
"(",
"(",
"point1",
"[",
"0",
"]",
"-",
"point0",
"[",
"0",
"]",
")",
"*",
"(",
"point2",
"[",
"1",
"]",
"-",
"point0",
"[",
"1",
"]",
")",
")",
"-",
"(",
"(... | Tests if a point is Left|On|Right of an infinite line.
Ported from the C++ version: on http://geomalgorithms.com/a03-_inclusion.html
.. note:: This implementation only works in 2-dimensional space.
:param point0: Point P0
:param point1: Point P1
:param point2: Point P2
:return:
>0 for... | [
"Tests",
"if",
"a",
"point",
"is",
"Left|On|Right",
"of",
"an",
"infinite",
"line",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L598-L613 |
230,382 | orbingol/NURBS-Python | geomdl/linalg.py | wn_poly | def wn_poly(point, vertices):
""" Winding number test for a point in a polygon.
Ported from the C++ version: http://geomalgorithms.com/a03-_inclusion.html
.. note:: This implementation only works in 2-dimensional space.
:param point: point to be tested
:type point: list, tuple
:param vertices... | python | def wn_poly(point, vertices):
""" Winding number test for a point in a polygon.
Ported from the C++ version: http://geomalgorithms.com/a03-_inclusion.html
.. note:: This implementation only works in 2-dimensional space.
:param point: point to be tested
:type point: list, tuple
:param vertices... | [
"def",
"wn_poly",
"(",
"point",
",",
"vertices",
")",
":",
"wn",
"=",
"0",
"# the winding number counter",
"v_size",
"=",
"len",
"(",
"vertices",
")",
"-",
"1",
"# loop through all edges of the polygon",
"for",
"i",
"in",
"range",
"(",
"v_size",
")",
":",
"#... | Winding number test for a point in a polygon.
Ported from the C++ version: http://geomalgorithms.com/a03-_inclusion.html
.. note:: This implementation only works in 2-dimensional space.
:param point: point to be tested
:type point: list, tuple
:param vertices: vertex points of a polygon vertices[... | [
"Winding",
"number",
"test",
"for",
"a",
"point",
"in",
"a",
"polygon",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L616-L644 |
230,383 | orbingol/NURBS-Python | geomdl/construct.py | construct_surface | def construct_surface(direction, *args, **kwargs):
""" Generates surfaces from curves.
Arguments:
* ``args``: a list of curve instances
Keyword Arguments (optional):
* ``degree``: degree of the 2nd parametric direction
* ``knotvector``: knot vector of the 2nd parametric direction
... | python | def construct_surface(direction, *args, **kwargs):
""" Generates surfaces from curves.
Arguments:
* ``args``: a list of curve instances
Keyword Arguments (optional):
* ``degree``: degree of the 2nd parametric direction
* ``knotvector``: knot vector of the 2nd parametric direction
... | [
"def",
"construct_surface",
"(",
"direction",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Input validation",
"possible_dirs",
"=",
"[",
"'u'",
",",
"'v'",
"]",
"if",
"direction",
"not",
"in",
"possible_dirs",
":",
"raise",
"GeomdlException",
"(",... | Generates surfaces from curves.
Arguments:
* ``args``: a list of curve instances
Keyword Arguments (optional):
* ``degree``: degree of the 2nd parametric direction
* ``knotvector``: knot vector of the 2nd parametric direction
* ``rational``: flag to generate rational surfaces
... | [
"Generates",
"surfaces",
"from",
"curves",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/construct.py#L16-L100 |
230,384 | orbingol/NURBS-Python | geomdl/construct.py | extract_curves | def extract_curves(psurf, **kwargs):
""" Extracts curves from a surface.
The return value is a ``dict`` object containing the following keys:
* ``u``: the curves which generate u-direction (or which lie on the v-direction)
* ``v``: the curves which generate v-direction (or which lie on the u-direction... | python | def extract_curves(psurf, **kwargs):
""" Extracts curves from a surface.
The return value is a ``dict`` object containing the following keys:
* ``u``: the curves which generate u-direction (or which lie on the v-direction)
* ``v``: the curves which generate v-direction (or which lie on the u-direction... | [
"def",
"extract_curves",
"(",
"psurf",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"psurf",
".",
"pdimension",
"!=",
"2",
":",
"raise",
"GeomdlException",
"(",
"\"The input should be a spline surface\"",
")",
"if",
"len",
"(",
"psurf",
")",
"!=",
"1",
":",
"r... | Extracts curves from a surface.
The return value is a ``dict`` object containing the following keys:
* ``u``: the curves which generate u-direction (or which lie on the v-direction)
* ``v``: the curves which generate v-direction (or which lie on the u-direction)
As an example; if a curve lies on the ... | [
"Extracts",
"curves",
"from",
"a",
"surface",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/construct.py#L208-L270 |
230,385 | orbingol/NURBS-Python | geomdl/construct.py | extract_surfaces | def extract_surfaces(pvol):
""" Extracts surfaces from a volume.
:param pvol: input volume
:type pvol: abstract.Volume
:return: extracted surface
:rtype: dict
"""
if pvol.pdimension != 3:
raise GeomdlException("The input should be a spline volume")
if len(pvol) != 1:
rai... | python | def extract_surfaces(pvol):
""" Extracts surfaces from a volume.
:param pvol: input volume
:type pvol: abstract.Volume
:return: extracted surface
:rtype: dict
"""
if pvol.pdimension != 3:
raise GeomdlException("The input should be a spline volume")
if len(pvol) != 1:
rai... | [
"def",
"extract_surfaces",
"(",
"pvol",
")",
":",
"if",
"pvol",
".",
"pdimension",
"!=",
"3",
":",
"raise",
"GeomdlException",
"(",
"\"The input should be a spline volume\"",
")",
"if",
"len",
"(",
"pvol",
")",
"!=",
"1",
":",
"raise",
"GeomdlException",
"(",
... | Extracts surfaces from a volume.
:param pvol: input volume
:type pvol: abstract.Volume
:return: extracted surface
:rtype: dict | [
"Extracts",
"surfaces",
"from",
"a",
"volume",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/construct.py#L273-L343 |
230,386 | orbingol/NURBS-Python | geomdl/construct.py | extract_isosurface | def extract_isosurface(pvol):
""" Extracts the largest isosurface from a volume.
The following example illustrates one of the usage scenarios:
.. code-block:: python
:linenos:
from geomdl import construct, multi
from geomdl.visualization import VisMPL
# Assuming that "myv... | python | def extract_isosurface(pvol):
""" Extracts the largest isosurface from a volume.
The following example illustrates one of the usage scenarios:
.. code-block:: python
:linenos:
from geomdl import construct, multi
from geomdl.visualization import VisMPL
# Assuming that "myv... | [
"def",
"extract_isosurface",
"(",
"pvol",
")",
":",
"if",
"pvol",
".",
"pdimension",
"!=",
"3",
":",
"raise",
"GeomdlException",
"(",
"\"The input should be a spline volume\"",
")",
"if",
"len",
"(",
"pvol",
")",
"!=",
"1",
":",
"raise",
"GeomdlException",
"("... | Extracts the largest isosurface from a volume.
The following example illustrates one of the usage scenarios:
.. code-block:: python
:linenos:
from geomdl import construct, multi
from geomdl.visualization import VisMPL
# Assuming that "myvol" variable stores your spline volume... | [
"Extracts",
"the",
"largest",
"isosurface",
"from",
"a",
"volume",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/construct.py#L346-L383 |
230,387 | orbingol/NURBS-Python | geomdl/trimming.py | check_trim_curve | def check_trim_curve(curve, parbox, **kwargs):
""" Checks if the trim curve was closed and sense was set.
:param curve: trim curve
:param parbox: parameter space bounding box of the underlying surface
:return: a tuple containing the status of the operation and list of extra trim curves generated
:r... | python | def check_trim_curve(curve, parbox, **kwargs):
""" Checks if the trim curve was closed and sense was set.
:param curve: trim curve
:param parbox: parameter space bounding box of the underlying surface
:return: a tuple containing the status of the operation and list of extra trim curves generated
:r... | [
"def",
"check_trim_curve",
"(",
"curve",
",",
"parbox",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"next_idx",
"(",
"edge_idx",
",",
"direction",
")",
":",
"tmp",
"=",
"edge_idx",
"+",
"direction",
"if",
"tmp",
"<",
"0",
":",
"return",
"3",
"if",
"tmp... | Checks if the trim curve was closed and sense was set.
:param curve: trim curve
:param parbox: parameter space bounding box of the underlying surface
:return: a tuple containing the status of the operation and list of extra trim curves generated
:rtype: tuple | [
"Checks",
"if",
"the",
"trim",
"curve",
"was",
"closed",
"and",
"sense",
"was",
"set",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/trimming.py#L174-L278 |
230,388 | orbingol/NURBS-Python | geomdl/trimming.py | get_par_box | def get_par_box(domain, last=False):
""" Returns the bounding box of the surface parametric domain in ccw direction.
:param domain: parametric domain
:type domain: list, tuple
:param last: if True, adds the first vertex to the end of the return list
:type last: bool
:return: edges of the parame... | python | def get_par_box(domain, last=False):
""" Returns the bounding box of the surface parametric domain in ccw direction.
:param domain: parametric domain
:type domain: list, tuple
:param last: if True, adds the first vertex to the end of the return list
:type last: bool
:return: edges of the parame... | [
"def",
"get_par_box",
"(",
"domain",
",",
"last",
"=",
"False",
")",
":",
"u_range",
"=",
"domain",
"[",
"0",
"]",
"v_range",
"=",
"domain",
"[",
"1",
"]",
"verts",
"=",
"[",
"(",
"u_range",
"[",
"0",
"]",
",",
"v_range",
"[",
"0",
"]",
")",
",... | Returns the bounding box of the surface parametric domain in ccw direction.
:param domain: parametric domain
:type domain: list, tuple
:param last: if True, adds the first vertex to the end of the return list
:type last: bool
:return: edges of the parametric domain
:rtype: tuple | [
"Returns",
"the",
"bounding",
"box",
"of",
"the",
"surface",
"parametric",
"domain",
"in",
"ccw",
"direction",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/trimming.py#L281-L296 |
230,389 | orbingol/NURBS-Python | geomdl/trimming.py | detect_sense | def detect_sense(curve, tol):
""" Detects the sense, i.e. clockwise or counter-clockwise, of the curve.
:param curve: 2-dimensional trim curve
:type curve: abstract.Curve
:param tol: tolerance value
:type tol: float
:return: True if detection is successful, False otherwise
:rtype: bool
... | python | def detect_sense(curve, tol):
""" Detects the sense, i.e. clockwise or counter-clockwise, of the curve.
:param curve: 2-dimensional trim curve
:type curve: abstract.Curve
:param tol: tolerance value
:type tol: float
:return: True if detection is successful, False otherwise
:rtype: bool
... | [
"def",
"detect_sense",
"(",
"curve",
",",
"tol",
")",
":",
"if",
"curve",
".",
"opt_get",
"(",
"'reversed'",
")",
"is",
"None",
":",
"# Detect sense since it is unset",
"pts",
"=",
"curve",
".",
"evalpts",
"num_pts",
"=",
"len",
"(",
"pts",
")",
"for",
"... | Detects the sense, i.e. clockwise or counter-clockwise, of the curve.
:param curve: 2-dimensional trim curve
:type curve: abstract.Curve
:param tol: tolerance value
:type tol: float
:return: True if detection is successful, False otherwise
:rtype: bool | [
"Detects",
"the",
"sense",
"i",
".",
"e",
".",
"clockwise",
"or",
"counter",
"-",
"clockwise",
"of",
"the",
"curve",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/trimming.py#L299-L336 |
230,390 | orbingol/NURBS-Python | geomdl/ray.py | intersect | def intersect(ray1, ray2, **kwargs):
""" Finds intersection of 2 rays.
This functions finds the parameter values for the 1st and 2nd input rays and returns a tuple of
``(parameter for ray1, parameter for ray2, intersection status)``.
``status`` value is a enum type which reports the case which the inte... | python | def intersect(ray1, ray2, **kwargs):
""" Finds intersection of 2 rays.
This functions finds the parameter values for the 1st and 2nd input rays and returns a tuple of
``(parameter for ray1, parameter for ray2, intersection status)``.
``status`` value is a enum type which reports the case which the inte... | [
"def",
"intersect",
"(",
"ray1",
",",
"ray2",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"ray1",
",",
"Ray",
")",
"or",
"not",
"isinstance",
"(",
"ray2",
",",
"Ray",
")",
":",
"raise",
"TypeError",
"(",
"\"The input arguments mu... | Finds intersection of 2 rays.
This functions finds the parameter values for the 1st and 2nd input rays and returns a tuple of
``(parameter for ray1, parameter for ray2, intersection status)``.
``status`` value is a enum type which reports the case which the intersection operation encounters.
The inter... | [
"Finds",
"intersection",
"of",
"2",
"rays",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/ray.py#L107-L150 |
230,391 | orbingol/NURBS-Python | geomdl/freeform.py | Freeform.evaluate | def evaluate(self, **kwargs):
""" Sets points that form the geometry.
Keyword Arguments:
* ``points``: sets the points
"""
self._eval_points = kwargs.get('points', self._init_array())
self._dimension = len(self._eval_points[0]) | python | def evaluate(self, **kwargs):
""" Sets points that form the geometry.
Keyword Arguments:
* ``points``: sets the points
"""
self._eval_points = kwargs.get('points', self._init_array())
self._dimension = len(self._eval_points[0]) | [
"def",
"evaluate",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_eval_points",
"=",
"kwargs",
".",
"get",
"(",
"'points'",
",",
"self",
".",
"_init_array",
"(",
")",
")",
"self",
".",
"_dimension",
"=",
"len",
"(",
"self",
".",
"_e... | Sets points that form the geometry.
Keyword Arguments:
* ``points``: sets the points | [
"Sets",
"points",
"that",
"form",
"the",
"geometry",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/freeform.py#L20-L27 |
230,392 | orbingol/NURBS-Python | geomdl/exchange_vtk.py | export_polydata | def export_polydata(obj, file_name, **kwargs):
""" Exports control points or evaluated points in VTK Polydata format.
Please see the following document for details: http://www.vtk.org/VTK/img/file-formats.pdf
Keyword Arguments:
* ``point_type``: **ctrlpts** for control points or **evalpts** for ev... | python | def export_polydata(obj, file_name, **kwargs):
""" Exports control points or evaluated points in VTK Polydata format.
Please see the following document for details: http://www.vtk.org/VTK/img/file-formats.pdf
Keyword Arguments:
* ``point_type``: **ctrlpts** for control points or **evalpts** for ev... | [
"def",
"export_polydata",
"(",
"obj",
",",
"file_name",
",",
"*",
"*",
"kwargs",
")",
":",
"content",
"=",
"export_polydata_str",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
"return",
"exch",
".",
"write_file",
"(",
"file_name",
",",
"content",
")"
] | Exports control points or evaluated points in VTK Polydata format.
Please see the following document for details: http://www.vtk.org/VTK/img/file-formats.pdf
Keyword Arguments:
* ``point_type``: **ctrlpts** for control points or **evalpts** for evaluated points
* ``tessellate``: tessellates th... | [
"Exports",
"control",
"points",
"or",
"evaluated",
"points",
"in",
"VTK",
"Polydata",
"format",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/exchange_vtk.py#L125-L141 |
230,393 | orbingol/NURBS-Python | geomdl/utilities.py | make_zigzag | def make_zigzag(points, num_cols):
""" Converts linear sequence of points into a zig-zag shape.
This function is designed to create input for the visualization software. It orders the points to draw a zig-zag
shape which enables generating properly connected lines without any scanlines. Please see the belo... | python | def make_zigzag(points, num_cols):
""" Converts linear sequence of points into a zig-zag shape.
This function is designed to create input for the visualization software. It orders the points to draw a zig-zag
shape which enables generating properly connected lines without any scanlines. Please see the belo... | [
"def",
"make_zigzag",
"(",
"points",
",",
"num_cols",
")",
":",
"new_points",
"=",
"[",
"]",
"points_size",
"=",
"len",
"(",
"points",
")",
"forward",
"=",
"True",
"idx",
"=",
"0",
"rev_idx",
"=",
"-",
"1",
"while",
"idx",
"<",
"points_size",
":",
"i... | Converts linear sequence of points into a zig-zag shape.
This function is designed to create input for the visualization software. It orders the points to draw a zig-zag
shape which enables generating properly connected lines without any scanlines. Please see the below sketch on the
functionality of the ``... | [
"Converts",
"linear",
"sequence",
"of",
"points",
"into",
"a",
"zig",
"-",
"zag",
"shape",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/utilities.py#L40-L80 |
230,394 | orbingol/NURBS-Python | geomdl/utilities.py | make_quad | def make_quad(points, size_u, size_v):
""" Converts linear sequence of input points into a quad structure.
:param points: list of points to be ordered
:type points: list, tuple
:param size_v: number of elements in a row
:type size_v: int
:param size_u: number of elements in a column
:type s... | python | def make_quad(points, size_u, size_v):
""" Converts linear sequence of input points into a quad structure.
:param points: list of points to be ordered
:type points: list, tuple
:param size_v: number of elements in a row
:type size_v: int
:param size_u: number of elements in a column
:type s... | [
"def",
"make_quad",
"(",
"points",
",",
"size_u",
",",
"size_v",
")",
":",
"# Start with generating a zig-zag shape in row direction and then take its reverse",
"new_points",
"=",
"make_zigzag",
"(",
"points",
",",
"size_v",
")",
"new_points",
".",
"reverse",
"(",
")",
... | Converts linear sequence of input points into a quad structure.
:param points: list of points to be ordered
:type points: list, tuple
:param size_v: number of elements in a row
:type size_v: int
:param size_u: number of elements in a column
:type size_u: int
:return: re-ordered points
:... | [
"Converts",
"linear",
"sequence",
"of",
"input",
"points",
"into",
"a",
"quad",
"structure",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/utilities.py#L83-L112 |
230,395 | orbingol/NURBS-Python | geomdl/utilities.py | make_quadtree | def make_quadtree(points, size_u, size_v, **kwargs):
""" Generates a quadtree-like structure from surface control points.
This function generates a 2-dimensional list of control point coordinates. Considering the object-oriented
representation of a quadtree data structure, first dimension of the generated ... | python | def make_quadtree(points, size_u, size_v, **kwargs):
""" Generates a quadtree-like structure from surface control points.
This function generates a 2-dimensional list of control point coordinates. Considering the object-oriented
representation of a quadtree data structure, first dimension of the generated ... | [
"def",
"make_quadtree",
"(",
"points",
",",
"size_u",
",",
"size_v",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get keyword arguments",
"extrapolate",
"=",
"kwargs",
".",
"get",
"(",
"'extrapolate'",
",",
"True",
")",
"# Convert control points array into 2-dimensional fo... | Generates a quadtree-like structure from surface control points.
This function generates a 2-dimensional list of control point coordinates. Considering the object-oriented
representation of a quadtree data structure, first dimension of the generated list corresponds to a list of
*QuadTree* classes. Second ... | [
"Generates",
"a",
"quadtree",
"-",
"like",
"structure",
"from",
"surface",
"control",
"points",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/utilities.py#L115-L189 |
230,396 | orbingol/NURBS-Python | geomdl/utilities.py | evaluate_bounding_box | def evaluate_bounding_box(ctrlpts):
""" Computes the minimum bounding box of the point set.
The (minimum) bounding box is the smallest enclosure in which all the input points lie.
:param ctrlpts: points
:type ctrlpts: list, tuple
:return: bounding box in the format [min, max]
:rtype: tuple
... | python | def evaluate_bounding_box(ctrlpts):
""" Computes the minimum bounding box of the point set.
The (minimum) bounding box is the smallest enclosure in which all the input points lie.
:param ctrlpts: points
:type ctrlpts: list, tuple
:return: bounding box in the format [min, max]
:rtype: tuple
... | [
"def",
"evaluate_bounding_box",
"(",
"ctrlpts",
")",
":",
"# Estimate dimension from the first element of the control points",
"dimension",
"=",
"len",
"(",
"ctrlpts",
"[",
"0",
"]",
")",
"# Evaluate bounding box",
"bbmin",
"=",
"[",
"float",
"(",
"'inf'",
")",
"for",... | Computes the minimum bounding box of the point set.
The (minimum) bounding box is the smallest enclosure in which all the input points lie.
:param ctrlpts: points
:type ctrlpts: list, tuple
:return: bounding box in the format [min, max]
:rtype: tuple | [
"Computes",
"the",
"minimum",
"bounding",
"box",
"of",
"the",
"point",
"set",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/utilities.py#L192-L216 |
230,397 | orbingol/NURBS-Python | geomdl/_tessellate.py | make_triangle_mesh | def make_triangle_mesh(points, size_u, size_v, **kwargs):
""" Generates a triangular mesh from an array of points.
This function generates a triangular mesh for a NURBS or B-Spline surface on its parametric space.
The input is the surface points and the number of points on the parametric dimensions u and v... | python | def make_triangle_mesh(points, size_u, size_v, **kwargs):
""" Generates a triangular mesh from an array of points.
This function generates a triangular mesh for a NURBS or B-Spline surface on its parametric space.
The input is the surface points and the number of points on the parametric dimensions u and v... | [
"def",
"make_triangle_mesh",
"(",
"points",
",",
"size_u",
",",
"size_v",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"fix_numbering",
"(",
"vertex_list",
",",
"triangle_list",
")",
":",
"# Initialize variables",
"final_vertices",
"=",
"[",
"]",
"# Get all vertice... | Generates a triangular mesh from an array of points.
This function generates a triangular mesh for a NURBS or B-Spline surface on its parametric space.
The input is the surface points and the number of points on the parametric dimensions u and v,
indicated as row and column sizes in the function signature.... | [
"Generates",
"a",
"triangular",
"mesh",
"from",
"an",
"array",
"of",
"points",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_tessellate.py#L18-L148 |
230,398 | orbingol/NURBS-Python | geomdl/_tessellate.py | polygon_triangulate | def polygon_triangulate(tri_idx, *args):
""" Triangulates a monotone polygon defined by a list of vertices.
The input vertices must form a convex polygon and must be arranged in counter-clockwise order.
:param tri_idx: triangle numbering start value
:type tri_idx: int
:param args: list of Vertex o... | python | def polygon_triangulate(tri_idx, *args):
""" Triangulates a monotone polygon defined by a list of vertices.
The input vertices must form a convex polygon and must be arranged in counter-clockwise order.
:param tri_idx: triangle numbering start value
:type tri_idx: int
:param args: list of Vertex o... | [
"def",
"polygon_triangulate",
"(",
"tri_idx",
",",
"*",
"args",
")",
":",
"# Initialize variables",
"tidx",
"=",
"0",
"triangles",
"=",
"[",
"]",
"# Generate triangles",
"for",
"idx",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"args",
")",
"-",
"1",
")",
... | Triangulates a monotone polygon defined by a list of vertices.
The input vertices must form a convex polygon and must be arranged in counter-clockwise order.
:param tri_idx: triangle numbering start value
:type tri_idx: int
:param args: list of Vertex objects
:type args: Vertex
:return: list o... | [
"Triangulates",
"a",
"monotone",
"polygon",
"defined",
"by",
"a",
"list",
"of",
"vertices",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_tessellate.py#L151-L176 |
230,399 | orbingol/NURBS-Python | geomdl/_tessellate.py | make_quad_mesh | def make_quad_mesh(points, size_u, size_v):
""" Generates a mesh of quadrilateral elements.
:param points: list of points
:type points: list, tuple
:param size_u: number of points on the u-direction (column)
:type size_u: int
:param size_v: number of points on the v-direction (row)
:type si... | python | def make_quad_mesh(points, size_u, size_v):
""" Generates a mesh of quadrilateral elements.
:param points: list of points
:type points: list, tuple
:param size_u: number of points on the u-direction (column)
:type size_u: int
:param size_v: number of points on the v-direction (row)
:type si... | [
"def",
"make_quad_mesh",
"(",
"points",
",",
"size_u",
",",
"size_v",
")",
":",
"# Numbering",
"vertex_idx",
"=",
"0",
"quad_idx",
"=",
"0",
"# Generate vertices",
"vertices",
"=",
"[",
"]",
"for",
"pt",
"in",
"points",
":",
"vrt",
"=",
"Vertex",
"(",
"*... | Generates a mesh of quadrilateral elements.
:param points: list of points
:type points: list, tuple
:param size_u: number of points on the u-direction (column)
:type size_u: int
:param size_v: number of points on the v-direction (row)
:type size_v: int
:return: a tuple containing lists of v... | [
"Generates",
"a",
"mesh",
"of",
"quadrilateral",
"elements",
"."
] | b1c6a8b51cf143ff58761438e93ba6baef470627 | https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_tessellate.py#L179-L214 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.