v2.0.0
Loading...
Searching...
No Matches
MeshFactory Class Reference

Static factory for procedural mesh primitives. More...

#include <meshfactory.h>

Public Member Functions

 MeshFactory ()=delete

Static Public Member Functions

static std::shared_ptr< BrainSurfacecreateSphere (const QVector3D &center, float radius, const QColor &color, int subdivisions=1)
static std::shared_ptr< BrainSurfacecreatePlate (const QVector3D &center, const QMatrix4x4 &orientation, const QColor &color, float size)
static std::shared_ptr< BrainSurfacecreateBarbell (const QVector3D &center, const QMatrix4x4 &orientation, const QColor &color, float size)
static std::shared_ptr< BrainSurfacecreateBatchedSpheres (const QVector< QVector3D > &positions, float radius, const QColor &color, int subdivisions=1)
static int sphereVertexCount (int subdivisions=1)

Detailed Description

Static factory for procedural mesh primitives.

All methods return fully constructed BrainSurface objects ready for rendering. This eliminates duplicated icosahedron / plate / barbell code that was spread across BrainView::onRowsInserted.

Definition at line 61 of file meshfactory.h.

Constructor & Destructor Documentation

◆ MeshFactory()

MeshFactory::MeshFactory ( )
delete

Member Function Documentation

◆ createBarbell()

std::shared_ptr< BrainSurface > MeshFactory::createBarbell ( const QVector3D & center,
const QMatrix4x4 & orientation,
const QColor & color,
float size )
static

Create a barbell shape (two spheres connected by a thin rod), used for MEG gradiometers.

Parameters
[in]centerWorld-space center.
[in]orientation3×3 rotation embedded in a 4×4 matrix (coil_trans).
[in]colorSurface color.
[in]sizeOverall size scale in meters.
Returns
Shared pointer to the created BrainSurface.

Definition at line 222 of file meshfactory.cpp.

◆ createBatchedSpheres()

std::shared_ptr< BrainSurface > MeshFactory::createBatchedSpheres ( const QVector< QVector3D > & positions,
float radius,
const QColor & color,
int subdivisions = 1 )
static

Create a batched mesh of identical spheres at multiple positions (used for source space points, digitizer points, etc.).

All spheres are merged into a single BrainSurface for efficient rendering.

Parameters
[in]positionsWorld-space positions for each sphere.
[in]radiusSphere radius in meters.
[in]colorSphere color.
[in]subdivisionsNumber of subdivision passes per sphere.
Returns
Shared pointer to the batched BrainSurface.

Definition at line 314 of file meshfactory.cpp.

◆ createPlate()

std::shared_ptr< BrainSurface > MeshFactory::createPlate ( const QVector3D & center,
const QMatrix4x4 & orientation,
const QColor & color,
float size )
static

Create a thin oriented rectangular plate (used for MEG magnetometers).

Parameters
[in]centerWorld-space center.
[in]orientation3×3 rotation embedded in a 4×4 matrix (coil_trans).
[in]colorSurface color.
[in]sizeSide length in meters (plate is size × size × thin).
Returns
Shared pointer to the created BrainSurface.

Definition at line 171 of file meshfactory.cpp.

◆ createSphere()

std::shared_ptr< BrainSurface > MeshFactory::createSphere ( const QVector3D & center,
float radius,
const QColor & color,
int subdivisions = 1 )
static

Create a subdivided icosahedron sphere.

Parameters
[in]centerWorld-space center of the sphere.
[in]radiusRadius in meters.
[in]colorSurface color.
[in]subdivisionsNumber of subdivision passes (0 = 20 tris, 1 = 80 tris).
Returns
Shared pointer to the created BrainSurface.

Definition at line 138 of file meshfactory.cpp.

◆ sphereVertexCount()

int MeshFactory::sphereVertexCount ( int subdivisions = 1)
static

Number of vertices in a subdivided icosahedron (for picking calculations).

Parameters
[in]subdivisionsNumber of subdivision passes.
Returns
Number of vertices.

Definition at line 128 of file meshfactory.cpp.


The documentation for this class was generated from the following files: