KiCad PCB EDA Suite
Loading...
Searching...
No Matches
TRIANGLE Class Reference

A triangle object. More...

#include <triangle_3d.h>

Inheritance diagram for TRIANGLE:
OBJECT_3D

Public Member Functions

 TRIANGLE (const SFVEC3F &aV1, const SFVEC3F &aV2, const SFVEC3F &aV3)
 
 TRIANGLE (const SFVEC3F &aV1, const SFVEC3F &aV2, const SFVEC3F &aV3, const SFVEC3F &aFaceNormal)
 
 TRIANGLE (const SFVEC3F &aV1, const SFVEC3F &aV2, const SFVEC3F &aV3, const SFVEC3F &aN1, const SFVEC3F &aN2, const SFVEC3F &aN3)
 
void SetColor (const SFVEC3F &aColor)
 
void SetColor (const SFVEC3F &aVC0, const SFVEC3F &aVC1, const SFVEC3F &aVC2)
 
void SetColor (unsigned int aFaceColorRGBA)
 
void SetColor (unsigned int aVertex1ColorRGBA, unsigned int aVertex2ColorRGBA, unsigned int aVertex3ColorRGBA)
 
void SetUV (const SFVEC2F &aUV1, const SFVEC2F &aUV2, const SFVEC2F &aUV3)
 
bool Intersect (const RAY &aRay, HITINFO &aHitInfo) const override
 
bool IntersectP (const RAY &aRay, float aMaxDistance) const override
 
bool Intersects (const BBOX_3D &aBBox) const override
 
SFVEC3F GetDiffuseColor (const HITINFO &aHitInfo) const override
 
void SetBoardItem (BOARD_ITEM *aBoardItem)
 
BOARD_ITEMGetBoardItem () const
 
void SetMaterial (const MATERIAL *aMaterial)
 
const MATERIALGetMaterial () const
 
float GetModelTransparency () const
 
void SetModelTransparency (float aModelTransparency)
 
const BBOX_3DGetBBox () const
 
const SFVEC3FGetCentroid () const
 

Protected Attributes

BBOX_3D m_bbox
 
SFVEC3F m_centroid
 
OBJECT_3D_TYPE m_obj_type
 
const MATERIALm_material
 
BOARD_ITEMm_boardItem
 
float m_modelTransparency
 

Private Member Functions

void pre_calc_const ()
 

Private Attributes

SFVEC3F m_normal [3]
 
SFVEC3F m_vertex [3]
 
SFVEC3F m_n
 
SFVEC2F m_uv [3]
 
unsigned int m_vertexColorRGBA [3]
 
float m_nu
 
float m_nv
 
float m_nd
 
unsigned int m_k
 
float m_bnu
 
float m_bnv
 
float m_cnu
 
float m_cnv
 

Detailed Description

A triangle object.

Definition at line 42 of file triangle_3d.h.

Constructor & Destructor Documentation

◆ TRIANGLE() [1/3]

TRIANGLE::TRIANGLE ( const SFVEC3F aV1,
const SFVEC3F aV2,
const SFVEC3F aV3 
)

Definition at line 95 of file triangle_3d.cpp.

References m_vertex, m_vertexColorRGBA, and pre_calc_const().

◆ TRIANGLE() [2/3]

TRIANGLE::TRIANGLE ( const SFVEC3F aV1,
const SFVEC3F aV2,
const SFVEC3F aV3,
const SFVEC3F aFaceNormal 
)

Definition at line 110 of file triangle_3d.cpp.

References m_normal, m_vertex, m_vertexColorRGBA, and pre_calc_const().

◆ TRIANGLE() [3/3]

TRIANGLE::TRIANGLE ( const SFVEC3F aV1,
const SFVEC3F aV2,
const SFVEC3F aV3,
const SFVEC3F aN1,
const SFVEC3F aN2,
const SFVEC3F aN3 
)

Definition at line 130 of file triangle_3d.cpp.

References m_normal, m_vertex, m_vertexColorRGBA, and pre_calc_const().

Member Function Documentation

◆ GetBBox()

const BBOX_3D & OBJECT_3D::GetBBox ( ) const
inlineinherited

Definition at line 92 of file object_3d.h.

References OBJECT_3D::m_bbox.

Referenced by CONTAINER_3D_BASE::Add(), and BVH_PBRT::Intersect().

◆ GetBoardItem()

BOARD_ITEM * OBJECT_3D::GetBoardItem ( ) const
inlineinherited

Definition at line 56 of file object_3d.h.

References OBJECT_3D::m_boardItem.

Referenced by RENDER_3D_RAYTRACE_BASE::IntersectBoardItem().

◆ GetCentroid()

const SFVEC3F & OBJECT_3D::GetCentroid ( ) const
inlineinherited

Definition at line 94 of file object_3d.h.

References OBJECT_3D::m_centroid.

◆ GetDiffuseColor()

SFVEC3F TRIANGLE::GetDiffuseColor ( const HITINFO aHitInfo) const
overridevirtual

Implements OBJECT_3D.

Definition at line 306 of file triangle_3d.cpp.

References HITINFO::m_UV, and m_vertexColorRGBA.

◆ GetMaterial()

const MATERIAL * OBJECT_3D::GetMaterial ( ) const
inlineinherited

Definition at line 64 of file object_3d.h.

References OBJECT_3D::m_material.

Referenced by BVH_PBRT::IntersectP(), and RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ GetModelTransparency()

float OBJECT_3D::GetModelTransparency ( ) const
inlineinherited

Definition at line 65 of file object_3d.h.

References OBJECT_3D::m_modelTransparency.

