Skip to content

Points

Points

Quick documentation

Points are discs with a given size (diameter) and posses a surface that can be filled and stroked. They always face the viewer such that their rendered shape is a disc, independentely of any transform.

import numpy as np
import matplotlib.pyplot as plt
from gsp import glm, core, visual, transform

canvas = core.Canvas(512, 512, 100.0)
viewport = core.Viewport(canvas,0,0,512,512)
camera = glm.Camera("ortho")

n = 600
P = glm.vec3(n)
P.x = np.linspace(0.05,0.95,n)
P.xy = np.linspace(0,10.125*2*np.pi,n)
sizes = np.linspace(0.05, 12.0,n)**2
points = visual.Points(P, sizes)
points.render(viewport, camera.transform)
plt.show()

__init__

__init__(
    positions,
    sizes=25.0,
    fill_colors=Color(0, 0, 0, 1),
    line_colors=Color(0, 0, 0, 1),
    line_widths=0,
)

Create a visual of n points at given positions with given sizes, flll_colors., line_colors and line_widths.

Parameters:

Name Type Description Default
positions Transform | Buffer

Points position (vec3)

required
sizes Transform | Buffer | Measure

Point sizes (float)

25.0
fill_colors Transform | Buffer | Color

Points fill colors (vec4)

Color(0, 0, 0, 1)
line_colors Transform | Buffer | Color

Points line colors (vec4)

Color(0, 0, 0, 1)
line_widths Transform | Buffer | Measure

Points line colors (vec4)

0

render

render(viewport=None, model=None, view=None, proj=None)

Render the visual on viewport using the given model, view, proj matrices

Parameters:

Name Type Description Default
viewport Viewport

Viewport where to render the visual

None
model mat4

Model matrix to use for rendering

None
view mat4

View matrix to use for rendering

None
proj mat4

Projection matrix to use for rendering

None