< GeeXLab Reference Guide />
> Back to Reference Guide Index
gh_polyline library
Description
gh_polyline is the module that manages polylines (a set of non-connected lines).
Number of functions: 14
- gh_polyline.create_v2 ()
- gh_polyline.get_vertex_color ()
- gh_polyline.get_vertex_position ()
- gh_polyline.set_vertex_color ()
- gh_polyline.set_vertex_draw_range ()
- gh_polyline.set_vertex_position ()
- gh_polyline.set_vertex_position_color ()
- gh_polyline.set_vertices_color ()
- gh_polyline.set_vertices_color_v2 ()
- gh_polyline.set_vertices_position ()
- gh_polyline.wideline_add_point ()
- gh_polyline.wideline_create ()
- gh_polyline.wideline_reset_points ()
- gh_polyline.wideline_set_line_width ()
create_v2
Description
Creates a polyline.
Syntax
pl_id = gh_polyline.create_v2(
num_vertices,
line_mode
)
Languages
Parameters
- num_vertices [INTEGER]: number of vertices
- line_mode [ENUM]: line mode: DEFAULT (0), STRIP (1) or LOOP (2)
Return Values
- pl_id [ID]: polyline identifier
Code sample
pl_id = gh_polyline.create_v2(num_vertices, line_mode)
get_vertex_color
Description
Gets the color of a particular vertex.
Syntax
r, g, b, a = gh_polyline.get_vertex_color(
pl_id,
vertex_index
)
Languages
Parameters
- pl_id [ID]: polyline identifier
- vertex_index [INTEGER]: index of the vertex
Return Values
- r, g, b, a [REAL]: RGBA color of the vertex
Code sample
r, g, b, a = gh_polyline.get_vertex_color(pl_id, vertex_index)
get_vertex_position
Description
Gets the position of a particular vertex.
Syntax
x, y, z, w = gh_polyline.get_vertex_position(
pl_id,
vertex_index
)
Languages
Parameters
- pl_id [ID]: polyline identifier
- vertex_index [INTEGER]: index of the vertex
Return Values
- x, y, z, w [REAL]: 4D position of the vertex
Code sample
x, y, z, w = gh_polyline.get_vertex_position(pl_id, vertex_index)
set_vertex_color
Description
Sets the color of a particular vertex.
Syntax
gh_polyline.set_vertex_color(
pl_id,
vertex_index,
r, g, b, a
)
Languages
Parameters
- pl_id [ID]: polyline identifier
- vertex_index [INTEGER]: index of the vertex
- r, g, b, a [REAL]: RGBA color of the vertex
Return Values
This function has no return value(s).
Code sample
gh_polyline.set_vertex_color(pl_id, vertex_index, r, g, b, a)
set_vertex_draw_range
Description
Sets the start vertex index and the number of vertices to render.
Syntax
gh_polyline.set_vertex_draw_range(
pl_id,
start_index,
num_vertices
)
Languages
Parameters
- pl_id [ID]: polyline identifier
- start_index [INTEGER]: start offset. Default value is 0
- num_vertices [INTEGER]: number of vertices to render
Return Values
This function has no return value(s).
Code sample
gh_polyline.set_vertex_draw_range(pl_id, 0, 2)
set_vertex_position
Description
Sets the position of a particular vertex.
Syntax
gh_polyline.set_vertex_position(
pl_id,
vertex_index,
x, y, z, w
)
Languages
Parameters
- pl_id [ID]: polyline identifier
- vertex_index [INTEGER]: index of the vertex
- x, y, z, w [REAL]: 3D position of the vertex
Return Values
This function has no return value(s).
Code sample
gh_polyline.set_vertex_position(pl_id, vertex_index, x0, y0, z0, 1.0)
set_vertex_position_color
Description
Sets the position and the color of a particular vertex.
Syntax
gh_polyline.set_vertex_position_color(
pl_id,
vertex_index,
x, y, z, w,
r, g, b, a
)
Languages
Parameters
- pl_id [ID]: polyline identifier
- vertex_index [INTEGER]: index of the vertex
- x, y, z, w [REAL]: 3D position of the vertex
- r, g, b, a [REAL]: RGBA color of the vertex
Return Values
This function has no return value(s).
Code sample
gh_polyline.set_vertex_position_color(pl_id, vertex_index, x, y, z, w, r, g, b, a)
set_vertices_color
Description
Sets the color of all vertices using a table as input
Syntax
gh_polyline.set_vertices_color(
pl_id,
start_offset,
num_vertices,
vertices_list
)
Languages
Parameters
- pl_id [ID]: polyline identifier
- start_offset [INTEGER]: index of the first vertex
- num_vertices [INTEGER]: number vertices that must be updated
- vertices_list [TABLE]: list of all colors, each element of the list must have the following format: {x=, y=, z=, w=}
Return Values
This function has no return value(s).
Code sample
colors = {}
colors[1] = {x=1.0, y=1.0, z=0.0, w=1.0}
colors[2] = {x=0.0, y=1.0, z=1.0, w=1.0}
start_offset = 0
num_vertices = 2
gh_polyline.set_vertices_color(pl_id, start_offset, num_vertices, colors)
set_vertices_color_v2
Description
Sets the color of all vertices using a single RGBA value.
Syntax
gh_polyline.set_vertices_color_v2(
pl_id,
r, g, b, a
)
Languages
Parameters
- pl_id [ID]: polyline identifier
- r, g, b, a [REAL]: RGBA value
Return Values
This function has no return value(s).
Code sample
gh_polyline.set_vertices_color_v2(pl_id, r, g, b, a)
set_vertices_position
Description
Sets the position of all vertices using a table as input
Syntax
gh_polyline.set_vertices_position(
pl_id,
start_offset,
num_vertices,
vertices_list
)
Languages
Parameters
- pl_id [ID]: polyline identifier
- start_offset [INTEGER]: index of the first vertex
- num_vertices [INTEGER]: number vertices that must be updated
- vertices_list [TABLE]: list of all positions, each element of the list must have the following format: {x=, y=, z=, w=}
Return Values
This function has no return value(s).
Code sample
positions = {}
positions[1] = {x=-1.0, y=-1.0, z=0.0, w=1.0}
positions[2] = {x=1.0, y=1.0, z=0.0, w=1.0}
start_offset = 0
num_vertices = 2
gh_polyline.set_vertices_position(pl_id, start_offset, num_vertices, positions)
wideline_add_point
Description
Adds a point to a wideline.
Syntax
gh_polyline.wideline_add_point(
pl_id,
x, y, z, w,
r, g, b, a
)
Languages
Parameters
- pl_id [ID]: polyline identifier
- x, y, z, w [REAL]: vec4 position of a point
- r, g, b, a [REAL]: RGBA color of the point
Return Values
This function has no return value(s).
Code sample
gh_polyline.wideline_add_point(pl_id, x, y, z, w, r, g, b, a)
wideline_create
Description
Creates a wideline polyline.
Syntax
pl_id = gh_polyline.wideline_create(
num_vertices,
line_width
)
Languages
Parameters
- num_vertices [INTEGER]: number of vertices
- line_width [REAL]: line width
Return Values
- pl_id [ID]: polyline identifier
Code sample
pl_id = gh_polyline.wideline_create(num_vertices, 5.0)
wideline_reset_points
Description
Resets (clears) all points of a wideline.
Syntax
gh_polyline.wideline_reset_points(
pl_id
)
Languages
Parameters
- pl_id [ID]: polyline identifier
Return Values
This function has no return value(s).
Code sample
gh_polyline.wideline_reset_points(pl_id)
wideline_set_line_width
Description
Adds a point to a wideline.
Syntax
gh_polyline.wideline_set_line_width(
pl_id,
line_width
)
Languages
Parameters
- pl_id [ID]: polyline identifier
- line_width [REAL]: width of the line
Return Values
This function has no return value(s).
Code sample
gh_polyline.wideline_set_line_width(pl_id, line_width)
| |