vrGeometryService

class vrGeometryService

(Inherits vrBaseService)

Interface to create and change geometries.

See also vrdGeometryNode.

Functions

vrGeometryService.applyTessellation(nodes, settings, preserveUVs=False)

Tessellate the given nodes.

Parameters:
  • nodes (List[vrdNode]) – The surfaces that should be tessellated
  • settings (vrdTessellationSettings) – The tessellation settings
  • preserveUVs (bool) – If enabled the UV layout will be transferred from the old to the new tessellated surfaces after tessellation is finished.
vrGeometryService.createBox(parent, size, resolutionX=10, resolutionY=10, resolutionZ=10, color=QColor(4294967295))

Creates a box geometry.

Parameters:
  • parent (vrdNode) – The parent node for the new geometry
  • size (QVector3D) – the length, width and height of the box
  • resolutionX (integer) – Number of grid points X direction
  • resolutionY (integer) – Number of grid points Y direction
  • resolutionZ (integer) – Number of grid points Z direction
  • color (QColor) – A new material with this color is created and assigned to the geometry
Returns:

The created geometry node

Return type:

vrdNode

vrGeometryService.createCone(parent, height, radius, sides=20, createSide=True, createBottom=True, color=QColor(4294967295))

Creates a cone, or parts of it, in a given size and color.

Parameters:
  • parent (vrdNode) – The parent node for the new geometry
  • height (float) – The height of the cone
  • radius (float) – The bottom radius of the cone
  • sides (integer) – The number of elements the side consists of
  • createSide (bool) – Creation of side geometry
  • createBottom (bool) – Creation of bottom geometry
  • color (QColor) – A new material with this color is created and assigned to the geometry
Returns:

The created geometry node

Return type:

vrdNode

vrGeometryService.createCylinder(parent, height, radius, sides=20, showSide=True, showTop=True, showBottom=True, color=QColor(4294967295))

Creates a cylinder geometry.

Parameters:
  • parent (vrdNode) – The parent node for the new geometry
  • height (float) – The height
  • radius (float) – The radius
  • sides (integer) – Number of grid faces around the cylinder
  • showSide (bool) – Show faces on the side
  • showTop (bool) – Show top face
  • showBottom (bool) – Show bottom face
  • color (QColor) – A new material with this color is created and assigned to the geometry
Returns:

The created geometry node

Return type:

vrdNode

vrGeometryService.createDome(parent, baseRadius, groundRadius, latres=64, longres=64, color=QColor(4294967295))

Creates a dome with a given size and color.

Parameters:
  • parent (vrdNode) – The parent node for the new geometry
  • baseRadius (float) – The radius of the dome half sphere
  • groundRadius (float) – Controls the transition from the flat ground to the half sphere
  • latres (integer) – The lateral resolution (subdivisions) of the dome
  • longres (integer) – The longitudinal resolution (subdivisions) of the dome
  • color (QColor) – A new material with this color is created and assigned to the geometry
Returns:

The created geometry node

Return type:

vrdNode

vrGeometryService.createLine(parent, point1, point2, color=QColor(4294967295))

Creates a line geometry.

Parameters:
  • parent (vrdNode) – The parent node for the new geometry
  • point1 (QVector3D) – The starting point
  • point2 (QVector3D) – The end point
  • color (QColor) – A new material with this color is created and assigned to the geometry
Returns:

The created geometry node

Return type:

vrdNode

vrGeometryService.createPlane(parent, size, resolutionX=10, resolutionY=10, color=QColor(4294967295))

Creates a plane geometry.

Parameters:
  • parent (vrdNode) – The parent node for the new geometry
  • size (QVector2D) – the length and width of the plane
  • resolutionX (integer) – Number of grid points X direction
  • resolutionY (integer) – Number of grid points Y direction
  • color (QColor) – A new material with this color is created and assigned to the geometry
Returns:

The created geometry node

Return type:

vrdNode

vrGeometryService.createSphere(parent, radius, latres=50, longres=50, color=QColor(4294967295))

Creates a sphere with a given size and color.

Parameters:
  • parent (vrdNode) – The parent node for the new geometry
  • radius (float) – The radius of the sphere
  • latres (integer) – The lateral resolution (subdivision) of the sphere
  • longres (integer) – The longitudinal resolution (subdivision) of the sphere
  • color (QColor) – A new material with this color is created and assigned to the geometry
Returns:

The created geometry node

Return type:

vrdNode

vrGeometryService.createTorus(parent, innerRadius, outerRadius, sides=32, rings=32, color=QColor(4294967295))

Creates a torus with a given size and color.

Parameters:
  • parent (vrdNode) – The parent node for the new geometry
  • innerRadius (integer) – The inner radius of the torus
  • outerRadius (integer) – The outer radius of the torus
  • sides (integer) – Number of sides
  • rings (integer) – Number of rings
  • color (QColor) – A new material with this color is created and assigned to the geometry
Returns:

The created geometry node

Return type:

vrdNode

vrGeometryService.getTessellationSettings(node=vrdNode())

Get tessellation settings from node or from parent nodes.

Parameters:node (vrdNode) – Search for settings in this node
Returns:The found settings
Return type:vrdTessellationSettings
vrGeometryService.hasBSides(root=vrdNode())

Check, if there are geometries with B-Sides in the given tree.

Parameters:root (vrdNode) – The tree to search. If empty, search the show scene graph
Returns:True, if B-Sides found
Return type:bool
vrGeometryService.hasDegenerateTriangles(root)
Parameters:root (vrdNode) – root node of a sub tree
Returns:True, if given tree contains geometry with degenerate triangles
Return type:bool
vrGeometryService.mergeGeometry(nodes, material, visibilityMode=vrGeometryTypes.VisibilityMergeMode.MergeByVisibility)

Merges the given geometries into one geometry.

Parameters:
Returns:

On success, the merged nodes

Return type:

List[vrdNode]

vrGeometryService.mergeGeometryByMaterial(nodes, visibilityMode=vrGeometryTypes.VisibilityMergeMode.MergeByVisibility)

Merges the given geometries into one geometry for each material.

Parameters:
Returns:

On success, the merged nodes

Return type:

List[vrdNode]

vrGeometryService.removeBSideNodes(nodes)

Remove all nodes with B-Sides in the given trees.

Parameters:nodes (List[vrdNode]) – A list of nodes to be searched for B-Side nodes
vrGeometryService.setToBSide(nodes, enable)

Enables or disables the BSide mode for the given nodes.

Parameters:
  • nodes (List[vrdNode]) – A list of nodes be to processed
  • enable (bool) – If True, b side is enabled
vrGeometryService.splitGeometry(nodes, maxPrimitives=1)

Split the given geometries into multiple geometries.

Parameters:
  • nodes (List[vrdNode]) – The nodes to be split
  • maxPrimitives (integer) – Split into nodes with a maximum of this primitives
vrGeometryService.subdivideGeometry(nodes, maxEdgeLength)

Subdivide meshes into smaller triangles.

Parameters:
  • nodes (List[vrdNode]) – The nodes to be subdivided
  • maxEdgeLength (float) – Subdivide if edges are longer than this value
vrGeometryService.subdivideGeometryPhong(nodes, iterations)

Subdivide meshes into smaller triangles using phong interpolation.

Parameters:
  • nodes (List[vrdNode]) – The nodes to be subdivided
  • iterations (integer) – The number of iterations to run
vrGeometryService.unsplitFromPrimitives(nodes)

Combines child geometries with one triangle into a single geometry.

Parameters:nodes (List[vrdNode]) – List of parent nodes that have only geometries with one triangle as children