Referenced by RENDER_3D_RAYTRACE_BASE::shadeHit().

◆ Intersect()

bool TRIANGLE::Intersect ( const RAY aRay,
HITINFO aHitInfo 
) const
overridevirtual
Returns
true if the aRay intersects the object.

TODO: precalc this, improve it

Implements OBJECT_3D.

Definition at line 202 of file triangle_3d.cpp.

References RAY::at(), MATERIAL::Generate(), ku, kv, m_bnu, m_bnv, m_cnu, m_cnv, RAY::m_Dir, HITINFO::m_HitNormal, HITINFO::m_HitPoint, m_k, OBJECT_3D::m_material, m_n, m_nd, m_normal, m_nu, m_nv, RAY::m_Origin, HITINFO::m_tHit, m_vertex, and HITINFO::pHitObject.

◆ IntersectP()

bool TRIANGLE::IntersectP ( const RAY aRay,
float  aMaxDistance 
) const
overridevirtual
Parameters
aMaxDistanceis the maximum distance of the test.
Returns
true if aRay intersects the object.

TODO: precalc this

Implements OBJECT_3D.

Definition at line 256 of file triangle_3d.cpp.

References ku, kv, m_bnu, m_bnv, m_cnu, m_cnv, RAY::m_Dir, m_k, m_n, m_nd, m_nu, m_nv, RAY::m_Origin, and m_vertex.

◆ Intersects()

bool TRIANGLE::Intersects ( const BBOX_3D aBBox) const
overridevirtual
Returns
true if this object intersects aBBox.

TODO: improve

Implements OBJECT_3D.

Definition at line 299 of file triangle_3d.cpp.

References BBOX_3D::Intersects(), and OBJECT_3D::m_bbox.

◆ pre_calc_const()

void TRIANGLE::pre_calc_const ( )
private

◆ SetBoardItem()

void OBJECT_3D::SetBoardItem ( BOARD_ITEM aBoardItem)
inlineinherited

Definition at line 55 of file object_3d.h.

References OBJECT_3D::m_boardItem.

Referenced by RENDER_3D_RAYTRACE_BASE::addModels().

◆ SetColor() [1/4]

void TRIANGLE::SetColor ( const SFVEC3F aColor)

◆ SetColor() [2/4]

void TRIANGLE::SetColor ( const SFVEC3F aVC0,
const SFVEC3F aVC1,
const SFVEC3F aVC2 
)

Definition at line 160 of file triangle_3d.cpp.

References m_vertexColorRGBA.

◆ SetColor() [3/4]

void TRIANGLE::SetColor ( unsigned int  aFaceColorRGBA)

Definition at line 174 of file triangle_3d.cpp.

References m_vertexColorRGBA.

◆ SetColor() [4/4]

void TRIANGLE::SetColor ( unsigned int  aVertex1ColorRGBA,
unsigned int  aVertex2ColorRGBA,
unsigned int  aVertex3ColorRGBA 
)

Definition at line 182 of file triangle_3d.cpp.

References m_vertexColorRGBA.

◆ SetMaterial()

◆ SetModelTransparency()

void OBJECT_3D::SetModelTransparency ( float  aModelTransparency)
inlineinherited

Definition at line 66 of file object_3d.h.

References OBJECT_3D::m_modelTransparency.

Referenced by RENDER_3D_RAYTRACE_BASE::addModels().

◆ SetUV()

void TRIANGLE::SetUV ( const SFVEC2F aUV1,
const SFVEC2F aUV2,
const SFVEC2F aUV3 
)

Definition at line 191 of file triangle_3d.cpp.

References m_uv.

Member Data Documentation

◆ m_bbox

◆ m_bnu

float TRIANGLE::m_bnu
private

Definition at line 79 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_bnv

float TRIANGLE::m_bnv
private

Definition at line 79 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_boardItem

BOARD_ITEM* OBJECT_3D::m_boardItem
protectedinherited

◆ m_centroid

◆ m_cnu

float TRIANGLE::m_cnu
private

Definition at line 80 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_cnv

float TRIANGLE::m_cnv
private

Definition at line 80 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_k

unsigned int TRIANGLE::m_k
private

Definition at line 78 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_material

◆ m_modelTransparency

float OBJECT_3D::m_modelTransparency
protectedinherited

◆ m_n

SFVEC3F TRIANGLE::m_n
private

Definition at line 74 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_nd

float TRIANGLE::m_nd
private

Definition at line 77 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_normal

SFVEC3F TRIANGLE::m_normal[3]
private

Definition at line 72 of file triangle_3d.h.

Referenced by Intersect(), pre_calc_const(), and TRIANGLE().

◆ m_nu

float TRIANGLE::m_nu
private

Definition at line 77 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_nv

float TRIANGLE::m_nv
private

Definition at line 77 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), and pre_calc_const().

◆ m_obj_type

OBJECT_3D_TYPE OBJECT_3D::m_obj_type
protectedinherited

Definition at line 99 of file object_3d.h.

Referenced by OBJECT_3D::OBJECT_3D().

◆ m_uv

SFVEC2F TRIANGLE::m_uv[3]
private

Definition at line 75 of file triangle_3d.h.

Referenced by SetUV().

◆ m_vertex

SFVEC3F TRIANGLE::m_vertex[3]
private

Definition at line 73 of file triangle_3d.h.

Referenced by Intersect(), IntersectP(), pre_calc_const(), and TRIANGLE().

◆ m_vertexColorRGBA

unsigned int TRIANGLE::m_vertexColorRGBA[3]
private

Definition at line 76 of file triangle_3d.h.

Referenced by GetDiffuseColor(), SetColor(), and TRIANGLE().


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