vcPointSet

vcPointSet is a type of geometry set used for creating and rendering point clouds and/or data points.

Inherits: vcGeometrySet

Properties

Name Type Access Description
ColorConfiguration Enumeration RW Defines the color format for points. By default, the color format is RGBA.

See Color Format Constants for more information.

 

Gets or sets the current color configuration. There are 2 VC_COLOR_CONFIGURATION_RGBA and VC_COLOR_CONFIGURATION_BGRA

IncrementalBoundUpdate

Boolean RW Defines if the bound box should be updated on every added point or not.
PointCount Real

R

Total amount of points in the point set.
PointSize Real RW Defines the size (in pixels) of points in set.
Scale Real RW Defines a factor for scaling rendered points in set.

Methods

Name Return Type Parameters Description
addPoint Integer Real x, Real y, Real z

or

Real x, Real y, Real z, Real r, Real g, Real b

or

Real x, Real y, Real z, Real r, Real g, Real b, Real a

Adds a point to set, and then returns the index of point in the set.

One option is to give XYZ coordinates for point in World coordinate system, thereby the point is assigned default color.

A second option is to give XYZ coordinates and RGB color for the point.

A third option is to give XYZ coordinates and RGB color with alpha channel for the point.

If you are assigning a color, the RGB values must be normalized XYZ values for RGB color space.

clearPoints None

None

Removes all points from set.
getPointColor vcVector Integer Index Gets a point color given an index.
getPointPosition vcVector Integer Index Gets a point position given an index.
update None None Updates the bound box of set.
updatePointColor None integer Index, Real r, Real g, Real b Updates the color of the point defined by the index.
updatePointPosition None integer Index, Real x, Real y, Real z Updates a point position given an index.

Examples

Example. Render point cloud in 3D world

from vcScript import *
from random import *
 
cloudsize = 1000.0
pointamount = 100000
 
comp = getComponent()
pc = comp.findFeature('pc')
if not pc:
  pc = comp.RootFeature.createFeature(VC_GEOMETRY,'pc')
if pc.Geometry.GeometrySetCount == 0:
  pcs = pc.Geometry.createGeometrySet(VC_POINTSET)
else:
  pcs = pc.Geometry.getGeometrySet(0) 
pcs.clearPoints()
 
for i in range(pointamount):
  x = cloudsize * random()
  y = cloudsize * random()
  z = cloudsize * random()
  r = random()
  g = random()
  b = random()
  pcs.addPoint(x,y,z,r,g,b)
 
pcs.update()
comp.rebuild()
getApplication().render()