DATAKIT SDK  V2026.1
Fill Classes Samples

Fill Topology classes

#include <map>
//DATAKIT headers needed
#include "datakit.h"
namespace sampleWriter
{
enum
{
Lump = 1,
Volume = 2,
Shell = 3,
Vertex_A = 9,
Vertex_B = 11,
Vertex_C = 17,
Vertex_D = 23,
Vertex_E = 37,
Vertex_F = 45,
Vertex_G = 63,
Vertex_H = 81,
Edge_AB = 14,
Edge_CA = 20,
Edge_DC = 26,
Edge_BD = 30,
Edge_EA = 40,
Edge_FB = 48,
Edge_FE = 52,
Edge_GD = 66,
Edge_GF = 70,
Edge_HC = 84,
Edge_HG = 88,
Edge_EH = 96,
Coedge1_AB = 42,
Coedge0_CA = 16,
Coedge5_CA = 112,
Coedge0_DC = 22,
Coedge3_DC = 78,
Coedge0_BD = 28,
Coedge2_BD = 60,
Coedge1_EA = 36,
Coedge5_EA = 114,
Coedge1_FB = 44,
Coedge2_FB = 58,
Coedge1_FE = 50,
Coedge2_GD = 62,
Coedge3_GD = 76,
Coedge4_FE = 98,
Coedge2_GF = 68,
Coedge4_GF = 100,
Coedge3_HC = 80,
Coedge5_HC = 110,
Coedge3_HG = 86,
Coedge4_HG = 102,
Coedge4_EH = 94,
Coedge5_EH = 108,
Loop1_ABFE = 35,
Loop2_FBDG = 57,
Loop3_GDCH = 75,
Loop4_EFGH = 93,
Loop5_EHCA = 107,
FaceABCD = 5,
FaceABFE = 33,
FaceFBDG = 55,
FaceGDCH = 73,
FaceEFGH = 91,
FaceEHCA = 105,
};
namespace
{
void CreateTopoVertex( std::map <Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_VertexPtr entity = NULL;
Dtk_PointPtr point = NULL;
/*Index 9 - Vertex_A*/
entity = Dtk_Vertex::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Vertex_A" );
point = Dtk_Point::Create( Dtk_pnt( 100.0, 0.0, 100.0 ) );
entity->SetGeom( point );
outArrayTopo[ Vertex_A ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 11 - Vertex_B*/
entity = Dtk_Vertex::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Vertex_B" );
point = Dtk_Point::Create( Dtk_pnt( 0.0, 0.0, 100.0 ) );
entity->SetGeom( point );
outArrayTopo[ Vertex_B ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 17 - Vertex_C */
entity = Dtk_Vertex::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Vertex_C" );
point = Dtk_Point::Create( Dtk_pnt( 100.0, 100.0, 100.0 ) );
entity->SetGeom( point );
outArrayTopo[ Vertex_C ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 23 - Vertex_D*/
entity = Dtk_Vertex::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Vertex_D" );
point = Dtk_Point::Create( Dtk_pnt( 0.0, 100.0, 100.0 ) );
entity->SetGeom( point );
outArrayTopo[ Vertex_D ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 37 - Vertex_E*/
entity = Dtk_Vertex::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Vertex_E" );
point = Dtk_Point::Create( Dtk_pnt( 100.0, 0.0, 0.0 ) );
entity->SetGeom( point );
outArrayTopo[ Vertex_E ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 45 - Vertex_F*/
entity = Dtk_Vertex::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Vertex_F" );
point = Dtk_Point::Create( Dtk_pnt( 0.0, 0.0, 0.0 ) );
entity->SetGeom( point );
outArrayTopo[ Vertex_F ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 63 - Vertex_G*/
entity = Dtk_Vertex::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Vertex_G" );
point = Dtk_Point::Create( Dtk_pnt( 0.0, 100.0, 0.0 ) );
entity->SetGeom( point );
outArrayTopo[ Vertex_G ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 81 - Vertex_H*/
entity = Dtk_Vertex::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Vertex_H" );
point = Dtk_Point::Create( Dtk_pnt( 100.0, 100.0, 0.0 ) );
entity->SetGeom( point );
outArrayTopo[ Vertex_H ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
void CreateTopoEdge( std::map<Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_EdgePtr entity = NULL;
Dtk_LinePtr line = NULL;
Dtk_CurvePtr curve = NULL;
Dtk_tab<Dtk_pnt> ControlPoints;
Dtk_VertexPtr start_vertex = NULL, end_vertex = NULL;
/*nurbs with 2 ControlPoints*/
ControlPoints.resize( 2 );
/*Index 14 - Edge_AB*/
entity = Dtk_Edge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Edge_AB" );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_A ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_B ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ Edge_AB ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 20 - Edge_CA*/
entity = Dtk_Edge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Edge_CA" );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_C ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_A ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ Edge_CA ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 26 - Edge_DC*/
entity = Dtk_Edge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Edge_DC" );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_D ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_C ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ Edge_DC ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 30 - Edge_BD*/
entity = Dtk_Edge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Edge_BD" );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_B ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_D ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ Edge_BD ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 40 - Edge_EA*/
entity = Dtk_Edge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Edge_EA" );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_E ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_A ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ Edge_EA ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 48 - Edge_FB*/
entity = Dtk_Edge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Edge_FB" );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_F ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_B ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ Edge_FB ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 52 - Edge_FE*/
entity = Dtk_Edge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Edge_FE" );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_F ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_E ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ Edge_FE ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 66 - Edge_GD*/
entity = Dtk_Edge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Edge_GD" );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_G ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_D ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ Edge_GD ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 70 - Edge_GF*/
entity = Dtk_Edge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Edge_GF" );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_G ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_F ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ Edge_GF ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 84 - Edge_HC*/
entity = Dtk_Edge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Edge_HC" );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_H ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_C ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ Edge_HC ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 88 - Edge_HG*/
entity = Dtk_Edge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Edge_HG" );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_H ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_G ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ Edge_HG ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 96 - Edge_EH*/
entity = Dtk_Edge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Edge_EH" );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_E ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ Vertex_H ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ Edge_EH ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
void CreateTopoCoEdge( std::map<Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_CoedgePtr entity = NULL;
Dtk_LinePtr line = NULL;
Dtk_CurvePtr curve = NULL;
Dtk_tab<Dtk_pnt> ControlPoints;
Dtk_EdgePtr edge = NULL;
/*nurbs with 2 ControlPoints*/
ControlPoints.resize( 2 );
/*Into the 0 loop*/
/*Index 8 - Coedge0_AB*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge0_AB" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_AB ] ) );
outArrayTopo[ Coedge0_AB ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 16 - Coedge0_CA*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge0_CA" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_CA ] ) );
outArrayTopo[ Coedge0_CA ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 22 - Coedge0_DC*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge0_CD" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_DC ] ) );
outArrayTopo[ Coedge0_DC ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 28 - Coedge0_BD*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge0_BD" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_BD ] ) );
outArrayTopo[ Coedge0_BD ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 1 loop*/
/*Index 36 - Coedge1_EA*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge1_EA" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_EA ] ) );
outArrayTopo[ Coedge1_EA ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 42 - Coedge1_AB*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge1_AB" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_AB ] ) );
outArrayTopo[ Coedge1_AB ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 44 - Coedge1_FB*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge1_FB" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_FB ] ) );
outArrayTopo[ Coedge1_FB ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 50 - Coedge1_FE*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge1_FE" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_FE ] ) );
outArrayTopo[ Coedge1_FE ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 2 loop*/
/*Index 58 - Coedge2_FB*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge2_FB" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_FB ] ) );
outArrayTopo[ Coedge2_FB ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 60 - Coedge2_BD*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge2_BD" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_BD ] ) );
outArrayTopo[ Coedge2_BD ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 62 - Coedge2_GD*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge2_GD" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_GD ] ) );
outArrayTopo[ Coedge2_GD ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 68 - Coedge2_GF*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge2_GF" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_GF ] ) );
outArrayTopo[ Coedge2_GF ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 3 loop*/
/*Index 76 - Coedge3_GD*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge3_GD" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_GD ] ) );
outArrayTopo[ Coedge3_GD ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 78 - Coedge3_DC*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge3_DC" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_DC ] ) );
outArrayTopo[ Coedge3_DC ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 80 - Coedge3_HC*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge3_HC" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_HC ] ) );
outArrayTopo[ Coedge3_HC ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 86 - Coedge3_HG*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge3_HG" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_HG ] ) );
outArrayTopo[ Coedge3_HG ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 4 loop*/
/*Index 94 - Coedge4_EH*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge4_EH" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_EH ] ) );
outArrayTopo[ Coedge4_EH ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 98 - Coedge4_FE*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge4_FE" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_FE ] ) );
outArrayTopo[ Coedge4_FE ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 100*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge4_GF" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_GF ] ) );
outArrayTopo[ Coedge4_GF ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 102 - Coedge4_HG*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge4_HG" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_HG ] ) );
outArrayTopo[ Coedge4_HG ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 5 loop*/
/*Index 108 - Coedge5_EH*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge5_EH" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_EH ] ) );
outArrayTopo[ Coedge5_EH ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 110*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge5_HC" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_HC ] ) );
outArrayTopo[ Coedge5_HC ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 112 - Coedge5_CA*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge5_CA" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_CA ] ) );
outArrayTopo[ Coedge5_CA ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 114 - Coedge5_EA*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Coedge5_EA" );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ Edge_EA ] ) );
outArrayTopo[ Coedge5_EA ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
void CreateTopoLoop( std::map<Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_LoopPtr entity = NULL;
Dtk_NurbsCurvePtr nurbs_curve = NULL;
Dtk_CurvePtr curve = NULL;
Dtk_tab<Dtk_pnt> ControlPoints;
Dtk_CoedgePtr edge = NULL;
/*nurbs with 2 ControlPoints*/
ControlPoints.resize( 2 );
/*Into the 0 Face*/
/*Index 7 - Loop0_ABCD*/
entity = Dtk_Loop::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Loop0_ABCD" );
entity->SetOuterInfo( DTK_TRUE );
entity->SetOrientation( DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge0_AB ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge0_CA ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge0_DC ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge0_BD ] ), DTK_FALSE );
outArrayTopo[ Loop0_ABCD ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 1 Face*/
/*Index 35 - Loop1_ABFE*/
entity = Dtk_Loop::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Loop1_ABFE" );
entity->SetOuterInfo( DTK_TRUE );
entity->SetOrientation( DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge1_EA ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge1_AB ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge1_FB ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge1_FE ] ), DTK_TRUE );
outArrayTopo[ Loop1_ABFE ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 2 Face*/
/*Index 57 - Loop2_FBDG*/
entity = Dtk_Loop::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Loop2_FBDG" );
entity->SetOuterInfo( DTK_TRUE );
entity->SetOrientation( DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge2_FB ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge2_BD ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge2_GD ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge2_GF ] ), DTK_TRUE );
outArrayTopo[ Loop2_FBDG ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 3 Face*/
/*Index 75 - Loop3_GDCH*/
entity = Dtk_Loop::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Loop3_GDCH" );
entity->SetOuterInfo( DTK_TRUE );
entity->SetOrientation( DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge3_GD ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge3_DC ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge3_HC ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge3_HG ] ), DTK_TRUE );
outArrayTopo[ Loop3_GDCH ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 4 Face*/
/*Index 93 - Loop4_EFGH*/
entity = Dtk_Loop::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Loop4_EFGH" );
entity->SetOuterInfo( DTK_TRUE );
entity->SetOrientation( DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge4_EH ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge4_FE ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge4_GF ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge4_HG ] ), DTK_FALSE );
outArrayTopo[ Loop4_EFGH ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 5 Face*/
/*Index 107 - Loop5_EHCA*/
entity = Dtk_Loop::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Loop5_EHCA" );
entity->SetOuterInfo( DTK_TRUE );
entity->SetOrientation( DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge5_EH ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge5_HC ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge5_CA ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ Coedge5_EA ] ), DTK_FALSE );
outArrayTopo[ Loop5_EHCA ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
void CreateTopoFace( std::map<Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_FacePtr entity = NULL;
Dtk_NurbsSurfacePtr nurbs_surface = NULL;
Dtk_SurfacePtr surface = NULL;
Dtk_UInt32 UDegree;
Dtk_UInt32 VDegree;
Dtk_tab<Dtk_tab<Dtk_pnt> > ControlPoints;
Dtk_tab<Dtk_UChar8> UKnotsMultiplicities;
Dtk_tab<Dtk_UChar8> VKnotsMultiplicities;
// Create Nurbs Surface
UDegree = 1;
UKnots.push_back( 0.0 );
UKnots.push_back( 1.0 );
UKnotsMultiplicities.push_back( 2 );
UKnotsMultiplicities.push_back( 2 );
VDegree = 1;
VKnots.push_back( 0.0 );
VKnots.push_back( 1.0 );
VKnotsMultiplicities.push_back( 2 );
VKnotsMultiplicities.push_back( 2 );
ControlPoints.resize( 2 );
ControlPoints[ 0 ].resize( 2 );
ControlPoints[ 1 ].resize( 2 );
Weights.resize( 2 );
Weights[ 0 ].resize( 2 );
Weights[ 1 ].resize( 2 );
Weights[ 0 ][ 0 ] = 1.0;
Weights[ 0 ][ 1 ] = 1.0;
Weights[ 1 ][ 0 ] = 1.0;
Weights[ 1 ][ 1 ] = 1.0;
/*nurbs with 2 ControlPoints*/
ControlPoints.resize( 2 );
/*0 Face*/
/*Index 5*/
entity = Dtk_Face::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"FaceABCD" );
entity->AddOuterLoop( Dtk_LoopPtr::DtkDynamicCast( outArrayTopo[ Loop0_ABCD ] ) );
ControlPoints[ 0 ][ 0 ] = Dtk_pnt( 0.0, 0.0, 100.0 );
ControlPoints[ 0 ][ 1 ] = Dtk_pnt( 0.0, 100.0, 100.0 );
ControlPoints[ 1 ][ 0 ] = Dtk_pnt( 100.0, 0.0, 100.0 );
ControlPoints[ 1 ][ 1 ] = Dtk_pnt( 100.0, 100.0, 100.0 );
nurbs_surface = Dtk_NurbsSurface::Create( UDegree, VDegree, UKnots, VKnots, UKnotsMultiplicities, VKnotsMultiplicities, ControlPoints, Weights );
surface = Dtk_SurfacePtr::DtkDynamicCast( nurbs_surface );
entity->SetGeom( surface );
entity->info() = Dtk_Info::create();
entity->info()->SetId( 200 );
entity->info()->SetColor( Dtk_RGB( 255, 0, 0 ) );
outArrayTopo[ FaceABCD ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 33*/
entity = Dtk_Face::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"FaceABFE" );
entity->AddOuterLoop( Dtk_LoopPtr::DtkDynamicCast( outArrayTopo[ Loop1_ABFE ] ) );
ControlPoints[ 0 ][ 0 ] = Dtk_pnt( 0.0, 0.0, 100.0 );
ControlPoints[ 0 ][ 1 ] = Dtk_pnt( 100.0, 0.0, 100.0 );
ControlPoints[ 1 ][ 0 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
ControlPoints[ 1 ][ 1 ] = Dtk_pnt( 100.0, 0.0, 0.0 );
nurbs_surface = Dtk_NurbsSurface::Create( UDegree, VDegree, UKnots, VKnots, UKnotsMultiplicities, VKnotsMultiplicities, ControlPoints, Weights );
surface = Dtk_SurfacePtr::DtkDynamicCast( nurbs_surface );
entity->SetGeom( surface );
entity->info() = Dtk_Info::create();
entity->info()->SetId( 201 );
entity->info()->SetColor( Dtk_RGB( 0, 255, 0 ) );
outArrayTopo[ FaceABFE ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 55*/
entity = Dtk_Face::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"FaceFBDG" );
entity->AddOuterLoop( Dtk_LoopPtr::DtkDynamicCast( outArrayTopo[ Loop2_FBDG ] ) );
ControlPoints[ 0 ][ 0 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
ControlPoints[ 0 ][ 1 ] = Dtk_pnt( 0.0, 100.0, 0.0 );
ControlPoints[ 1 ][ 0 ] = Dtk_pnt( 0.0, 0.0, 100.0 );
ControlPoints[ 1 ][ 1 ] = Dtk_pnt( 0.0, 100.0, 100.0 );
nurbs_surface = Dtk_NurbsSurface::Create( UDegree, VDegree, UKnots, VKnots, UKnotsMultiplicities, VKnotsMultiplicities, ControlPoints, Weights );
surface = Dtk_SurfacePtr::DtkDynamicCast( nurbs_surface );
entity->SetGeom( surface );
entity->info() = Dtk_Info::create();
entity->info()->SetId( 202 );
entity->info()->SetColor( Dtk_RGB( 0, 0, 255 ) );
outArrayTopo[ FaceFBDG ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 73*/
entity = Dtk_Face::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"FaceGDCH" );
entity->AddOuterLoop( Dtk_LoopPtr::DtkDynamicCast( outArrayTopo[ Loop3_GDCH ] ) );
ControlPoints[ 0 ][ 0 ] = Dtk_pnt( 0.0, 100.0, 0.0 );
ControlPoints[ 0 ][ 1 ] = Dtk_pnt( 100.0, 100.0, 0.0 );
ControlPoints[ 1 ][ 0 ] = Dtk_pnt( 0.0, 100.0, 100.0 );
ControlPoints[ 1 ][ 1 ] = Dtk_pnt( 100.0, 100.0, 100.0 );
nurbs_surface = Dtk_NurbsSurface::Create( UDegree, VDegree, UKnots, VKnots, UKnotsMultiplicities, VKnotsMultiplicities, ControlPoints, Weights );
surface = Dtk_SurfacePtr::DtkDynamicCast( nurbs_surface );
entity->SetGeom( surface );
entity->info() = Dtk_Info::create();
entity->info()->SetId( 203 );
entity->info()->SetColor( Dtk_RGB( 0, 255, 255 ) );
outArrayTopo[ FaceGDCH ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 91*/
entity = Dtk_Face::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"FaceEFGH" );
entity->AddOuterLoop( Dtk_LoopPtr::DtkDynamicCast( outArrayTopo[ Loop4_EFGH ] ) );
ControlPoints[ 0 ][ 0 ] = Dtk_pnt( 100.0, 0.0, 0.0 );
ControlPoints[ 0 ][ 1 ] = Dtk_pnt( 100.0, 100.0, 0.0 );
ControlPoints[ 1 ][ 0 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
ControlPoints[ 1 ][ 1 ] = Dtk_pnt( 0.0, 100.0, 0.0 );
nurbs_surface = Dtk_NurbsSurface::Create( UDegree, VDegree, UKnots, VKnots, UKnotsMultiplicities, VKnotsMultiplicities, ControlPoints, Weights );
surface = Dtk_SurfacePtr::DtkDynamicCast( nurbs_surface );
entity->SetGeom( surface );
entity->info() = Dtk_Info::create();
entity->info()->SetId( 204 );
entity->info()->SetColor( Dtk_RGB( 255, 255, 0 ) );
outArrayTopo[ FaceEFGH ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 105*/
entity = Dtk_Face::Create( inDtkBody );
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"FaceEHCA" );
entity->AddOuterLoop( Dtk_LoopPtr::DtkDynamicCast( outArrayTopo[ Loop5_EHCA ] ) );
ControlPoints[ 0 ][ 0 ] = Dtk_pnt( 100.0, 0.0, 100.0 );
ControlPoints[ 0 ][ 1 ] = Dtk_pnt( 100.0, 100.0, 100.0 );
ControlPoints[ 1 ][ 0 ] = Dtk_pnt( 100.0, 0.0, 0.0 );
ControlPoints[ 1 ][ 1 ] = Dtk_pnt( 100.0, 100.0, 0.0 );
nurbs_surface = Dtk_NurbsSurface::Create( UDegree, VDegree, UKnots, VKnots, UKnotsMultiplicities, VKnotsMultiplicities, ControlPoints, Weights );
surface = Dtk_SurfacePtr::DtkDynamicCast( nurbs_surface );
entity->SetGeom( surface );
entity->info() = Dtk_Info::create();
entity->info()->SetId( 205 );
outArrayTopo[ FaceEHCA ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
void CreateTopoShell( std::map<Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_ShellPtr entity = NULL;
/*Index 3*/
entity = Dtk_Shell::Create( inDtkBody );// create the Shell
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Shell" );
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ FaceABCD ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ FaceABFE ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ FaceFBDG ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ FaceGDCH ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ FaceEFGH ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ FaceEHCA ] ), DTK_TRUE );// add the Face into the Shell
outArrayTopo[ Shell ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
void CreateOpenShell( std::map<Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_ShellPtr entity = NULL;
/*Index 3*/
entity = Dtk_Shell::Create( inDtkBody );// create the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ FaceABCD ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ FaceABFE ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ FaceFBDG ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ FaceGDCH ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ FaceEFGH ] ), DTK_TRUE );// add the Face into the Shell
entity->SetClosedInfo( DTK_FALSE );
outArrayTopo[ Shell ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
void CreateTopoVolume( std::map<Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_VolumePtr entity = NULL;
/*Index 3*/
entity = Dtk_Volume::Create( inDtkBody );// create the Volume
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Volume" );
entity->AddOuterShell( Dtk_ShellPtr::DtkDynamicCast( outArrayTopo[ Shell ] ) );// add the Shell into the Volume.
outArrayTopo[ Volume ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
void CreateTopoLump( std::map<Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_LumpPtr entity = NULL;
/*Index 3*/
entity = Dtk_Lump::Create( inDtkBody );// create the Lump
entity->info() = Dtk_Info::create();
entity->info()->SetName( L"Lump" );
entity->AddVolume( Dtk_VolumePtr::DtkDynamicCast( outArrayTopo[ Volume ] ) );// add the Volume into the Lump.
outArrayTopo[ Lump ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
Dtk_VertexPtr MakeVertex( Dtk_BodyPtr& body, const Dtk_pnt& P )
{
vtx->SetGeom( Dtk_Point::Create( P ) );
return vtx;
}
Dtk_CurvePtr MakeSegment( const Dtk_pnt& P0, const Dtk_pnt& P1 )
{
Dtk_dir D = P1 - P0;
double nrm = norm( D );
D /= nrm;
Dtk_LinePtr line = Dtk_Line::Create( P0, D );
line->SetTrimmingParameters( 0, nrm );
}
Dtk_CurvePtr MakeSegment2D( double xmin, double ymin, double xmax, double ymax )
{
return MakeSegment( Dtk_pnt( xmin, ymin, 0 ), Dtk_pnt( xmax, ymax, 0 ) );
}
Dtk_CurvePtr MakeArc2D( const Dtk_pnt& P0, double radius, double from, double to )
{
Dtk_EllipsePtr circle = Dtk_Ellipse::Create( P0, Dtk_dir( 0, 0, 1 ), Dtk_dir( 1, 0, 0 ), radius );
circle->SetTrimmingParameters( from, to );
return Dtk_CurvePtr::DtkDynamicCast( circle );
}
Dtk_EdgePtr MakeEdge( Dtk_BodyPtr& body, const Dtk_VertexPtr& vstart, const Dtk_VertexPtr& vend, const Dtk_CurvePtr& curve3d, Dtk_ID id )
{
Dtk_EdgePtr edge = Dtk_Edge::Create( body );
edge->info() = Dtk_Info::create();
edge->info()->SetId( id + 10 );
edge->SetGeom( curve3d );
edge->SetStartVertex( vstart );
edge->SetEndVertex( vend );
return edge;
}
Dtk_SurfacePtr MakeCyl( const Dtk_pnt& O, double radius, double height )
{
Dtk_CylindricalSurfacePtr cyl = Dtk_CylindricalSurface::Create( O, Dtk_dir( 0, 0, 1 ), Dtk_dir( 1, 0, 0 ), radius );
double domain[ 4 ];
domain[ 0 ] = 0;
domain[ 1 ] = 2 * DTK_PI;
domain[ 2 ] = 0;
domain[ 3 ] = height;
cyl->SetTrimUVBox( domain );
}
Dtk_SurfacePtr MakePlane( const Dtk_pnt& O, const Dtk_pnt& N, double trim )
{
double domain[ 4 ];
domain[ 0 ] = -trim;
domain[ 1 ] = trim;
domain[ 2 ] = -trim;
domain[ 3 ] = trim;
plane->SetTrimUVBox( domain );
}
Dtk_FacePtr MakeOuterFace( Dtk_BodyPtr& body, const Dtk_SurfacePtr& surf, const Dtk_CoedgePtr& c0,
const Dtk_CoedgePtr& c1, const Dtk_CoedgePtr& c2, const Dtk_CoedgePtr& c3 )
{
Dtk_FacePtr face = Dtk_Face::Create( body );
face->SetGeom( surf );
Dtk_LoopPtr loop = Dtk_Loop::Create( body );
face->AddLoop( loop, DTK_TRUE );
if( c0.IsNotNULL() ) loop->AddCoedge( c0, DTK_TRUE );
if( c1.IsNotNULL() ) loop->AddCoedge( c1, DTK_TRUE );
if( c2.IsNotNULL() ) loop->AddCoedge( c2, DTK_TRUE );
if( c3.IsNotNULL() ) loop->AddCoedge( c3, DTK_TRUE );
return face;
}
Dtk_CoedgePtr MakeCoedge( Dtk_BodyPtr& body, const Dtk_EdgePtr edge, Dtk_bool sensedgeVScoedge, const Dtk_CurvePtr& curve2d )
{
coedge->SetGeom( curve2d );
coedge->SetEdge( edge );
coedge->SetOrientation( sensedgeVScoedge );
return coedge;
}
void FillInfos( Dtk_InfoPtr& inf, Dtk_ID id, const Dtk_RGB& color )
{
inf->SetId( id );
if( !( color == Dtk_RGB() ) )
inf->SetColor( color );
}
}
{
std::map<Dtk_ID, Dtk_EntityPtr> array_topo;
Dtk_BodyPtr body = Dtk_Body::Create(); // create the Body
body->info() = Dtk_Info::create();
body->info()->SetName( L"Body" );
Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of Body", L"Value of Body" );
Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
ArrayMetadataEntity.push_back( metadata );
body->info()->SetMetaData( ArrayMetadataEntity );
CreateTopoVertex( array_topo, body ); //create all Vertex
CreateTopoEdge( array_topo, body ); //create all Edge
CreateTopoCoEdge( array_topo, body );//create all Coedge
CreateTopoLoop( array_topo, body );//create all Loop
CreateTopoFace( array_topo, body );//create all Face
CreateTopoShell( array_topo, body );//create all Shell
CreateTopoVolume( array_topo, body );//create all Volume
CreateTopoLump( array_topo, body );//create all Lump
body->AddLump( Dtk_LumpPtr::DtkDynamicCast( array_topo[ Lump ] ) ); // add the Lump into the body.
return body;
}
{
Dtk_BodyPtr body = Dtk_Body::Create(); // create the Body
Dtk_CylindricalSurfacePtr cyl = Dtk_CylindricalSurface::Create( Dtk_pnt( 0.0, 0.0, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
Dtk_Double64 domain[] = { 0.0,3.14,-5.0,5.0 };
cyl->SetTrimUVBox( domain );
body->AddUnboundedFace( Dtk_SurfacePtr::DtkDynamicCast( cyl ) );
//For an open shell you can also create an OpenShell and call
//body->AddOpenShell(shell);
return body;
}
{
Dtk_BodyPtr mybody;
mybody = Dtk_Body::Create();
Dtk_ShellPtr myshell;
myshell = Dtk_Shell::Create( mybody );
Dtk_EllipsePtr myellipse;
//add circle curve
myellipse = Dtk_Ellipse::Create( Dtk_pnt( 0.0, 0.0, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
Dtk_CurvePtr mycurve;
mycurve = Dtk_CurvePtr::DtkDynamicCast( myellipse );
mycurve->info() = Dtk_Info::create();
mycurve->info()->SetColor( Dtk_RGB( 255, 0, 255 ) );
mycurve->info()->SetName( "mycircle" );
mycurves.push_back( mycurve );
//add ellipse curve
myellipse = Dtk_Ellipse::Create( Dtk_pnt( 0.0, 0.0, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0, 5.0 );
mycurve = Dtk_CurvePtr::DtkDynamicCast( myellipse );
mycurve->info() = Dtk_Info::create();
mycurve->info()->SetColor( Dtk_RGB( 255, 255, 0 ) );
mycurve->info()->SetName( "myellipse" );
mycurves.push_back( mycurve );
//add line curve
Dtk_LinePtr myline;
myline = Dtk_Line::Create( Dtk_pnt( -5.0, 0.0, 0.0 ), Dtk_pnt( 5.0, 0.0, 0.0 ) );
mycurve = Dtk_CurvePtr::DtkDynamicCast( myline );
mycurve->info() = Dtk_Info::create();
mycurve->info()->SetColor( Dtk_RGB( 0, 0, 255 ) );
mycurve->info()->SetName( "myline" );
mycurves.push_back( mycurve );
//add nurbs curve
//nurbs with 4 Control Points
//respect num_points = Knots.size() - Degree - 1;
Dtk_tab<Dtk_pnt> ControlPoints;
Dtk_Int32 Degree = 3;
ControlPoints.resize( 4 );
ControlPoints[ 0 ] = Dtk_pnt( -5.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( -2.0, 5.0, 0. );
ControlPoints[ 2 ] = Dtk_pnt( 2.0, -5.0, 0. );
ControlPoints[ 3 ] = Dtk_pnt( 5.0, 0.0, 0. );
Knots.resize( 8 );
Knots[ 0 ] = Knots[ 1 ] = Knots[ 2 ] = Knots[ 3 ] = 0.0;
Knots[ 4 ] = Knots[ 5 ] = Knots[ 6 ] = Knots[ 7 ] = 1.0;
Dtk_NurbsCurvePtr cnurbs = Dtk_NurbsCurve::Create( Degree, Knots, ControlPoints );
mycurve = Dtk_CurvePtr::DtkDynamicCast( cnurbs );
mycurve->info() = Dtk_Info::create();
mycurve->info()->SetColor( Dtk_RGB( 0, 255, 0 ) );
mycurve->info()->SetName( "mynurbs" );
mycurves.push_back( mycurve );
myshell->AddWire( mycurves );
mybody->AddWireShell( myshell );
Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of mycurve", L"Value of mycurve" );
Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
ArrayMetadataEntity.push_back( metadata );
mybody->info() = Dtk_Info::create();
mybody->info()->SetMetaData( ArrayMetadataEntity );
return mybody;
}
{
Dtk_BodyPtr mybody;
mybody = Dtk_Body::Create();
Dtk_ShellPtr myshell;
myshell = Dtk_Shell::Create( mybody );
Dtk_EllipsePtr ellipsethick = Dtk_Ellipse::Create( Dtk_pnt( 0.0, 0.0, 5.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
ellipsethick->info() = Dtk_Info::create();
ellipsethick->info()->SetColor( Dtk_RGB( 255, 0, 0 ) );
ellipsethick->info()->SetCurveThickNessInMM( 4 );
mycurves.push_back( Dtk_CurvePtr::DtkDynamicCast( ellipsethick ) );
Dtk_EllipsePtr ellipsedash = Dtk_Ellipse::Create( Dtk_pnt( 0.0, 0.0, 6.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
ellipsedash->info() = Dtk_Info::create();
ellipsedash->info()->SetColor( Dtk_RGB( 0, 0, 255 ) );
ellipsedash->info()->SetCurveLineType( DTK_DASHED );
mycurves.push_back( Dtk_CurvePtr::DtkDynamicCast( ellipsedash ) );
Dtk_EllipsePtr ellipsedotted = Dtk_Ellipse::Create( Dtk_pnt( 0.0, 0.0, 7.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
ellipsedotted->info() = Dtk_Info::create();
ellipsedotted->info()->SetColor( Dtk_RGB( 255, 0, 255 ) );
ellipsedotted->info()->SetCurveLineType( DTK_DOTTED );
ellipsedotted->info()->SetCurveThickNessInMM( 2 );
mycurves.push_back( Dtk_CurvePtr::DtkDynamicCast( ellipsedotted ) );
myshell->AddWire( mycurves );
mybody->AddWireShell( myshell );
mybody->info() = Dtk_Info::create();
return mybody;
}
{
Dtk_BodyPtr mybody;
mybody = Dtk_Body::Create();
Dtk_ShellPtr myshell;
myshell = Dtk_Shell::Create( mybody );
Dtk_PointPtr mypoint;
mypoint = Dtk_Point::Create( Dtk_pnt( -10.0, 11.0, 12.0 ) );
mypoint->info() = Dtk_Info::create();
mypoint->info()->SetColor( Dtk_RGB( 255, 0, 0 ) );
mypoint->info()->SetName( "mypoint" );
Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of mypoint", L"Value of mypoint" );
Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
ArrayMetadataEntity.push_back( metadata );
mypoint->info()->SetMetaData( ArrayMetadataEntity );
mypoints.push_back( mypoint );
myshell->AddWire( mypoints );
mybody->AddWireShell( myshell );
return mybody;
}
{
mybody->info() = Dtk_Info::create();
mybody->info()->SetInfiniteGeometryFlag( DTK_TRUE );
mybody->get_info()->SetRefEntityFlag( DTK_TRUE );
mybody->info()->SetColor( Dtk_RGB( 255, 0, 0, 255 ) );
mybody->info()->SetName( L"myplan" );
Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of myplan", L"Value of myplan" );
Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
ArrayMetadataEntity.push_back( metadata );
mybody->info()->SetMetaData( ArrayMetadataEntity );
Dtk_PlaneSurfacePtr plane = Dtk_PlaneSurface::Create( Dtk_pnt( -11, -12, -13 ), Dtk_dir( 0, 0, 1 ), Dtk_dir( 0, 1, 0 ) );
Dtk_Double64 dom[ 4 ];
dom[ 0 ] = 0.0;
dom[ 1 ] = 10.0;
dom[ 2 ] = 0.0;
dom[ 3 ] = 10.0;
plane->SetTrimUVBox( dom );
mybody->AddUnboundedFace( Dtk_SurfacePtr::DtkDynamicCast( plane ) );
return mybody;
}
{
Dtk_transfo dtk_transfo;
dtk_transfo.setXdir( 0.0, 0.0, 1.0 );
dtk_transfo.setYdir( -1.0, 0.0, 0.0 );
dtk_transfo.setZdir( 0.0, -1.0, 0.0 );
dtk_transfo.setOrigin( Dtk_pnt( -41, -42, -50 ) );
mycsystem->SetMatrix( dtk_transfo );
mycsystem->info() = Dtk_Info::create();
mycsystem->info()->SetName( L"mycsystem" );
mycsystem->info()->SetColor( Dtk_RGB( 255, 0, 0, 255 ) );
mycsystem->info()->SetLayer( 123 );
Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of mycsystem", L"Value of mycsystem" );
Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
ArrayMetadataEntity.push_back( metadata );
mycsystem->info()->SetMetaData( ArrayMetadataEntity );
//Uncomment to put the AxisSystem as Blanked
//mycsystem->info()->SetBlankedStatus(DTK_TRUE);
return mycsystem;
}
{
Dtk_ShellPtr shell = Dtk_Shell::Create( mybody );
mybody->info() = Dtk_Info::create();
mybody->get_info()->SetInfiniteGeometryFlag( DTK_TRUE );
mybody->get_info()->SetRefEntityFlag( DTK_TRUE );
Dtk_LinePtr lineptr = Dtk_Line::Create( Dtk_pnt( -41, -42, -50 ), Dtk_pnt( -51, -52, -50 ) );
lineptr->info() = Dtk_Info::create();
lineptr->info()->SetColor( Dtk_RGB( 0, 255, 25, 255 ) );
lineptr->info()->SetName( L"myaxe" );
Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of myaxe", L"Value of myaxe" );
Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
ArrayMetadataEntity.push_back( metadata );
lineptr->info()->SetMetaData( ArrayMetadataEntity );
CurveArray.push_back( Dtk_CurvePtr::DtkDynamicCast( lineptr ) );
shell->AddWire( CurveArray );
mybody->AddWireShell( shell );
return mybody;
}
{
Dtk_Size_t NbPoint = 2;
Dtk_Size_t NbLine = 2;
Dtk_Size_t Nbspline = 2;
Dtk_Size_t NbCircle = 2;
Dtk_Size_t NbArcCircle = 2;
Dtk_Size_t NbEllipse = 2;
Dtk_Size_t NbArcEllipse = 2;
for( Dtk_Size_t i = 0; i < NbPoint; i++ )
{
Dtk_PointPtr mypoint;
mypoint = Dtk_Point::Create( Dtk_pnt( -10.0 + 10 * i, 2.0, 12.0 ) );
mypoint->info() = Dtk_Info::create();
mypoint->info()->SetColor( Dtk_RGB( 255, 0, 0 ) );
Dtk_string name( L"mypoint" );
name.add_int( ( int )i );
mypoint->info()->SetName( name );
ArrayPoint.push_back( mypoint );
}
Dtk_tab<Dtk_LinePtr> arraylineptr;
for( Dtk_Size_t i = 0; i < NbLine; i++ )
{
Dtk_LinePtr line = Dtk_Line::Create( Dtk_pnt( -10.0 + 10 * i, 3, 10.0 ), Dtk_pnt( -10.0 + 10 * i, 9, 0.0 ) );
ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( line ) );
}
for( Dtk_Size_t i = 0; i < Nbspline; i++ )
{
//add nurbs curve
Dtk_EllipsePtr myellipse;
myellipse = Dtk_Ellipse::Create( Dtk_pnt( -10.0 + 10 * i, 15, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 4.0, 2.5 );
Dtk_NurbsCurvePtr nurbs = myellipse->ToNurbs();
ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( nurbs ) );
}
for( Dtk_Size_t i = 0; i < NbCircle; i++ )
{
//add nurbs curve
Dtk_EllipsePtr myellipse;
myellipse = Dtk_Ellipse::Create( Dtk_pnt( -10.0 + 10 * i, 22, 5.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 4.0 );
ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( myellipse ) );
}
for( Dtk_Size_t i = 0; i < NbArcCircle; i++ )
{
//add nurbs curve
Dtk_EllipsePtr myellipse;
myellipse = Dtk_Ellipse::Create( Dtk_pnt( -10.0 + 10 * i, 30, 5.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 3.0 );
myellipse->SetTrimmingParameters( 0.0, DTK_PI );
ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( myellipse ) );
}
for( Dtk_Size_t i = 0; i < NbEllipse; i++ )
{
Dtk_EllipsePtr myellipse;
myellipse = Dtk_Ellipse::Create( Dtk_pnt( -10.0 + 10 * i, 35, 3.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 3.0, 1.0 );
ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( myellipse ) );
}
for( Dtk_Size_t i = 0; i < NbArcEllipse; i++ )
{
Dtk_EllipsePtr myellipse;
myellipse = Dtk_Ellipse::Create( Dtk_pnt( -10.0 + 10 * i, 40, 2.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 3.0, 1.0 );
myellipse->SetTrimmingParameters( 0.0, DTK_PI );
ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( myellipse ) );
}
Dtk_BodyPtr mybody;
mybody = Dtk_Body::Create();
Dtk_ShellPtr myshell;
myshell = Dtk_Shell::Create( mybody );
myshell->AddWire( ArrayPoint );
myshell->AddWire( ArrayCurve );
mybody->AddWireShell( myshell );
mybody->info() = Dtk_Info::create();
mybody->info()->SetColor( Dtk_RGB( 255, 0, 0 ) );
mybody->info()->SetName( L"CreateEsquisse3D" );
Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of esquisse3d", L"Value of esquisse3d" );
Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
ArrayMetadataEntity.push_back( metadata );
mybody->info()->SetMetaData( ArrayMetadataEntity );
return mybody;
}
{
Dtk_PointPtr mypoint;
mypoint = Dtk_Point::Create( Dtk_pnt( 1.0, 2.0, 0.0 ) );
ArrayPoint.push_back( mypoint );
Dtk_LinePtr line = Dtk_Line::Create( Dtk_pnt( 0.000000, 0.0, 0.0 ), Dtk_pnt( 1.0, 0.0, 0.0 ) );
ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( line ) );
line = Dtk_Line::Create( Dtk_pnt( 1.0, 1.0, 0.0 ), Dtk_pnt( 0.0, 1.0, 0.0 ) );
ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( line ) );
Dtk_EllipsePtr myarccircle;
myarccircle = Dtk_Ellipse::Create( Dtk_pnt( 1.0, 0.5, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 0.5, 0.5 );
myarccircle->SetTrimmingParameters( -1.0 * DTK_PI / 2.0, DTK_PI / 2.0 );
ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( myarccircle ) );
myarccircle = Dtk_Ellipse::Create( Dtk_pnt( 0.0, 0.5, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 0.5, 0.5 );
myarccircle->SetTrimmingParameters( DTK_PI / 2.0, 3.0 * DTK_PI / 2.0 );
Dtk_NurbsCurvePtr nurbs = myarccircle->ToNurbs();
ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( nurbs ) );
Dtk_EllipsePtr mycircle;
mycircle = Dtk_Ellipse::Create( Dtk_pnt( -0.125, 0.5, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 0.25 );
ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( mycircle ) );
Dtk_EllipsePtr myellipse;
myellipse = Dtk_Ellipse::Create( Dtk_pnt( 0.5, 0.25, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 0.25, 0.1 );
ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( myellipse ) );
Dtk_EllipsePtr myarcellipse;
myarcellipse = Dtk_Ellipse::Create( Dtk_pnt( 0.5, 0.75, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 0.25, 0.1 );
myarcellipse->SetTrimmingParameters( -1.0 * DTK_PI / 2.0, DTK_PI / 2.0 );
ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( myarcellipse ) );
myarcellipse = Dtk_Ellipse::Create( Dtk_pnt( 0.5, 0.75, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 0.25, 0.1 );
myarcellipse->SetTrimmingParameters( DTK_PI / 2.0, 3.0 * DTK_PI / 2.0 );
ArrayCurve.push_back( Dtk_CurvePtr::DtkDynamicCast( myarcellipse ) );
Dtk_BodyPtr mybody;
mybody = Dtk_Body::Create();
Dtk_ShellPtr myshell;
myshell = Dtk_Shell::Create( mybody );
myshell->AddWire( ArrayPoint );
myshell->AddWire( ArrayCurve );
mybody->AddWireShell( myshell );
mybody->info() = Dtk_Info::create();
mybody->info()->SetColor( Dtk_RGB( 255, 0, 0 ) );
mybody->info()->SetName( L"CreateEsquisse2D" );
Dtk_transfo transfo;
transfo.setOrigin( -100.0, 0.0, 0.0 );
transfo.setScale( 10.0 );
mybody->Transform( transfo );
Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of esquisse2d", L"Value of esquisse2d" );
Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
ArrayMetadataEntity.push_back( metadata );
mybody->info()->SetMetaData( ArrayMetadataEntity );
return mybody;
}
Dtk_BodyPtr CreateCyl( double radius, double height )
{
Dtk_LumpPtr lump = Dtk_Lump::Create( body );
body->AddLump( lump );
lump->AddVolume( volume );
volume->AddOuterShell( shell );
Dtk_pnt P[ 4 ];
P[ 0 ] = Dtk_pnt( radius, 0, 0 );
P[ 1 ] = Dtk_pnt( radius, 0, height );
P[ 2 ] = Dtk_pnt( -radius, 0, height );
P[ 3 ] = Dtk_pnt( -radius, 0, 0 );
Dtk_VertexPtr v[ 4 ];
for( i = 0; i < 4; i++ )
v[ i ] = MakeVertex( body, P[ i ] );
Dtk_EdgePtr e[ 6 ];
e[ 0 ] = MakeEdge( body, v[ 0 ], v[ 1 ], MakeSegment( P[ 0 ], P[ 1 ] ), 1 );
e[ 1 ] = MakeEdge( body, v[ 2 ], v[ 3 ], MakeSegment( P[ 2 ], P[ 3 ] ), 2 );
e[ 2 ] = MakeEdge( body, v[ 3 ], v[ 0 ], MakeArc2D( Dtk_pnt(), radius, -DTK_PI, 0 ), 3 );
e[ 3 ] = MakeEdge( body, v[ 0 ], v[ 3 ], MakeArc2D( Dtk_pnt(), radius, 0, DTK_PI ), 4 );
e[ 4 ] = MakeEdge( body, v[ 2 ], v[ 1 ], MakeArc2D( Dtk_pnt( 0, 0, height ), radius, -DTK_PI, 0 ), 5 );
e[ 5 ] = MakeEdge( body, v[ 1 ], v[ 2 ], MakeArc2D( Dtk_pnt( 0, 0, height ), radius, 0, DTK_PI ), 6 );
Dtk_FacePtr half1 = MakeOuterFace( body, MakeCyl( Dtk_pnt(), radius, height ),
MakeCoedge( body, e[ 0 ], DTK_TRUE, MakeSegment2D( 0, 0, 0, height ) ),
MakeCoedge( body, e[ 4 ], DTK_FALSE, MakeSegment2D( 0, height, -DTK_PI, height ) ),
MakeCoedge( body, e[ 1 ], DTK_TRUE, MakeSegment2D( -DTK_PI, height, -DTK_PI, 0 ) ),
MakeCoedge( body, e[ 2 ], DTK_TRUE, MakeSegment2D( -DTK_PI, 0, 0, 0 ) )
);
shell->AddFace( half1, DTK_TRUE );
FillInfos( half1->info(), 1, Dtk_RGB() );
Dtk_FacePtr half2 = MakeOuterFace( body, MakeCyl( Dtk_pnt(), radius, height ),
MakeCoedge( body, e[ 3 ], DTK_TRUE, MakeSegment2D( 0, 0, DTK_PI, 0 ) ),
MakeCoedge( body, e[ 1 ], DTK_FALSE, MakeSegment2D( DTK_PI, 0, DTK_PI, height ) ),
MakeCoedge( body, e[ 5 ], DTK_FALSE, MakeSegment2D( DTK_PI, height, 0, height ) ),
MakeCoedge( body, e[ 0 ], DTK_FALSE, MakeSegment2D( 0, height, 0, 0 ) )
);
shell->AddFace( half2, DTK_TRUE );
FillInfos( half2->info(), 2, Dtk_RGB() );
Dtk_FacePtr plandown = MakeOuterFace( body, MakePlane( Dtk_pnt(), Dtk_dir( 0, 0, -1 ), radius ),
MakeCoedge( body, e[ 2 ], DTK_FALSE, MakeArc2D( Dtk_pnt(), radius, 0, DTK_PI ) ),
MakeCoedge( body, e[ 3 ], DTK_FALSE, MakeArc2D( Dtk_pnt(), radius, DTK_PI, 2 * DTK_PI ) ),
NULL, NULL
);
shell->AddFace( plandown, DTK_TRUE );
FillInfos( plandown->info(), 3, Dtk_RGB() );
Dtk_FacePtr planup = MakeOuterFace( body, MakePlane( Dtk_pnt( 0, 0, height ), Dtk_dir( 0, 0, 1 ), radius ),
MakeCoedge( body, e[ 4 ], DTK_TRUE, MakeArc2D( Dtk_pnt(), radius, -DTK_PI, 0 ) ),
MakeCoedge( body, e[ 5 ], DTK_TRUE, MakeArc2D( Dtk_pnt(), radius, 0, DTK_PI ) ),
NULL, NULL
);
shell->AddFace( planup, DTK_TRUE );
FillInfos( planup->info(), 4, Dtk_RGB( 0, 255, 0 ) );
body->info() = Dtk_Info::create();
return body;
}
//Create MixedBodyWith solid and free surface
{
Dtk_CylindricalSurfacePtr cyl = Dtk_CylindricalSurface::Create( Dtk_pnt( -20.0, -20.0, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
Dtk_Double64 domain[] = { 0.0,6.0,0.0,100.0 };
cyl->SetTrimUVBox( domain );
cyl->info() = Dtk_Info::create();
cyl->info()->SetColor( Dtk_RGB( 255, 0, 0 ) );
body->AddUnboundedFace( Dtk_SurfacePtr::DtkDynamicCast( cyl ) );
cyl = Dtk_CylindricalSurface::Create( Dtk_pnt( -20.0, 20.0, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
Dtk_Double64 domain2[] = { 0.0,3.14,-50.0,50.0 };
cyl->SetTrimUVBox( domain2 );
cyl->info() = Dtk_Info::create();
cyl->info()->SetColor( Dtk_RGB( 0, 255, 0 ) );
body->AddUnboundedFace( Dtk_SurfacePtr::DtkDynamicCast( cyl ) );
return body;
}
}
//DATAKIT headers needed
#include "datakit.h"
#include <map>
namespace sampleWriter
{
/******************************************/
/****
TestCreateCylFdt :
This source gathers creation of data used to be written to STEP :
called by TestLibStepWrite.cpp
- creation of a cube, duplicated from TestCreateCube but with additional attributes
- creation of cylinder and its tessellation
- creation of FDT ( a Datum, a Dimension for the assembly),
- ..
****/
/****
Creation of topological data : a Body and its content
Here, a cube
With additional data to
- see attachment of ATTRIBUTES at level of the whole Body or of a given item (here, faces)
- in particular, see attachment of VALIDATION PROPERTIES
- see ID, an information required to attach other data like FDT
ORIGINAL CREATION OF A CUBE is in another sample source : TestCreateCube.cpp
Here, the duplicate version adds some specifics : attributes on the cube or some of its faces
So the names of functions defined by TestCreateCube are here renamed in _2
****/
namespace
{
void CreateTopoVertex_2( std::map <Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_VertexPtr entity = NULL;
Dtk_PointPtr point = NULL;
/*Index 9*/
entity = Dtk_Vertex::Create( inDtkBody );
point = Dtk_Point::Create( Dtk_pnt( 100.0, 0.0, 100.0 ) );
entity->SetGeom( point );
outArrayTopo[ 9 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 11*/
entity = Dtk_Vertex::Create( inDtkBody );
point = Dtk_Point::Create( Dtk_pnt( 0.0, 0.0, 100.0 ) );
entity->SetGeom( point );
outArrayTopo[ 11 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 17*/
entity = Dtk_Vertex::Create( inDtkBody );
point = Dtk_Point::Create( Dtk_pnt( 100.0, 100.0, 100.0 ) );
entity->SetGeom( point );
outArrayTopo[ 17 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 23*/
entity = Dtk_Vertex::Create( inDtkBody );
point = Dtk_Point::Create( Dtk_pnt( 0.0, 100.0, 100.0 ) );
entity->SetGeom( point );
outArrayTopo[ 23 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 37*/
entity = Dtk_Vertex::Create( inDtkBody );
point = Dtk_Point::Create( Dtk_pnt( 100.0, 0.0, 0.0 ) );
entity->SetGeom( point );
outArrayTopo[ 37 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 45*/
entity = Dtk_Vertex::Create( inDtkBody );
point = Dtk_Point::Create( Dtk_pnt( 0.0, 0.0, 0.0 ) );
entity->SetGeom( point );
outArrayTopo[ 45 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 63*/
entity = Dtk_Vertex::Create( inDtkBody );
point = Dtk_Point::Create( Dtk_pnt( 0.0, 100.0, 0.0 ) );
entity->SetGeom( point );
outArrayTopo[ 63 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 81*/
entity = Dtk_Vertex::Create( inDtkBody );
point = Dtk_Point::Create( Dtk_pnt( 100.0, 100.0, 0.0 ) );
entity->SetGeom( point );
outArrayTopo[ 81 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
void CreateTopoEdge_2( std::map<Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_EdgePtr entity = NULL;
Dtk_LinePtr line = NULL;
Dtk_CurvePtr curve = NULL;
Dtk_tab<Dtk_pnt> ControlPoints;
Dtk_VertexPtr start_vertex = NULL, end_vertex = NULL;
/*nurbs with 2 ControlPoints*/
ControlPoints.resize( 2 );
/*Index 14*/
entity = Dtk_Edge::Create( inDtkBody );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 9 ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 11 ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ 14 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 20*/
entity = Dtk_Edge::Create( inDtkBody );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 17 ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 9 ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ 20 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 26*/
entity = Dtk_Edge::Create( inDtkBody );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 23 ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 17 ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ 26 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 30*/
entity = Dtk_Edge::Create( inDtkBody );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 11 ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 23 ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ 30 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 40*/
entity = Dtk_Edge::Create( inDtkBody );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 37 ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 9 ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ 40 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 48*/
entity = Dtk_Edge::Create( inDtkBody );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 45 ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 11 ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ 48 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 52*/
entity = Dtk_Edge::Create( inDtkBody );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 45 ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 37 ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ 52 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 66*/
entity = Dtk_Edge::Create( inDtkBody );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 63 ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 23 ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ 66 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 70*/
entity = Dtk_Edge::Create( inDtkBody );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 63 ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 45 ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ 70 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 84*/
entity = Dtk_Edge::Create( inDtkBody );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 81 ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 17 ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ 84 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 88*/
entity = Dtk_Edge::Create( inDtkBody );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 81 ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 63 ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ 88 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 96*/
entity = Dtk_Edge::Create( inDtkBody );
start_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 37 ] );
start_vertex->GetGeom()->GetCoordinates( ControlPoints[ 0 ] );
entity->SetStartVertex( Dtk_VertexPtr::DtkDynamicCast( start_vertex ) );
end_vertex = Dtk_VertexPtr::DtkDynamicCast( outArrayTopo[ 81 ] );
end_vertex->GetGeom()->GetCoordinates( ControlPoints[ 1 ] );
entity->SetEndVertex( Dtk_VertexPtr::DtkDynamicCast( end_vertex ) );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
outArrayTopo[ 96 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
void CreateTopoCoEdge_2( std::map<Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_CoedgePtr entity = NULL;
Dtk_LinePtr line = NULL;
Dtk_CurvePtr curve = NULL;
Dtk_tab<Dtk_pnt> ControlPoints;
Dtk_EdgePtr edge = NULL;
/*nurbs with 2 ControlPoints*/
ControlPoints.resize( 2 );
/*Into the 0 loop*/
/*Index 8*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 14 ] ) );
outArrayTopo[ 8 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 16*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 20 ] ) );
outArrayTopo[ 16 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 22*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 26 ] ) );
outArrayTopo[ 22 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 28*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 30 ] ) );
outArrayTopo[ 28 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 1 loop*/
/*Index 36*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 40 ] ) );
outArrayTopo[ 36 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 42*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 14 ] ) );
outArrayTopo[ 42 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 44*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 48 ] ) );
outArrayTopo[ 44 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 50*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 52 ] ) );
outArrayTopo[ 50 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 2 loop*/
/*Index 58*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 48 ] ) );
outArrayTopo[ 58 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 60*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 30 ] ) );
outArrayTopo[ 60 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 62*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 66 ] ) );
outArrayTopo[ 62 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 68*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 70 ] ) );
outArrayTopo[ 68 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 3 loop*/
/*Index 76*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 66 ] ) );
outArrayTopo[ 76 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 78*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 26 ] ) );
outArrayTopo[ 78 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 80*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 84 ] ) );
outArrayTopo[ 80 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 86*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 88 ] ) );
outArrayTopo[ 86 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 4 loop*/
/*Index 94*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 96 ] ) );
outArrayTopo[ 94 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 98*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 52 ] ) );
outArrayTopo[ 98 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 100*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 70 ] ) );
outArrayTopo[ 100 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 102*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 88 ] ) );
outArrayTopo[ 102 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 5 loop*/
/*Index 108*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 96 ] ) );
outArrayTopo[ 108 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 110*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 84 ] ) );
outArrayTopo[ 110 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 112*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 0.0, 1.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 20 ] ) );
outArrayTopo[ 112 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 114*/
entity = Dtk_Coedge::Create( inDtkBody );
entity->SetOrientation( DTK_TRUE );
ControlPoints[ 0 ] = Dtk_pnt( 1.0, 0.0, 0.0 );
ControlPoints[ 1 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
line = Dtk_Line::Create( ControlPoints[ 0 ], ControlPoints[ 1 ] );
entity->SetGeom( curve );
entity->SetEdge( Dtk_EdgePtr::DtkDynamicCast( outArrayTopo[ 40 ] ) );
outArrayTopo[ 114 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
void CreateTopoLoop_2( std::map<Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_LoopPtr entity = NULL;
Dtk_NurbsCurvePtr nurbs_curve = NULL;
Dtk_CurvePtr curve = NULL;
Dtk_tab<Dtk_pnt> ControlPoints;
Dtk_CoedgePtr edge = NULL;
/*nurbs with 2 ControlPoints*/
ControlPoints.resize( 2 );
/*Into the 0 Face*/
/*Index 7*/
entity = Dtk_Loop::Create( inDtkBody );
entity->SetOuterInfo( DTK_TRUE );
entity->SetOrientation( DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 8 ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 16 ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 22 ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 28 ] ), DTK_FALSE );
outArrayTopo[ 7 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 1 Face*/
/*Index 35*/
entity = Dtk_Loop::Create( inDtkBody );
entity->SetOuterInfo( DTK_TRUE );
entity->SetOrientation( DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 36 ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 42 ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 44 ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 50 ] ), DTK_TRUE );
outArrayTopo[ 35 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 2 Face*/
/*Index 57*/
entity = Dtk_Loop::Create( inDtkBody );
entity->SetOuterInfo( DTK_TRUE );
entity->SetOrientation( DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 58 ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 60 ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 62 ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 68 ] ), DTK_TRUE );
outArrayTopo[ 57 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 3 Face*/
/*Index 75*/
entity = Dtk_Loop::Create( inDtkBody );
entity->SetOuterInfo( DTK_TRUE );
entity->SetOrientation( DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 76 ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 78 ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 80 ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 86 ] ), DTK_TRUE );
outArrayTopo[ 75 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 4 Face*/
/*Index 93*/
entity = Dtk_Loop::Create( inDtkBody );
entity->SetOuterInfo( DTK_TRUE );
entity->SetOrientation( DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 94 ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 98 ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 100 ] ), DTK_FALSE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 102 ] ), DTK_FALSE );
outArrayTopo[ 93 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Into the 5 Face*/
/*Index 107*/
entity = Dtk_Loop::Create( inDtkBody );
entity->SetOuterInfo( DTK_TRUE );
entity->SetOrientation( DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 108 ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 110 ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 112 ] ), DTK_TRUE );
entity->AddCoedge( Dtk_CoedgePtr::DtkDynamicCast( outArrayTopo[ 114 ] ), DTK_FALSE );
outArrayTopo[ 107 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
// For use by FDT, a unique ID must be attached to each entity
void SetTopoFaceID( const Dtk_FacePtr& face, const Dtk_ID id )
{
Dtk_InfoPtr& face_info = face->info();
if( face_info.IsNULL() ) face_info = Dtk_Info::create();
face_info->SetId( id );
}
void CreateTopoFace_2( std::map<Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_FacePtr entity = NULL;
Dtk_NurbsSurfacePtr nurbs_surface = NULL;
Dtk_SurfacePtr surface = NULL;
Dtk_UInt32 UDegree;
Dtk_UInt32 VDegree;
Dtk_tab<Dtk_tab<Dtk_pnt> > ControlPoints;
Dtk_tab<Dtk_UChar8> UKnotsMultiplicities;
Dtk_tab<Dtk_UChar8> VKnotsMultiplicities;
// Create Nurbs Surface
UDegree = 1;
UKnots.push_back( 0.0 );
UKnots.push_back( 1.0 );
UKnotsMultiplicities.push_back( 2 );
UKnotsMultiplicities.push_back( 2 );
VDegree = 1;
VKnots.push_back( 0.0 );
VKnots.push_back( 1.0 );
VKnotsMultiplicities.push_back( 2 );
VKnotsMultiplicities.push_back( 2 );
ControlPoints.resize( 2 );
ControlPoints[ 0 ].resize( 2 );
ControlPoints[ 1 ].resize( 2 );
Weights.resize( 2 );
Weights[ 0 ].resize( 2 );
Weights[ 1 ].resize( 2 );
Weights[ 0 ][ 0 ] = 1.0;
Weights[ 0 ][ 1 ] = 1.0;
Weights[ 1 ][ 0 ] = 1.0;
Weights[ 1 ][ 1 ] = 1.0;
/*nurbs with 2 ControlPoints*/
ControlPoints.resize( 2 );
/*0 Face*/
/*Index 5*/
entity = Dtk_Face::Create( inDtkBody );
SetTopoFaceID( entity, 5 );
entity->AddOuterLoop( Dtk_LoopPtr::DtkDynamicCast( outArrayTopo[ 7 ] ) );
ControlPoints[ 0 ][ 0 ] = Dtk_pnt( 0.0, 0.0, 100.0 );
ControlPoints[ 0 ][ 1 ] = Dtk_pnt( 0.0, 100.0, 100.0 );
ControlPoints[ 1 ][ 0 ] = Dtk_pnt( 100.0, 0.0, 100.0 );
ControlPoints[ 1 ][ 1 ] = Dtk_pnt( 100.0, 100.0, 100.0 );
nurbs_surface = Dtk_NurbsSurface::Create( UDegree, VDegree, UKnots, VKnots, UKnotsMultiplicities, VKnotsMultiplicities, ControlPoints, Weights );
surface = Dtk_SurfacePtr::DtkDynamicCast( nurbs_surface );
entity->SetGeom( surface );
outArrayTopo[ 5 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 33*/
entity = Dtk_Face::Create( inDtkBody );
SetTopoFaceID( entity, 33 );
entity->AddOuterLoop( Dtk_LoopPtr::DtkDynamicCast( outArrayTopo[ 35 ] ) );
ControlPoints[ 0 ][ 0 ] = Dtk_pnt( 0.0, 0.0, 100.0 );
ControlPoints[ 0 ][ 1 ] = Dtk_pnt( 100.0, 0.0, 100.0 );
ControlPoints[ 1 ][ 0 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
ControlPoints[ 1 ][ 1 ] = Dtk_pnt( 100.0, 0.0, 0.0 );
nurbs_surface = Dtk_NurbsSurface::Create( UDegree, VDegree, UKnots, VKnots, UKnotsMultiplicities, VKnotsMultiplicities, ControlPoints, Weights );
surface = Dtk_SurfacePtr::DtkDynamicCast( nurbs_surface );
entity->SetGeom( surface );
outArrayTopo[ 33 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 55*/
entity = Dtk_Face::Create( inDtkBody );
SetTopoFaceID( entity, 55 );
entity->AddOuterLoop( Dtk_LoopPtr::DtkDynamicCast( outArrayTopo[ 57 ] ) );
ControlPoints[ 0 ][ 0 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
ControlPoints[ 0 ][ 1 ] = Dtk_pnt( 0.0, 100.0, 0.0 );
ControlPoints[ 1 ][ 0 ] = Dtk_pnt( 0.0, 0.0, 100.0 );
ControlPoints[ 1 ][ 1 ] = Dtk_pnt( 0.0, 100.0, 100.0 );
nurbs_surface = Dtk_NurbsSurface::Create( UDegree, VDegree, UKnots, VKnots, UKnotsMultiplicities, VKnotsMultiplicities, ControlPoints, Weights );
surface = Dtk_SurfacePtr::DtkDynamicCast( nurbs_surface );
entity->SetGeom( surface );
outArrayTopo[ 55 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 73*/
entity = Dtk_Face::Create( inDtkBody );
SetTopoFaceID( entity, 73 );
entity->AddOuterLoop( Dtk_LoopPtr::DtkDynamicCast( outArrayTopo[ 75 ] ) );
ControlPoints[ 0 ][ 0 ] = Dtk_pnt( 0.0, 100.0, 0.0 );
ControlPoints[ 0 ][ 1 ] = Dtk_pnt( 100.0, 100.0, 0.0 );
ControlPoints[ 1 ][ 0 ] = Dtk_pnt( 0.0, 100.0, 100.0 );
ControlPoints[ 1 ][ 1 ] = Dtk_pnt( 100.0, 100.0, 100.0 );
nurbs_surface = Dtk_NurbsSurface::Create( UDegree, VDegree, UKnots, VKnots, UKnotsMultiplicities, VKnotsMultiplicities, ControlPoints, Weights );
surface = Dtk_SurfacePtr::DtkDynamicCast( nurbs_surface );
entity->SetGeom( surface );
outArrayTopo[ 73 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 91*/
entity = Dtk_Face::Create( inDtkBody );
SetTopoFaceID( entity, 91 );
entity->AddOuterLoop( Dtk_LoopPtr::DtkDynamicCast( outArrayTopo[ 93 ] ) );
ControlPoints[ 0 ][ 0 ] = Dtk_pnt( 100.0, 0.0, 0.0 );
ControlPoints[ 0 ][ 1 ] = Dtk_pnt( 100.0, 100.0, 0.0 );
ControlPoints[ 1 ][ 0 ] = Dtk_pnt( 0.0, 0.0, 0.0 );
ControlPoints[ 1 ][ 1 ] = Dtk_pnt( 0.0, 100.0, 0.0 );
nurbs_surface = Dtk_NurbsSurface::Create( UDegree, VDegree, UKnots, VKnots, UKnotsMultiplicities, VKnotsMultiplicities, ControlPoints, Weights );
surface = Dtk_SurfacePtr::DtkDynamicCast( nurbs_surface );
entity->SetGeom( surface );
outArrayTopo[ 91 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
/*Index 105*/
entity = Dtk_Face::Create( inDtkBody );
SetTopoFaceID( entity, 105 );
entity->AddOuterLoop( Dtk_LoopPtr::DtkDynamicCast( outArrayTopo[ 107 ] ) );
ControlPoints[ 0 ][ 0 ] = Dtk_pnt( 100.0, 0.0, 100.0 );
ControlPoints[ 0 ][ 1 ] = Dtk_pnt( 100.0, 100.0, 100.0 );
ControlPoints[ 1 ][ 0 ] = Dtk_pnt( 100.0, 0.0, 0.0 );
ControlPoints[ 1 ][ 1 ] = Dtk_pnt( 100.0, 100.0, 0.0 );
nurbs_surface = Dtk_NurbsSurface::Create( UDegree, VDegree, UKnots, VKnots, UKnotsMultiplicities, VKnotsMultiplicities, ControlPoints, Weights );
surface = Dtk_SurfacePtr::DtkDynamicCast( nurbs_surface );
entity->SetGeom( surface );
outArrayTopo[ 105 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
// test : properties on a face
Dtk_InfoPtr& face_info = entity->info();
if( face_info.IsNULL() ) face_info = Dtk_Info::create();
Dtk_Val valprop_area( "Anodize per specification MIL-A-8625, Type I" );
face_info->AddAttribute( "user defined attribute : : Surface Finish", valprop_area );
}
void CreateTopoShell_2( std::map<Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_ShellPtr entity = NULL;
/*Index 3*/
entity = Dtk_Shell::Create( inDtkBody );// create the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ 5 ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ 33 ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ 55 ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ 73 ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ 91 ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ 105 ] ), DTK_TRUE );// add the Face into the Shell
/*
Dtk_InfoPtr& shell_info = entity->info();
if (shell_info.IsNULL()) shell_info = Dtk_Info::create();
Dtk_Val valprop_area("60000 mm2");
shell_info->AddAttribute("geometric validation property : area : surface area measure",valprop_area);
*/
outArrayTopo[ 3 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
void CreateOpenShell_2( std::map<Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_ShellPtr entity = NULL;
/*Index 3*/
entity = Dtk_Shell::Create( inDtkBody );// create the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ 5 ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ 33 ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ 55 ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ 73 ] ), DTK_TRUE );// add the Face into the Shell
entity->AddFace( Dtk_FacePtr::DtkDynamicCast( outArrayTopo[ 91 ] ), DTK_TRUE );// add the Face into the Shell
entity->SetClosedInfo( DTK_FALSE );
// test : properties on an open shell
Dtk_InfoPtr& shell_info = entity->info();
if( shell_info.IsNULL() ) shell_info = Dtk_Info::create();
/*
Dtk_Val valprop_area("60000 mm2");
shell_info->AddAttribute("geometric validation property : area : surface area measure",valprop_area);
*/
outArrayTopo[ 3 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
void CreateTopoVolume_2( std::map<Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_VolumePtr entity = NULL;
/*Index 3*/
entity = Dtk_Volume::Create( inDtkBody );// create the Volume
entity->AddOuterShell( Dtk_ShellPtr::DtkDynamicCast( outArrayTopo[ 3 ] ) );// add the Shell into the Volume.
// test : properties on a solid : on the Dtk_Volume
Dtk_InfoPtr& volume_info = entity->info();
if( volume_info.IsNULL() ) volume_info = Dtk_Info::create();
volume_info->SetId( 3 );
Dtk_Val valprop_area( "60000 mm2" );
volume_info->AddAttribute( "geometric validation property : : surface area measure", valprop_area );
Dtk_Val valprop_volume( "10000 mm3" );
volume_info->AddAttribute( "geometric validation property : : volume measure", valprop_volume );
Dtk_Val valprop_CG( Dtk_pnt( 50., 50., 50. ) );
volume_info->AddAttribute( "geometric validation property : : centre point", valprop_CG );
outArrayTopo[ 2 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
void CreateTopoLump_2( std::map<Dtk_ID, Dtk_EntityPtr>& outArrayTopo, const Dtk_BodyPtr& inDtkBody )
{
Dtk_LumpPtr entity = NULL;
/*Index 3*/
entity = Dtk_Lump::Create( inDtkBody );// create the Lump
entity->AddVolume( Dtk_VolumePtr::DtkDynamicCast( outArrayTopo[ 2 ] ) );// add the Volume into the Lump.
outArrayTopo[ 1 ] = Dtk_EntityPtr::DtkDynamicCast( entity );
}
}
{
std::map<Dtk_ID, Dtk_EntityPtr> array_topo;
Dtk_BodyPtr body = Dtk_Body::Create(); // create the Body
CreateTopoVertex_2( array_topo, body ); //create all Vertex
CreateTopoEdge_2( array_topo, body ); //create all Edge
CreateTopoCoEdge_2( array_topo, body );//create all Coedge
CreateTopoLoop_2( array_topo, body );//create all Loop
CreateTopoFace_2( array_topo, body );//create all Face
CreateTopoShell_2( array_topo, body );//create all Shell
CreateTopoVolume_2( array_topo, body );//create all Volume
CreateTopoLump_2( array_topo, body );//create all Lump
body->AddLump( Dtk_LumpPtr::DtkDynamicCast( array_topo[ 1 ] ) ); // add the Lump into the body.
// V78 : val prop sur Body : IGNORED
Dtk_InfoPtr& body_info = body->info();
if( body_info.IsNULL() ) body_info = Dtk_Info::create();
Dtk_Val valprop_area( "1234 mm2" );
body_info->AddAttribute( "geometric validation property : : surface area measure", valprop_area );
Dtk_Val valprop_volume( "5678 mm3" );
body_info->AddAttribute( "geometric validation property : : volume measure", valprop_volume );
Dtk_Val valprop_CG( Dtk_pnt( 12., 34., 56. ) );
body_info->AddAttribute( "geometric validation property : : centre point", valprop_CG );
return body;
}
{
Dtk_BodyPtr body = Dtk_Body::Create(); // create the Body
Dtk_CylindricalSurfacePtr cyl = Dtk_CylindricalSurface::Create( Dtk_pnt( 0.0, 0.0, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
Dtk_Double64 domain[] = { 0.0,3.14,-5.0,5.0 };
cyl->SetTrimUVBox( domain );
body->AddUnboundedFace( Dtk_SurfacePtr::DtkDynamicCast( cyl ) );
//For an open shell you can also create an OpenShell and call
//body->AddOpenShell(shell);
return body;
}
{
Dtk_BodyPtr mysbody;
mysbody = Dtk_Body::Create();
Dtk_ShellPtr myshell;
myshell = Dtk_Shell::Create( mysbody );
Dtk_EllipsePtr myellipse;
myellipse = Dtk_Ellipse::Create( Dtk_pnt( 0.0, 0.0, 0.0 ), Dtk_dir( 0.0, 0.0, 1.0 ), Dtk_dir( 1.0, 0.0, 0.0 ), 10.0 );
Dtk_CurvePtr mycurve;
mycurve = Dtk_CurvePtr::DtkDynamicCast( myellipse );
mycurve->info() = Dtk_Info::create();
mycurve->info()->SetColor( Dtk_RGB( 255, 0, 255 ) );
mycurve->info()->SetName( "mycircle" );
mycurves.push_back( mycurve );
Dtk_LinePtr myline;
myline = Dtk_Line::Create( Dtk_pnt( -5.0, 0.0, 0.0 ), Dtk_pnt( 5.0, 0.0, 0.0 ) );
mycurve = Dtk_CurvePtr::DtkDynamicCast( myline );
mycurve->info() = Dtk_Info::create();
mycurve->info()->SetColor( Dtk_RGB( 0, 0, 255 ) );
mycurve->info()->SetName( "myline" );
mycurves.push_back( mycurve );
myshell->AddWire( mycurves );
mysbody->AddWireShell( myshell );
// Val Prop on Body : not yet supported
Dtk_InfoPtr& body_info = mysbody->info();
if( body_info.IsNULL() ) body_info = Dtk_Info::create();
Dtk_Val valprop_curve_length( "1234 mm" );
body_info->AddAttribute( "geometric validation property : : curve length measure", valprop_curve_length );
return mysbody;
}
/****
Creation of a simple geometry for construction
Here, an infinite plane
****/
{
Dtk_PlaneSurfacePtr plan = Dtk_PlaneSurface::Create( Dtk_pnt( 0., 50., 0. ), Dtk_dir( 0., 1., 0. ), Dtk_dir( 1., 0., 0. ) );
Dtk_FacePtr face = Dtk_Face::Create( body );
shell->AddFace( face, DTK_TRUE );
body->AddOpenShell( shell );
body->info() = Dtk_Info::create();
body->info()->SetName( "Plane Y=50" );
return body;
}
/****
Creation of topological data : a Body and its content
Here, a cylinder
With additional data to
- see attachment of ATTRIBUTES at level of the whole Body or of a given item (here, faces)
- in particular, see attachment of VALIDATION PROPERTIES
- see ID, an information required to attach other data like FDT
****/
{
Dtk_BodyPtr mysbody;
mysbody = Dtk_Body::Create();
// Curves of edges
Dtk_PointPtr P1 = Dtk_Point::Create( 50., 0., 100. );
Dtk_PointPtr P2 = Dtk_Point::Create( 50., 0., 0. );
Dtk_pnt cent1( 0., 0., 100. );
Dtk_EllipsePtr circ1 = Dtk_Ellipse::Create( cent1, Dtk_dir( 0., 0., 1. ), Dtk_dir( 1., 0., 0. ), 50. );
Dtk_pnt cent2( 0., 0., 0. );
Dtk_EllipsePtr circ2 = Dtk_Ellipse::Create( cent2, Dtk_dir( 0., 0., 1. ), Dtk_dir( 1., 0., 0. ), 50. );
Dtk_LinePtr seam = Dtk_Line::Create( Dtk_pnt( 50., 0., 0. ), Dtk_pnt( 50., 0., 100. ) );
// Surfaces of faces
// Notice : for tessellation, it is required to record the UV trim in surfaces
double trim[ 4 ];
Dtk_PlaneSurfacePtr plan1 = Dtk_PlaneSurface::Create( cent1, Dtk_dir( 0., 0., 1. ), Dtk_dir( 1., 0., 0. ) );
trim[ 0 ] = -100.; trim[ 1 ] = 100.; trim[ 2 ] = -100.; trim[ 3 ] = 100.;
plan1->SetTrimUVBox( trim );
Dtk_PlaneSurfacePtr plan2 = Dtk_PlaneSurface::Create( cent2, Dtk_dir( 0., 0., 1. ), Dtk_dir( 1., 0., 0. ) );
plan2->SetTrimUVBox( trim );
Dtk_CylindricalSurfacePtr cylsurf = Dtk_CylindricalSurface::Create( cent2, Dtk_dir( 0., 0., 1. ), Dtk_dir( 1., 0., 0. ), 50 );
trim[ 0 ] = 0.; trim[ 1 ] = 2. * DTK_PI;
cylsurf->SetTrimUVBox( trim );
// Topology
// Vertices
V1->SetGeom( P1 );
V2->SetGeom( P2 );
// Edges
Dtk_EdgePtr E0 = Dtk_Edge::Create( mysbody );
E0->SetGeom( Dtk_CurvePtr::DtkDynamicCast( seam ) );
E0->SetStartVertex( V1 );
E0->SetEndVertex( V2 );
Dtk_EdgePtr E1 = Dtk_Edge::Create( mysbody );
E1->SetGeom( Dtk_CurvePtr::DtkDynamicCast( circ1 ) );
E1->SetStartVertex( V1 );
E1->SetEndVertex( V1 );
Dtk_EdgePtr E2 = Dtk_Edge::Create( mysbody );
E2->SetGeom( Dtk_CurvePtr::DtkDynamicCast( circ2 ) );
E2->SetStartVertex( V2 );
E2->SetEndVertex( V2 );
// Faces
Dtk_FacePtr F0 = Dtk_Face::Create( mysbody );
SetTopoFaceID( F0, 10 );
Dtk_FacePtr F1 = Dtk_Face::Create( mysbody );
SetTopoFaceID( F1, 20 );
// test for face color different from body color
F1->info()->SetColor( Dtk_RGB( 255, 0, 0 ) ); // info created by SetTopoFaceID
Dtk_FacePtr F2 = Dtk_Face::Create( mysbody );
SetTopoFaceID( F2, 30 );
// Loops + coedges
Dtk_LoopPtr L0 = Dtk_Loop::Create( mysbody );
C01->SetEdge( E1 );
L0->AddCoedge( C01, DTK_FALSE );
C02->SetEdge( E0 );
L0->AddCoedge( C02, DTK_FALSE );
C03->SetEdge( E2 );
L0->AddCoedge( C03, DTK_TRUE );
C04->SetEdge( E0 );
L0->AddCoedge( C04, DTK_TRUE );
F0->AddOuterLoop( L0 );
Dtk_LoopPtr L1 = Dtk_Loop::Create( mysbody );
C1->SetEdge( E1 );
L1->AddCoedge( C1, DTK_TRUE );
F1->AddOuterLoop( L1 );
Dtk_LoopPtr L2 = Dtk_Loop::Create( mysbody );
C2->SetEdge( E2 );
L2->AddCoedge( C2, DTK_TRUE );
F2->AddOuterLoop( L2 );
// Shell, Volume
SH->AddFace( F0, DTK_TRUE );
SH->AddFace( F1, DTK_TRUE );
SH->AddFace( F2, DTK_FALSE );
VOL->AddOuterShell( SH );
Lump->AddVolume( VOL );
mysbody->AddLump( Lump );
if( mysbody->info().IsNULL() ) mysbody->info() = Dtk_Info::create();
mysbody->info()->SetColor( Dtk_RGB( 0, 255, 0 ) );//Whole body color
return mysbody;
}
}

Fill FDT classes

//DATAKIT headers needed
#include "datakit.h"
/****
Creation of sample FDTs
Here is only the creation of the FDT itself
The links with the geometry are declared separately to the writer
****/
namespace sampleWriter
{
{
// Creation of Leader line
Dtk_pnt arrow_location( 0., 0. );
Dtk_tab<Dtk_pnt> leader_points;
leader_points.push_back( Dtk_pnt( 0., 18. ) );
//Creation of leader with terminator's height and width 2.0. The terminator is a filled triangle
Dtk_LeaderPtr leader = Dtk_Leader::Create( 2.0, 2.0, arrow_location, Dtk_Leader::TerminatorTypeClosedArrow, leader_points );
//Creation of symbol
// Creation of Text info
//Setting text color to blue
text_info->SetColor( 0, 0, 255 );
//Setting text style
Dtk_bool horiz_vert = 0, mirror = 0, font_index = 0;
double slant = 0.;
Dtk_TextStyle text_style;
//Text height
text_style.CharHeight() = 3.5;
//Text width
text_style.CharWidth() = 2.1;
//Text slant
text_style.Slant() = slant;
//Text value : "A"
Dtk_string str( "A" );
//Creating text 2D Bounding box
Dtk_pnt location( -2., 20. );
double XLen = 5., YLen = 5.;
Dtk_dir XDir( 1., 0., 0. ), YDir( 0., 0., 1. );
Dtk_Oriented2dBBox inbox( location, XLen, YLen, XDir, YDir );
//Creating the text itself giving :
// - its value
// - inside and outside boxes
// - anchor type
// - text type
// - horizontal/vertical text orientation
// - text infos
// - text style
// - text slant - PI / 2.0 for normal text -
// - font index
// - mirroring type
Dtk_Text dtk_text( str, inbox, inbox, dtk_align, text_type, horiz_vert, text_info, text_style, slant, font_index, mirror );
//Adding created text to symbol
Dtk_CompositeText& texts = symbol->Texts();
texts.AddText( dtk_text );
//Creating the frame of the text
Dtk_PolylinePtr framePolyline;
framePolyline = Dtk_Polyline::Create( Dtk_pnt( -5., 18. ), Dtk_pnt( 5., 18. ) );
framePolyline->AddPoint( Dtk_pnt( 5., 28. ) );
framePolyline->AddPoint( Dtk_pnt( -5., 28. ) );
framePolyline->AddPoint( Dtk_pnt( -5., 18. ) );
FrameGeoms.push_back( Dtk_CurvePtr::DtkDynamicCast( framePolyline ) );
//Setting the type of the frame
symbol->SetFrameType( DTK_FRAME_TYPE_RECTANGLE, FrameGeoms );
// Creation of leader line
Dtk_InfoPtr leader_info = Dtk_Info::create();
leader_info->SetColor( 255, 255, 255 );
leader->GetInfo() = leader_info;
//Adding leader to symbol
symbol->AddLeader( leader );
//Setting symbol type
symbol->SymbolType() = Dtk_Symbol::TypeDatum;
//Adding symbol to FDT
fdt->Sub2DEntity() = Dtk_2dEntityPtr::DtkDynamicCast( symbol );
//Adding transformation on FDT
Dtk_transfo fdt_transf;
fdt_transf.setOrigin( Dtk_pnt( 50., 100., 50. ) );
fdt->Transform( fdt_transf );
//Adding infos on FDT (Name and color)
fdt_info->SetColor( 255, 255, 255 );
fdt_info->SetName( "Datum:1" );
fdt->info() = fdt_info;
Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of mydatum", L"Value of mydatum" );
Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
ArrayMetadataEntity.push_back( metadata );
fdt->info()->SetMetaData( ArrayMetadataEntity );
return fdt;
}
{
// Creation of Text info
//Setting text style
Dtk_bool horiz_vert = 0, mirror = 0, font_index = 0;
double slant = 0.;
Dtk_TextStyle text_style;
//Text height
text_style.CharHeight() = 3.5;
//Text width
text_style.CharWidth() = 2.1;
//Text slant
text_style.Slant() = slant;
//Creating text value "200"
Dtk_string str( "200" );
//Creating text 2D Bounding box
Dtk_pnt location( -5., 20. );
double x_len = 15., y_len = 5.;
Dtk_dir x_dir( 1., 0., 0. ), y_dir( 0., 0., 1. );
Dtk_Oriented2dBBox inbox( location, x_len, y_len, x_dir, y_dir );
//Creating the text itself giving :
// - its value
// - inside and outside boxes
// - anchor type
// - text type
// - horizontal/vertical text orientation
// - text infos
// - text style
// - text slant - PI / 2.0 for normal text -
// - font index
// - mirroring type
Dtk_Text dtk_text( str, inbox, inbox, dtk_align, text_type, horiz_vert, text_info, text_style, slant, font_index, mirror );
texts.AddText( dtk_text );
//Creating the Dimension itself
Dtk_DimensionPtr dimension = Dtk_Dimension::Create( dimensionType, texts );
//Adding dimension to FDT
fdt->Sub2DEntity() = Dtk_2dEntityPtr::DtkDynamicCast( dimension );
//Creating the Leader lines
//Setting leader terminator type
//Setting leader terminator size
double arrow_width = 5., arrow_length = 5.;
//Creating first leader
//Setting the Arrow location
Dtk_pnt leader1_arrow_location = Dtk_pnt( 100., 23., 0. );
//Setting the leader position
Dtk_transfo leader1_pos;
leader1_pos.setOrigin( Dtk_pnt( 0., 23., 0. ) );
//Setting the leader points
Dtk_tab<Dtk_pnt> leader1_pts;
leader1_pts.push_back( Dtk_pnt( 10., 23., 0. ) );
//Creating the first leader itself
Dtk_LeaderPtr leader1 = Dtk_Leader::Create( arrow_width, arrow_length, leader1_arrow_location, termintator_type, leader1_pts );
//Adding extension lines
Dtk_tab<Dtk_pnt> extension_line_1;
extension_line_1.push_back( Dtk_pnt( 100., 25. ) );
extension_line_1.push_back( Dtk_pnt( 100., 0. ) );
leader1->SetExtensionLine( Dtk_Polyline::Create( std::move( extension_line_1 ) ) );
dimension->AddLeader( leader1 );
//Creating second leader
Dtk_transfo leader2_pos;
leader2_pos.setOrigin( Dtk_pnt( 0., 23., 0. ) );
Dtk_tab<Dtk_pnt> leader2_pts;
//Setting the Arrow location
Dtk_pnt leader2_arrow_location = Dtk_pnt( -100., 23., 0. );
leader2_pts.push_back( Dtk_pnt( -10., 23., 0. ) );
//Creating the second leader itself
Dtk_LeaderPtr leader2 = Dtk_Leader::Create( arrow_width, arrow_length, leader2_arrow_location, termintator_type, leader2_pts );
//Adding extension lines
Dtk_tab<Dtk_pnt> extension_line_2;
extension_line_2.push_back( Dtk_pnt( -100., 25. ) );
extension_line_2.push_back( Dtk_pnt( -100., 0. ) );
leader2->SetExtensionLine( Dtk_Polyline::Create( std::move( extension_line_2 ) ) );
dimension->AddLeader( leader2 );
// General data of the FDT : position, color, name ..
Dtk_transfo fdt_transf;
fdt_transf.setOrigin( Dtk_pnt( 0., 200., 75. ) );
fdt_transf.setXdir( 0., 1., 0. );
fdt_transf.setYdir( -1., 0., 0. );
fdt->Transform( fdt_transf );
fdt_info->SetColor( 0, 255, 0 );
fdt_info->SetName( "Dimension:1" );
fdt->info() = fdt_info;
Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of myfdt", L"Value of myfdt" );
Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
ArrayMetadataEntity.push_back( metadata );
fdt->info()->SetMetaData( ArrayMetadataEntity );
return fdt;
}
// Creates a geometrical tolerance | (position) | 0.02(M) | A |
{
// first create and populate the dimension
// Creation of Text info
//Setting text style
Dtk_bool horiz_vert = 0, mirror = 0, font_index = 0;
double slant = 0.;
Dtk_TextStyle text_style;
Dtk_dir x_dir( 1, 0, 0 ), normal_dir( 0, 0, 1 );
//Text height
text_style.CharHeight() = 3.5;
//Text width
text_style.CharWidth() = 2.1;
//Text slant
text_style.Slant() = slant;
// Create boxes for Container Text
Dtk_pnt location_c( 0.0, 0.0 );
Dtk_Oriented2dBBox container_box( location_c, 15, 15, x_dir, normal_dir );// to give frame box
Dtk_Oriented2dBBox container_boxin = container_box; // to give inner smaller box for text
container_boxin.Extend( -2., -2. ); //reduce the initial box
//Create Dtk_GeometricalTolerance
//Create Dtk_ToleranceSpecification
//Create Dtk_ToleranceSpecificationContainer
MyGeometricalTolerance->AddToleranceSpecificationContainer( MyContainer );
//Create Fulltext for tolerance
// Create tolerance
Dtk_Text val;
Dtk_pnt location_v( 15.0, 0.0 );
Dtk_Oriented2dBBox container_boxv( location_v, 20, 15, x_dir, normal_dir );
Dtk_Oriented2dBBox container_boxvin = container_boxv;
container_boxvin.Extend( -2., -2. );
val = Dtk_Text( L"0.02", container_boxvin, container_boxv, dtk_align, DTK_Text_type::dtk_text_type_value, horiz_vert, text_info, text_style, slant, font_index, mirror );
fulltext.AddText( val );
// Create modifier
Dtk_pnt locationm( 35.0, 0.0 );
Dtk_Oriented2dBBox container_boxm( locationm, 15, 15, x_dir, normal_dir );
Dtk_Oriented2dBBox container_boxmin = container_boxm;
container_boxmin.Extend( -2., -2. );
Dtk_Text modifier = Dtk_Text( L"\u24C2", container_boxmin, container_boxm, dtk_align, DTK_Text_type::dtk_text_type_modifier, horiz_vert, text_info, text_style, slant, font_index, mirror );
fulltext.AddText( modifier );
// Create Reference Frame
//Add A
Dtk_pnt locationA( 50.0, 0.0 );
Dtk_Oriented2dBBox container_boxA( locationA, 15, 15, x_dir, normal_dir );
Dtk_Oriented2dBBox container_boxAin = container_boxA;
container_boxAin.Extend( -2., -2. );
Dtk_ReferenceBlockPtr A_Block = Dtk_ReferenceBlock::Create( container_boxAin, container_boxA );
A_Block->AddReference( L"A" );
RefFrame->AddReferenceBlock( A_Block );
// Create Dtk_ToleranceSpecificationPtr
Dtk_ToleranceSpecificationPtr MyToleranceSpecification = Dtk_ToleranceSpecification::Create( val, RefFrame );
MyToleranceSpecification->SetMainValue( fulltext );
//Add it to Container
MyContainer->AddToleranceSpecification( MyToleranceSpecification );
fdt->Sub2DEntity() = Dtk_2dEntityPtr::DtkDynamicCast( MyGeometricalTolerance );
fdt_info->SetColor( 255, 255, 255 );
fdt_info->SetName( "GeometricalTolerance" );
fdt->info() = fdt_info;
return fdt;
}
{
Dtk_pnt from = Dtk_pnt( 300, 300, 300 );
Dtk_pnt to( 0, 0, 0 );
Dtk_pnt up = Dtk_dir( -0.57735, 0.57735, -0.57735 );
Dtk_CameraPtr cam = Dtk_Camera::Create( from, to, 250, 250, up );
resMD = Dtk_ModelDisplay::Create( cam, NULL, DTK_TRUE );// create activated model display
resMD->info() = Dtk_Info::create();
resMD->info()->SetName( "MyView1" );
return resMD;
}
{
Dtk_pnt from( 0, 0, 100 );
Dtk_pnt to( 0, 0, 0 );
Dtk_dir up( 0, 1, 0 );
Dtk_CameraPtr cam = Dtk_Camera::Create( from, to, 100, 100, up ); // semiwidth = 100
resMD = Dtk_ModelDisplay::Create( cam, NULL, DTK_FALSE ); // create desactivated model display
resMD->info() = Dtk_Info::create();
resMD->info()->SetName( "MyView2" );
return resMD;
}
{
Dtk_PlaneSurfacePtr section = Dtk_PlaneSurface::Create( Dtk_pnt(), Dtk_dir( 0.75, -0.4, 0. ), Dtk_dir( 0., 0., 1. ) );
resMD = Dtk_ModelDisplay::Create( mv1->GetCamera(), Dtk_EntityPtr::DtkDynamicCast( section ), DTK_FALSE ); // create second desactivated view with section
resMD->info() = Dtk_Info::create();
resMD->info()->SetName( "MySectionView" );
return resMD;
}
}

Fill Mesh classes

#include <map>
//DATAKIT headers needed
#include "datakit.h"
namespace sampleWriter
{
namespace
{
void CreateMeshCubeGeometry( Dtk_tab<Dtk_pnt>& vertices, Dtk_tab<Dtk_dir>& normals, Dtk_tab<Dtk_Float32>& uCoords, Dtk_tab<Dtk_Float32>& vCoords )
{
//Creating vertices and normals
vertices.push_back( Dtk_pnt( -1.0f, -1.0f, -1.0f ) );
vertices.push_back( Dtk_pnt( -1.0f, 1.0f, -1.0f ) ); //0.,0.,-1.
vertices.push_back( Dtk_pnt( 1.0f, -1.0f, -1.0f ) );
vertices.push_back( Dtk_pnt( 1.0f, 1.0f, -1.0f ) );
for( int i = 0; i < 4; i++ )
{
normals.push_back( Dtk_dir( 0., 0., -1. ) );
}
vertices.push_back( Dtk_pnt( 1.0f, 1.0f, 1.0f ) );
vertices.push_back( Dtk_pnt( -1.0f, 1.0f, 1.0f ) ); //0.,0.,1.
vertices.push_back( Dtk_pnt( 1.0f, -1.0f, 1.0f ) );
vertices.push_back( Dtk_pnt( -1.0f, -1.0f, 1.0f ) );
for( int i = 0; i < 4; i++ )
{
normals.push_back( Dtk_dir( 0., 0., 1. ) );
}
vertices.push_back( Dtk_pnt( -1.0f, 1.0f, -1.0f ) );
vertices.push_back( Dtk_pnt( -1.0f, 1.0f, 1.0f ) ); //0.,1.,0.
vertices.push_back( Dtk_pnt( 1.0f, 1.0f, -1.0f ) );
vertices.push_back( Dtk_pnt( 1.0f, 1.0f, 1.0f ) );
for( int i = 0; i < 4; i++ )
{
normals.push_back( Dtk_dir( 0., 1., 0. ) );
}
vertices.push_back( Dtk_pnt( 1.0f, -1.0f, 1.0f ) );
vertices.push_back( Dtk_pnt( -1.0f, -1.0f, 1.0f ) ); //0.,-1.,0.
vertices.push_back( Dtk_pnt( 1.0f, -1.0f, -1.0f ) );
vertices.push_back( Dtk_pnt( -1.0f, -1.0f, -1.0f ) );
for( int i = 0; i < 4; i++ )
{
normals.push_back( Dtk_dir( 0., -1., 0. ) );
}
vertices.push_back( Dtk_pnt( 1.0f, -1.0f, -1.0f ) );
vertices.push_back( Dtk_pnt( 1.0f, 1.0f, -1.0f ) ); //1.,0.,0.
vertices.push_back( Dtk_pnt( 1.0f, -1.0f, 1.0f ) );
vertices.push_back( Dtk_pnt( 1.0f, 1.0f, 1.0f ) );
for( int i = 0; i < 4; i++ )
{
normals.push_back( Dtk_dir( 1., 0., 0. ) );
}
vertices.push_back( Dtk_pnt( -1.0f, 1.0f, 1.0f ) );
vertices.push_back( Dtk_pnt( -1.0f, 1.0f, -1.0f ) ); //-1.,0.,0.
vertices.push_back( Dtk_pnt( -1.0f, -1.0f, 1.0f ) );
vertices.push_back( Dtk_pnt( -1.0f, -1.0f, -1.0f ) );
for( int i = 0; i < 4; i++ )
{
normals.push_back( Dtk_dir( -1., 0., 0. ) );
}
//Creating UV coordinates for textures
for( int i = 0; i < 6; i++ )
{
Dtk_Float32 len = 1.0;
uCoords.push_back( 0.0 );
vCoords.push_back( 0.0 );
uCoords.push_back( len );
vCoords.push_back( 0.0 );
uCoords.push_back( len );
vCoords.push_back( len );
uCoords.push_back( 0.0 );
vCoords.push_back( len );
}
}
void CreateMeshCubeidGeometry( Dtk_tab<Dtk_pnt>& vertices, Dtk_tab<Dtk_dir>& normals, Dtk_tab<Dtk_Float32>& uCoords, Dtk_tab<Dtk_Float32>& vCoords, Dtk_pair<Dtk_pnt, Dtk_pnt> inPoints )
{
Dtk_Double64 inFirstX, inFirstY, inFirstZ;
Dtk_Double64 inSecondX, inSecondY, inSecondZ;
inPoints.first.GetXYZ( inFirstX, inFirstY, inFirstZ );
inPoints.second.GetXYZ( inSecondX, inSecondY, inSecondZ );
//Creating vertices and normals
vertices.push_back( Dtk_pnt( inFirstX, inFirstY, inFirstZ ) );
vertices.push_back( Dtk_pnt( inFirstX, inSecondY, inFirstZ ) ); //0.,0.,-1.
vertices.push_back( Dtk_pnt( inSecondX, inFirstY, inFirstZ ) );
vertices.push_back( Dtk_pnt( inSecondX, inSecondY, inFirstZ ) );
for( int i = 0; i < 4; i++ )
{
normals.push_back( Dtk_dir( 0., 0., -1. ) );
}
vertices.push_back( Dtk_pnt( inSecondX, inSecondY, inSecondZ ) );
vertices.push_back( Dtk_pnt( inFirstX, inSecondY, inSecondZ ) ); //0.,0.,1.
vertices.push_back( Dtk_pnt( inSecondX, inFirstY, inSecondZ ) );
vertices.push_back( Dtk_pnt( inFirstX, inFirstY, inSecondZ ) );
for( int i = 0; i < 4; i++ )
{
normals.push_back( Dtk_dir( 0., 0., 1. ) );
}
vertices.push_back( Dtk_pnt( inFirstX, inSecondY, inFirstZ ) );
vertices.push_back( Dtk_pnt( inFirstX, inSecondY, inSecondZ ) ); //0.,1.,0.
vertices.push_back( Dtk_pnt( inSecondX, inSecondY, inFirstZ ) );
vertices.push_back( Dtk_pnt( inSecondX, inSecondY, inSecondZ ) );
for( int i = 0; i < 4; i++ )
{
normals.push_back( Dtk_dir( 0., 1., 0. ) );
}
vertices.push_back( Dtk_pnt( inSecondX, inFirstY, inSecondZ ) );
vertices.push_back( Dtk_pnt( inFirstX, inFirstY, inSecondZ ) ); //0.,-1.,0.
vertices.push_back( Dtk_pnt( inSecondX, inFirstY, inFirstZ ) );
vertices.push_back( Dtk_pnt( inFirstX, inFirstY, inFirstZ ) );
for( int i = 0; i < 4; i++ )
{
normals.push_back( Dtk_dir( 0., -1., 0. ) );
}
vertices.push_back( Dtk_pnt( inSecondX, inFirstY, inFirstZ ) );
vertices.push_back( Dtk_pnt( inSecondX, inSecondY, inFirstZ ) ); //1.,0.,0.
vertices.push_back( Dtk_pnt( inSecondX, inFirstY, inSecondZ ) );
vertices.push_back( Dtk_pnt( inSecondX, inSecondY, inSecondZ ) );
for( int i = 0; i < 4; i++ )
{
normals.push_back( Dtk_dir( 1., 0., 0. ) );
}
vertices.push_back( Dtk_pnt( inFirstX, inSecondY, inSecondZ ) );
vertices.push_back( Dtk_pnt( inFirstX, inSecondY, inFirstZ ) ); //-1.,0.,0.
vertices.push_back( Dtk_pnt( inFirstX, inFirstY, inSecondZ ) );
vertices.push_back( Dtk_pnt( inFirstX, inFirstY, inFirstZ ) );
for( int i = 0; i < 4; i++ )
{
normals.push_back( Dtk_dir( -1., 0., 0. ) );
}
Dtk_Float32 lenX = ( Dtk_Float32 )abs( inSecondX - inFirstX );
Dtk_Float32 lenY = ( Dtk_Float32 )abs( inSecondY - inFirstY );
Dtk_Float32 lenZ = ( Dtk_Float32 )abs( inSecondZ - inFirstZ );
//Creating UV coordinates for textures
for( int i = 0; i < 6; i++ )
{
Dtk_Float32 len1, len2;
if( i < 2 )
{
len1 = lenX;
len2 = lenY;
}
else if( i < 4 )
{
len1 = lenX;
len2 = lenZ;
}
else
{
len1 = lenY;
len2 = lenZ;
}
uCoords.push_back( 0.0 );
vCoords.push_back( 0.0 );
uCoords.push_back( len1 );
vCoords.push_back( 0.0 );
uCoords.push_back( len1 );
vCoords.push_back( len2 );
uCoords.push_back( 0.0 );
vCoords.push_back( len2 );
}
}
void CreateMeshCubeFaces( Dtk_mesh* outCubeMesh )
{
int nbfaces = 6;
for( int i = 0; i < nbfaces; i++ )
{
indices.clear();
indices.push_back( i * 4 );
indices.push_back( i * 4 + 1 );
indices.push_back( i * 4 + 2 );
indices.push_back( i * 4 + 3 );
Dtk_mesh_face* face = new Dtk_mesh_face( outCubeMesh );
face->add_triangle_strip( &indices );
outCubeMesh->add_mesh_face( face );
}
}
}
{
// Variables
Dtk_tab<Dtk_pnt> vertices;
// Our mesh
Dtk_mesh* outCubeMesh = new Dtk_mesh( DTK_MESH_XYZ | DTK_MESH_NORMAL | DTK_MESH_UV_TEXTURES /*if you have materials*/ ); // coords & normals & materials
// PART1 : CREATING GEOMETRY AND UV COORDINATES ARRAYS (HARD CODED here)
CreateMeshCubeGeometry( vertices, normals, uCoords, vCoords );
// PART2 : STORING geometry (vertices & normals) into the mesh
for( Dtk_Size_t i = 0; i < vertices.size(); i++ )
{
outCubeMesh->add_vertex( &( vertices.at( i ) ), &( normals.at( i ) ), NULL, uCoords[ i ], vCoords[ i ] );
}
// At this point, vertices & normals are stored, but we have no faces yet
// PART3 : BUILDING THE SIX FACES
CreateMeshCubeFaces( outCubeMesh );
Dtk_RGB rgb( 255, 0, 0 );
outCubeMesh->set_mesh_color( rgb ); // red cube
outCubeMesh->info() = Dtk_Info::create();
outCubeMesh->info()->SetColor( rgb );
return outCubeMesh;
}
void FillFacesColors( Dtk_MeshPtr& inoutCubeMesh )
{
infoFace0->SetColor( Dtk_RGB( 255, 1, 0 ) );
inoutCubeMesh->get_mesh_face( 0 )->info() = infoFace0;
infoFace1->SetColor( Dtk_RGB( 0, 255, 0 ) );
inoutCubeMesh->get_mesh_face( 1 )->info() = infoFace1;
infoFace2->SetColor( Dtk_RGB( 0, 0, 255 ) );
inoutCubeMesh->get_mesh_face( 2 )->info() = infoFace2;
infoFace3->SetColor( Dtk_RGB( 255, 255, 0 ) );
inoutCubeMesh->get_mesh_face( 3 )->info() = infoFace3;
infoFace4->SetColor( Dtk_RGB( 0, 255, 255 ) );
inoutCubeMesh->get_mesh_face( 4 )->info() = infoFace4;
infoFace5->SetColor( Dtk_RGB( 255, 128, 0 ) );
inoutCubeMesh->get_mesh_face( 5 )->info() = infoFace5;
}
Dtk_MeshPtr CreateTexturedMeshCube( const Dtk_string& inImageDirectory )
{
// Our mesh
Dtk_MeshPtr outCubeMesh = CreateMeshCube();
// create mesh texture with cubical mapping
Dtk_RenderInfosPtr meshRender = Dtk_RenderInfos::Create( "meshRender" );
meshTexture->SetImagePath( inImageDirectory + "sample.bmp" );
meshTexture->SetScale( 2., 2. ); // image scale
meshRender->SetTexture( meshTexture );
outCubeMesh->info()->AddRenderInfos( meshRender ); // apply texture to mesh
outCubeMesh->info()->SetName( "TexturedMesh" );
// create face render texture
Dtk_RenderInfosPtr faceRender = Dtk_RenderInfos::Create( "faceRender" );
faceTexture->SetImagePath( inImageDirectory + "logodtk.bmp" );
faceTexture->SetScale( 2., 2. ); // image scale
faceRender->SetTexture( faceTexture );
if( outCubeMesh->get_mesh_face( 2 )->info().IsNULL() )
outCubeMesh->get_mesh_face( 2 )->info() = Dtk_Info::create();
outCubeMesh->get_mesh_face( 2 )->info()->AddRenderInfos( faceRender ); // apply texture to face
return outCubeMesh;
}
{
// Variables
Dtk_tab<Dtk_pnt> vertices;
Dtk_RGB red( 255, 0, 0 );
Dtk_RGB green( 0, 255, 0 );
Dtk_RGB blue( 0, 0, 255 );
Dtk_RGB all( 255, 255, 255 );
// Our mesh
Dtk_mesh* outCubeMesh = new Dtk_mesh( DTK_MESH_XYZ | DTK_MESH_NORMAL | DTK_MESH_RGB ); // coords & normals & vertex colors
// PART1 : CREATING GEOMETRY ARRAYS (HARD CODED here)
CreateMeshCubeGeometry( vertices, normals, uCoords, vCoords );
// PART2 : STORING geometry (vertices & normals & vertex color) into the mesh
for( Dtk_Size_t i = 0; i < vertices.size(); i += 4 )
{
outCubeMesh->add_vertex( &( vertices.at( i ) ), &( normals.at( i ) ), &red );
outCubeMesh->add_vertex( &( vertices.at( i + 1 ) ), &( normals.at( i + 1 ) ), &green );
outCubeMesh->add_vertex( &( vertices.at( i + 2 ) ), &( normals.at( i + 2 ) ), &blue );
outCubeMesh->add_vertex( &( vertices.at( i + 3 ) ), &( normals.at( i + 3 ) ), &all );
}
// At this point, vertices & normals are stored, but we have no faces yet
// PART3 : BUILDING THE SIX FACES
CreateMeshCubeFaces( outCubeMesh );
return outCubeMesh;
}
{
// Variables
Dtk_mesh_face* face = NULL;
Dtk_tab<Dtk_pnt> vertices;
if( nbpoints < 3 )
{
return NULL;
}
// Our mesh
Dtk_mesh* outCylinderMesh = new Dtk_mesh( DTK_MESH_XYZ | DTK_MESH_NORMAL ); // coords & normals
double radius = 3;
double height = 5;
for( i = 0; i < ( Dtk_Size_t )nbpoints; i++ )
{
double angle = i * 2 * DTK_PI / nbpoints;
normals.push_back( Dtk_pnt( cos( angle ), sin( angle ), 0 ) );
vertices.push_back( radius * Dtk_pnt( cos( angle ), sin( angle ) ) + Dtk_pnt( 0, 0, height ) );
normals.push_back( Dtk_pnt( cos( angle ), sin( angle ), 0 ) );
vertices.push_back( radius * Dtk_pnt( cos( angle ), sin( angle ), 0 ) );
indices.push_back( ( Dtk_UInt32 )indices.size() );
indices.push_back( ( Dtk_UInt32 )indices.size() );
}
indices.push_back( 0 );
indices.push_back( 1 );
face = new Dtk_mesh_face( outCylinderMesh );
face->add_triangle_strip( &indices, &vertices, &normals );
outCylinderMesh->add_mesh_face( face );
Dtk_RGB rgb( 255, 255, 0, 128 );
outCylinderMesh->set_mesh_color( rgb ); // yellow transparent cylinder
outCylinderMesh->info() = Dtk_Info::create();
outCylinderMesh->info()->SetColor( rgb );
Dtk_MetaDataPtr metadata = Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, L"Title of mymesh", L"Value of mymesh" );
Dtk_tab<Dtk_MetaDataPtr> ArrayMetadataEntity;
ArrayMetadataEntity.push_back( metadata );
outCylinderMesh->info()->SetMetaData( ArrayMetadataEntity );
return outCylinderMesh;
}
{
// Variables
Dtk_mesh_face* face = NULL;
Dtk_tab<Dtk_pnt> vertices;
Dtk_Size_t i, numVertices;
Dtk_InfoPtr info = NULL;
// Our mesh
Dtk_mesh* outWireMesh = new Dtk_mesh( DTK_MESH_XYZ ); // coords
face = new Dtk_mesh_face( outWireMesh );
//free curves
vertices.push_back( Dtk_pnt( -1.0f, 1.0f, 1.0f ) ); //0.,1.,0.
vertices.push_back( Dtk_pnt( -1.0f, 1.0f, -1.0f ) );
vertices.push_back( Dtk_pnt( 1.0f, 1.0f, -1.0f ) );
vertices.push_back( Dtk_pnt( 1.0f, 1.0f, 1.0f ) );
numVertices = vertices.size();
for( i = 0; i < numVertices; i++ )
{
indices.push_back( ( Dtk_UInt32 )i );
}
indices.push_back( 0 );
info = Dtk_Info::create();
info->SetColor( Dtk_RGB( 0, 0, 255 ) );
face->add_polyline( &indices, &vertices );
face->add_subinfo( info );
outWireMesh->add_mesh_face( face );
//free vertex
info = NULL;
info = Dtk_Info::create();
vertices.clear();
indices.clear();
face = new Dtk_mesh_face( outWireMesh );
vertices.push_back( Dtk_pnt( 0.0f, 1.0f, 0.0f ) );
indices.push_back( 0 );
info->SetColor( Dtk_RGB( 255, 0, 0 ) );
face->add_points( &indices, &vertices );
face->add_subinfo( info );
outWireMesh->add_mesh_face( face );
return outWireMesh;
}
{
Dtk_mesh* outPointMesh = new Dtk_mesh( DTK_MESH_XYZ ); // coords
outPointMesh->info() = Dtk_Info::create();
outPointMesh->info()->SetColor( Dtk_RGB( 255, 100, 0 ) );
Dtk_mesh_face* face = new Dtk_mesh_face( outPointMesh );
double coords[ 8 ][ 3 ] = { {-1,-1,-1},{-1,-1,1},{-1,1,-1},{-1,1,1},
{1,-1,-1},{1,-1,1},{1,1,-1},{1,1,1} };
int i;
for( i = 0; i < 8; i++ )
{
Dtk_pnt P( coords[ i ][ 0 ], coords[ i ][ 1 ], coords[ i ][ 2 ] );
outPointMesh->add_vertex( &P );
face->add_point( i );
}
outPointMesh->add_mesh_face( face );
return outPointMesh;
}
Dtk_MeshPtr CreateMeshCuboid( const Dtk_pnt& inFirstPoint, const Dtk_pnt& inSecondPoint )
{
// Variables
Dtk_tab<Dtk_pnt> vertices;
// Our mesh
Dtk_mesh* outCuboidMesh = new Dtk_mesh( DTK_MESH_XYZ | DTK_MESH_NORMAL | DTK_MESH_UV_TEXTURES /*if you have materials*/ ); // coords & normals & materials
inPoints.first = inFirstPoint;
inPoints.second = inSecondPoint;
// PART1 : CREATING GEOMETRY AND UV COORDINATES ARRAYS (HARD CODED here)
CreateMeshCubeidGeometry( vertices, normals, uCoords, vCoords, inPoints );
// PART2 : STORING geometry (vertices & normals) into the mesh
for( Dtk_Size_t i = 0; i < vertices.size(); i++ )
{
outCuboidMesh->add_vertex( &( vertices.at( i ) ), &( normals.at( i ) ), NULL, uCoords[ i ], vCoords[ i ] );
}
// At this point, vertices & normals are stored, but we have no faces yet
// PART3 : BUILDING THE SIX FACES
CreateMeshCubeFaces( outCuboidMesh );
Dtk_RGB rgb( 255, 0, 0 );
outCuboidMesh->set_mesh_color( rgb ); // red cube
outCuboidMesh->info() = Dtk_Info::create();
outCuboidMesh->info()->SetColor( rgb );
return outCuboidMesh;
}
{
//Variables
Dtk_RGB ambiant;
Dtk_RGB diffuse;
Dtk_RGB specular;
Dtk_LightMapPtr lightMap;
Dtk_string fileName;
//Creating lighting
ambiant.SetRGBA( 255, 255, 255 );
diffuse.SetRGBA( 255, 255, 255 );
specular.SetRGBA( 255, 255, 255 );
lightMap = Dtk_LightMap::Create( ambiant, diffuse, specular );
//Creating texture using cubical mapping
//Setting image to the texture
fileName = "..\\InputImages\\sample.bmp";
texture->SetImagePath( fileName );
//Scaling the texture
texture->SetScale( 2, 2 );
//Finally creating render informations
Dtk_RenderInfosPtr renderInfo = Dtk_RenderInfos::Create( "Rendering", lightMap, texture );
return renderInfo;
}
}
sampleWriter::Coedge0_DC
@ Coedge0_DC
Definition: testcreatecube.cpp:39
sampleWriter::CreateAxis
Dtk_BodyPtr CreateAxis()
Definition: testcreatecube.cpp:1551
sampleWriter::Coedge3_HC
@ Coedge3_HC
Definition: testcreatecube.cpp:53
Dtk_ModelDisplay::Create
static Dtk_ModelDisplayPtr Create(const Dtk_CameraPtr &inCamera, const Dtk_EntityPtr &inClippingEntity, const Dtk_bool inIsActivated)
Calls full featured constructor to allocate a new object.
sampleWriter::CreateCube_2
Dtk_BodyPtr CreateCube_2()
Definition: testcreatecylfdt.cpp:1064
Dtk_ToleranceSpecification::Create
static Dtk_ToleranceSpecificationPtr Create()
Calls default constructor to allocate a new object.
sampleWriter::Loop5_EHCA
@ Loop5_EHCA
Definition: testcreatecube.cpp:64
Dtk_pair
Definition: util_stl_dtk.hpp:921
DTK_MESH_NORMAL
#define DTK_MESH_NORMAL
Definition: util_mesh_dtk.hpp:31
sampleWriter::Edge_GD
@ Edge_GD
Definition: testcreatecube.cpp:30
Dtk_ID
uint32_t Dtk_ID
Definition: define.h:692
Dtk_transfo
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
Dtk_mesh_face
This is a high level face class.
Definition: util_mesh_dtk.hpp:865
Dtk_RGB::SetRGBA
void SetRGBA(const int &inRed, const int &inGreen, const int &inBlue, const int &inAlpha=-1)
Definition: dtk_rgb.hpp:49
sampleWriter::CreateCurves_2
Dtk_BodyPtr CreateCurves_2()
Definition: testcreatecylfdt.cpp:1108
Dtk_TextureInfos::Create
static Dtk_TextureInfosPtr Create(const TextureMappingTypeEnum &inType)
Create a Dtk_TextureInfosPtr.
sampleWriter::Coedge3_GD
@ Coedge3_GD
Definition: testcreatecube.cpp:49
Dtk_Info::AddAttribute
Dtk_ErrorStatus AddAttribute(Dtk_string name, Dtk_Val val)
Dtk_Float32
float Dtk_Float32
Definition: define.h:703
Dtk_PlaneSurface::Create
static Dtk_PlaneSurfacePtr Create(const Dtk_pnt &inOrigin, const Dtk_dir &inNormal, const Dtk_dir &inUDirection, const Dtk_dir &inVDirection=Dtk_dir())
Create an infinite plane surface.
sampleWriter::Vertex_A
@ Vertex_A
Definition: testcreatecube.cpp:15
Dtk_Info::SetName
Dtk_ErrorStatus SetName(Dtk_string inName)
sampleWriter::Edge_FB
@ Edge_FB
Definition: testcreatecube.cpp:28
sampleWriter::CreateMeshCube
Dtk_MeshPtr CreateMeshCube()
Mesh Cube sample.
Definition: testcreatemesh.cpp:204
Dtk_TextStyle
This is the text_style. This class gathers information about text style.
Definition: util_draw_dtk.hpp:250
sampleWriter::Coedge5_CA
@ Coedge5_CA
Definition: testcreatecube.cpp:38
Dtk_SmartPtr::IsNotNULL
Dtk_bool IsNotNULL() const
Definition: util_ptr_dtk.hpp:119
sampleWriter::CreateCyl
Dtk_BodyPtr CreateCyl(double radius, double height)
Definition: testcreatecube.cpp:1750
Dtk_transfo::setOrigin
void setOrigin(const Dtk_pnt &O)
Set a new O center point.
sampleWriter::CreateMeshCubeVertexColor
Dtk_MeshPtr CreateMeshCubeVertexColor()
Definition: testcreatemesh.cpp:296
Dtk_transfo::setZdir
void setZdir(const Dtk_dir &Z)
Set a new Z vector.
sampleWriter::Shell
@ Shell
Definition: testcreatecube.cpp:14
sampleWriter::CreateModelDisplayWithSection
Dtk_ModelDisplayPtr CreateModelDisplayWithSection()
Definition: testcreatefdt.cpp:346
sampleWriter::CreateMeshPoints
Dtk_MeshPtr CreateMeshPoints()
Points mesh sample.
Definition: testcreatemesh.cpp:436
sampleWriter::Edge_FE
@ Edge_FE
Definition: testcreatecube.cpp:29
Dtk_Loop::Create
static Dtk_LoopPtr Create(const Dtk_BodyPtr &inParentBody)
Create a loop in a body.
sampleWriter::Coedge4_HG
@ Coedge4_HG
Definition: testcreatecube.cpp:56
sampleWriter::Coedge5_EH
@ Coedge5_EH
Definition: testcreatecube.cpp:58
DTK_TRUE
#define DTK_TRUE
Definition: define.h:730
Dtk_ToleranceSpecificationContainer::Create
static Dtk_ToleranceSpecificationContainerPtr Create(const Dtk_ToleranceSpecificationContainer &in)
Calls copy constructor to allocate a new object.
sampleWriter::CreateInfinitePlane
Dtk_BodyPtr CreateInfinitePlane()
Definition: testcreatecube.cpp:1496
dtk_text_type_value
@ dtk_text_type_value
Definition: str_def.h:14
Dtk_UInt32
uint32_t Dtk_UInt32
Definition: define.h:691
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
DTK_ANCHOR_BOTTOM_LEFT
@ DTK_ANCHOR_BOTTOM_LEFT
Definition: util_draw_dtk.hpp:97
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:715
sampleWriter::Volume
@ Volume
Definition: testcreatecube.cpp:13
sampleWriter::Coedge4_GF
@ Coedge4_GF
Definition: testcreatecube.cpp:52
Dtk_mesh_face::add_triangle_strip
int add_triangle_strip(const Dtk_tab< Dtk_UInt32 > *inIndices)
Add one triangle strip.
sampleWriter::Edge_BD
@ Edge_BD
Definition: testcreatecube.cpp:26
Dtk_Text
This is the base text class. It's part of Dtk_CompositeText. It's used into a lot of 2D Entities It c...
Definition: util_draw_dtk.hpp:1110
sampleWriter::Edge_HC
@ Edge_HC
Definition: testcreatecube.cpp:32
Dtk_RenderInfos::Create
static Dtk_RenderInfosPtr Create(const Dtk_string &inName)
Create a Dtk_RenderInfosPtr.
Dtk_AxisSystem::create
static Dtk_SmartPtr< Dtk_AxisSystem > create()
Calls default constructor to allocate a new object.
Dtk_Info::SetMetaData
Dtk_ErrorStatus SetMetaData(Dtk_tab< Dtk_MetaDataPtr > &inArray)
sampleWriter::Coedge5_EA
@ Coedge5_EA
Definition: testcreatecube.cpp:44
sampleWriter::CreateAxisSystem
Dtk_AxisSystemPtr CreateAxisSystem()
Definition: testcreatecube.cpp:1525
sampleWriter::Coedge3_HG
@ Coedge3_HG
Definition: testcreatecube.cpp:55
Dtk_Body::Create
static Dtk_BodyPtr Create()
Create a body.
DTK_MESH_XYZ
#define DTK_MESH_XYZ
Definition: util_mesh_dtk.hpp:30
Dtk_LightMap::Create
static Dtk_LightMapPtr Create(Dtk_RGB inAmbiant, Dtk_RGB inDiffuse, Dtk_RGB inSpecular)
Create a Dtk_LightMapPtr.
DTK_FALSE
#define DTK_FALSE
Definition: define.h:731
Dtk_Face::AddOuterLoop
Dtk_ErrorStatus AddOuterLoop(const Dtk_LoopPtr &inLoop)
Add outer loop on a face.
sampleWriter::Edge_CA
@ Edge_CA
Definition: testcreatecube.cpp:24
sampleWriter::Coedge0_BD
@ Coedge0_BD
Definition: testcreatecube.cpp:41
Dtk_bool
char Dtk_bool
Definition: define.h:728
Dtk_TextStyle::Slant
Dtk_Double64 & Slant()
Retrieves the text slant - get/set -.
Dtk_mesh::add_vertex
int add_vertex(const Dtk_pnt *inVertex, const Dtk_dir *inNormal=NULL, const Dtk_RGB *inColor=NULL, Dtk_Float32 inU=0., Dtk_Float32 inV=0., Dtk_Float32 inUBrep=0., Dtk_Float32 inVBrep=0.)
Add a vertex to the mesh vertices list.
Dtk_RenderInfos::SetTexture
void SetTexture(const Dtk_TextureInfosPtr &inTexture)
Set Dtk_Texture.
Dtk_Symbol::Create
static Dtk_SymbolPtr Create()
Calls default constructor to allocate a new object.
DTK_MESH_UV_TEXTURES
#define DTK_MESH_UV_TEXTURES
Definition: util_mesh_dtk.hpp:33
DTK_ANCHOR_MIDDLE_CENTER
@ DTK_ANCHOR_MIDDLE_CENTER
Definition: util_draw_dtk.hpp:95
sampleWriter::Coedge2_GF
@ Coedge2_GF
Definition: testcreatecube.cpp:51
sampleWriter::Edge_EH
@ Edge_EH
Definition: testcreatecube.cpp:34
Dtk_Double64
double Dtk_Double64
Definition: define.h:702
sampleWriter::Vertex_H
@ Vertex_H
Definition: testcreatecube.cpp:22
Dtk_transfo::setXdir
void setXdir(const Dtk_dir &X)
Set a new X vector.
sampleWriter::FillFacesColors
void FillFacesColors(Dtk_MeshPtr &inoutCubeMesh)
Filling mesh faces with colors.
Definition: testcreatemesh.cpp:241
sampleWriter::CreateMixedBody
Dtk_BodyPtr CreateMixedBody()
Definition: testcreatecube.cpp:1816
sampleWriter::Coedge2_FB
@ Coedge2_FB
Definition: testcreatecube.cpp:46
Dtk_mesh
This is a high level mesh class.
Definition: util_mesh_dtk.hpp:485
Dtk_Dimension::DistanceDimension
@ DistanceDimension
Definition: util_draw_dtk.hpp:4739
Dtk_pair::first
T1 first
Definition: util_stl_dtk.hpp:923
Dtk_TextStyle::CharWidth
Dtk_Double64 & CharWidth()
Retrieves the char width - get/set -.
sampleWriter::FaceABCD
@ FaceABCD
Definition: testcreatecube.cpp:65
Dtk_string::add_int
void add_int(const int integer, int force_unsigned_int=0)
concat an int to the Dtk_string (convert the int to Dtk_string)
Dtk_Val
Definition: dtk_val.hpp:67
Dtk_mesh_face::add_subinfo
int add_subinfo(Dtk_InfoPtr &ininf)
Dtk_Face::Create
static Dtk_FacePtr Create(const Dtk_BodyPtr &inParentBody)
Create a face in a body.
sampleWriter::Vertex_G
@ Vertex_G
Definition: testcreatecube.cpp:21
sampleWriter::Coedge4_FE
@ Coedge4_FE
Definition: testcreatecube.cpp:50
sampleWriter::CreateMeshWire
Dtk_MeshPtr CreateMeshWire()
Wire mesh sample.
Definition: testcreatemesh.cpp:385
DTK_MESH_RGB
#define DTK_MESH_RGB
Definition: util_mesh_dtk.hpp:32
DTK_DASHED
@ DTK_DASHED
Definition: util_ent_dtk.hpp:49
sampleWriter::Loop0_ABCD
@ Loop0_ABCD
Definition: testcreatecube.cpp:59
sampleWriter::FaceABFE
@ FaceABFE
Definition: testcreatecube.cpp:66
Dtk_ReferenceBlock::Create
static Dtk_ReferenceBlockPtr Create(const Dtk_Oriented2dBBox &inInnerBBox, const Dtk_Oriented2dBBox &inOuterBBox)
Calls full featured constructor to allocate a new object.
sampleWriter::CreatePoint
Dtk_BodyPtr CreatePoint()
Definition: testcreatecube.cpp:1469
sampleWriter::FaceGDCH
@ FaceGDCH
Definition: testcreatecube.cpp:68
sampleWriter::Coedge3_DC
@ Coedge3_DC
Definition: testcreatecube.cpp:40
sampleWriter::CreateEsquisse2D
Dtk_BodyPtr CreateEsquisse2D()
Definition: testcreatecube.cpp:1680
sampleWriter::CreateTexturedMeshCube
Dtk_MeshPtr CreateTexturedMeshCube(const Dtk_string &inImageDirectory)
Textured Mesh Cube sample.
Definition: testcreatemesh.cpp:269
sampleWriter::Vertex_B
@ Vertex_B
Definition: testcreatecube.cpp:16
sampleWriter::FaceEFGH
@ FaceEFGH
Definition: testcreatecube.cpp:69
sampleWriter
Definition: testcreatecube.cpp:9
Dtk_ReferenceFrame::Create
static Dtk_ReferenceFramePtr Create()
Calls default constructor to allocate a new object.
sampleWriter::Edge_EA
@ Edge_EA
Definition: testcreatecube.cpp:27
sampleWriter::CreateFdtDatum
Dtk_FdtPtr CreateFdtDatum()
Creates simple Datum.
Definition: testcreatefdt.cpp:15
sampleWriter::Edge_AB
@ Edge_AB
Definition: testcreatecube.cpp:23
Dtk_anchor_type
Dtk_anchor_type
Definition: util_draw_dtk.hpp:90
sampleWriter::Edge_GF
@ Edge_GF
Definition: testcreatecube.cpp:31
DTK_Text_type
DTK_Text_type
Definition: str_def.h:11
Dtk_Int32
int32_t Dtk_Int32
Definition: define.h:690
Dtk_NurbsSurface::Create
static Dtk_NurbsSurfacePtr Create(const Dtk_NurbsSurface &in)
Calls copy constructor to allocate a new object.
Dtk_tab::resize
void resize(Dtk_Size_t n, const T &t)
Resizes the array.
Definition: util_stl_dtk.hpp:604
DTK_DOTTED
@ DTK_DOTTED
Definition: util_ent_dtk.hpp:55
Dtk_Symbol::TypeDatum
@ TypeDatum
Definition: util_draw_dtk.hpp:6362
sampleWriter::Coedge2_GD
@ Coedge2_GD
Definition: testcreatecube.cpp:48
sampleWriter::Loop1_ABFE
@ Loop1_ABFE
Definition: testcreatecube.cpp:60
Dtk_Dimension::Create
static Dtk_DimensionPtr Create()
Calls default constructor to allocate a new object.
Dtk_MetaData::TypeProperty
@ TypeProperty
Definition: dtk_metadata.hpp:28
Dtk_Dimension::DimensionTypeEnum
DimensionTypeEnum
Definition: util_draw_dtk.hpp:4719
Dtk_Lump::Create
static Dtk_LumpPtr Create(const Dtk_BodyPtr &inParentBody)
Create a lump in a body.
sampleWriter::Vertex_D
@ Vertex_D
Definition: testcreatecube.cpp:18
sampleWriter::CreateOpenShell_2
Dtk_BodyPtr CreateOpenShell_2()
Definition: testcreatecylfdt.cpp:1094
Dtk_mesh_face::add_point
int add_point(Dtk_UInt32 inpnt)
Dtk_pair::second
T2 second
Definition: util_stl_dtk.hpp:924
Dtk_SmartPtr< Dtk_Entity >::DtkDynamicCast
static Dtk_SmartPtr< Dtk_Entity > DtkDynamicCast(const Dtk_SmartPtr< T2 > &p)
Definition: util_ptr_dtk.hpp:101
Dtk_mesh::set_mesh_color
void set_mesh_color(const Dtk_RGB &inColor)
set color in Dtk_mesh
sampleWriter::Coedge1_FB
@ Coedge1_FB
Definition: testcreatecube.cpp:45
sampleWriter::Vertex_C
@ Vertex_C
Definition: testcreatecube.cpp:17
Dtk_SmartPtr::IsNULL
Dtk_bool IsNULL() const
Definition: util_ptr_dtk.hpp:118
Dtk_Fdt::Create
static Dtk_FdtPtr Create()
Calls default constructor to allocate a new object.
Dtk_Face::SetGeom
void SetGeom(const Dtk_SurfacePtr &inSurface)
Set Geometry.
sampleWriter::CreateCubeRenderInfos
Dtk_RenderInfosPtr CreateCubeRenderInfos()
Definition: testcreatemesh.cpp:495
Dtk_Info::SetId
Dtk_ErrorStatus SetId(const Dtk_Int32 &inId)
sampleWriter::CreateConstructionPlane
Dtk_BodyPtr CreateConstructionPlane()
Definition: testcreatecylfdt.cpp:1155
Dtk_NurbsCurve::Create
static Dtk_NurbsCurvePtr Create(const Dtk_NurbsCurve &in)
Calls copy constructor to allocate a new object.
sampleWriter::CreateEsquisse3D
Dtk_BodyPtr CreateEsquisse3D()
Definition: testcreatecube.cpp:1581
Dtk_transfo::setScale
void setScale(Dtk_Double64 scale)
Set a new scale.
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
Dtk_Edge::Create
static Dtk_EdgePtr Create(const Dtk_BodyPtr &inParentBody)
Create an edge in a body.
sampleWriter::FaceFBDG
@ FaceFBDG
Definition: testcreatecube.cpp:67
sampleWriter::Lump
@ Lump
Definition: testcreatecube.cpp:12
Dtk_Point::Create
static Dtk_PointPtr Create(const Dtk_Point &in)
Calls copy constructor to allocate a new object.
sampleWriter::CreateMeshCylinder
Dtk_MeshPtr CreateMeshCylinder(int nbpoints)
Mesh Cylinder sample.
Definition: testcreatemesh.cpp:334
sampleWriter::Coedge1_EA
@ Coedge1_EA
Definition: testcreatecube.cpp:43
Dtk_transfo::setYdir
void setYdir(const Dtk_dir &Y)
Set a new Y vector.
dtk_text_type_modifier
@ dtk_text_type_modifier
Definition: str_def.h:21
Dtk_pnt
This is a mathematical point class.
Definition: dtk_pnt.hpp:20
sampleWriter::Coedge4_EH
@ Coedge4_EH
Definition: testcreatecube.cpp:57
Dtk_CompositeText
This is the composite text class. It's basically a Dtk_Text Container. This class represents a group ...
Definition: util_draw_dtk.hpp:1525
datakit.h
sampleWriter::Coedge2_BD
@ Coedge2_BD
Definition: testcreatecube.cpp:42
Dtk_Leader::Create
static Dtk_LeaderPtr Create()
Calls default constructor to allocate a new object.
Dtk_Camera::Create
static Dtk_CameraPtr Create()
Calls default constructor to allocate a new object.
sampleWriter::CreateModelDisplayActivated
Dtk_ModelDisplayPtr CreateModelDisplayActivated()
Definition: testcreatefdt.cpp:320
Dtk_Leader::TerminatorTypeClosedArrow
@ TerminatorTypeClosedArrow
Definition: util_draw_dtk.hpp:1961
Dtk_Line::Create
static Dtk_LinePtr Create(const Dtk_Line &in)
Calls copy constructor to allocate a new object.
testcreatemesh.hpp
testcreatecube.hpp
Dtk_TextStyle::CharHeight
Dtk_Double64 & CharHeight()
Retrieves the char height - get/set -.
Dtk_tab< Dtk_pnt >
Dtk_Vertex::Create
static Dtk_VertexPtr Create(const Dtk_BodyPtr &inParentBody)
Create a vertex in a body.
Dtk_Coedge::Create
static Dtk_CoedgePtr Create(const Dtk_BodyPtr &inParentBody)
Create a coedge in a body.
sampleWriter::CreateCube
Dtk_BodyPtr CreateCube()
Definition: testcreatecube.cpp:1316
Dtk_tab::size
Dtk_Size_t size() const
Returns the size of the array.
Definition: util_stl_dtk.hpp:503
sampleWriter::FaceEHCA
@ FaceEHCA
Definition: testcreatecube.cpp:70
sampleWriter::Vertex_F
@ Vertex_F
Definition: testcreatecube.cpp:20
sampleWriter::Coedge5_HC
@ Coedge5_HC
Definition: testcreatecube.cpp:54
sampleWriter::Coedge1_AB
@ Coedge1_AB
Definition: testcreatecube.cpp:36
sampleWriter::Coedge0_AB
@ Coedge0_AB
Definition: testcreatecube.cpp:35
Dtk_Leader::LeaderTerminatorTypeEnum
LeaderTerminatorTypeEnum
Internal leader terminator type.
Definition: util_draw_dtk.hpp:1955
sampleWriter::CreateCylinder
Dtk_BodyPtr CreateCylinder()
Definition: testcreatecylfdt.cpp:1179
sampleWriter::CreateCurves
Dtk_BodyPtr CreateCurves()
Definition: testcreatecube.cpp:1357
sampleWriter::CreateCurvesStyle
Dtk_BodyPtr CreateCurvesStyle()
Definition: testcreatecube.cpp:1434
sampleWriter::CreateDimension
Dtk_FdtPtr CreateDimension()
Definition: testcreatefdt.cpp:112
Dtk_Face::AddLoop
Dtk_ErrorStatus AddLoop(const Dtk_LoopPtr &inLoop, const Dtk_bool &inOuterInfo)
Add loop on a face.
sampleWriter::CreateMeshCuboid
Dtk_MeshPtr CreateMeshCuboid(const Dtk_pnt &inFirstPoint, const Dtk_pnt &inSecondPoint)
Definition: testcreatemesh.cpp:455
Dtk_tab::at
T & at(Dtk_Size_t k)
Definition: util_stl_dtk.hpp:397
Dtk_tab::push_back
void push_back(const T &x)
Inserts an element at the end of the array.
Definition: util_stl_dtk.hpp:416
Dtk_Shell::Create
static Dtk_ShellPtr Create(const Dtk_BodyPtr &inParentBody)
Create a shell in a body.
DTK_FRAME_TYPE_RECTANGLE
@ DTK_FRAME_TYPE_RECTANGLE
Definition: util_draw_dtk.hpp:127
sampleWriter::Coedge0_CA
@ Coedge0_CA
Definition: testcreatecube.cpp:37
Dtk_GeometricalTolerance::Create
static Dtk_GeometricalTolerancePtr Create()
Calls default constructor to allocate a new object.
Dtk_tab::clear
void clear(int no_delete=0)
Resets the Dtk_tab content.
Definition: util_stl_dtk.hpp:352
Dtk_CompositeText::AddText
void AddText(Dtk_Text inText)
Adds a Dtk_Text to the Dtk_CompositeText.
sampleWriter::Edge_DC
@ Edge_DC
Definition: testcreatecube.cpp:25
Dtk_TextureInfos::CubicalMapping
@ CubicalMapping
Definition: dtk_render.hpp:42
Dtk_Ellipse::Create
static Dtk_EllipsePtr Create(const Dtk_Ellipse &in)
Calls copy constructor to allocate a new object.
Dtk_pnt::GetXYZ
void GetXYZ(Dtk_Double64 &outX, Dtk_Double64 &outY, Dtk_Double64 &outZ) const
Retrieves to the 3 coordinates of the class.
Definition: dtk_pnt.hpp:77
Dtk_RGB
Definition: dtk_rgb.hpp:7
Dtk_Info::SetColor
Dtk_ErrorStatus SetColor(const int &R, const int &G, const int &B)
Dtk_Info::create
static Dtk_SmartPtr< Dtk_Info > create()
Calls default constructor to allocate a new object.
Dtk_Oriented2dBBox
This is the base bounding box class. It's used into a lot of 2D Entities This class represents the ba...
Definition: util_draw_dtk.hpp:468
sampleWriter::Coedge1_FE
@ Coedge1_FE
Definition: testcreatecube.cpp:47
Dtk_Polyline::Create
static Dtk_PolylinePtr Create(const Dtk_Polyline &in)
Calls copy constructor to allocate a new object.
Dtk_mesh::add_mesh_face
int add_mesh_face(Dtk_mesh_face *inMesh_face)
Add a face (Dtk_mesh_face) to the mesh.
Dtk_dir
This is a mathematical direction class.
Definition: dtk_dir.hpp:14
Dtk_Oriented2dBBox::Extend
void Extend(const Dtk_Double64 &inXExtend, const Dtk_Double64 &inYExtend)
Extend the bounding box.
Dtk_mesh_face::add_polyline
int add_polyline(const Dtk_tab< Dtk_UInt32 > *inIndices)
Add one polyline.
Dtk_mesh_face::add_points
int add_points(const Dtk_tab< Dtk_UInt32 > *pnts)
sampleWriter::Vertex_E
@ Vertex_E
Definition: testcreatecube.cpp:19
sampleWriter::CreateModelDisplayDesactivated
Dtk_ModelDisplayPtr CreateModelDisplayDesactivated()
Definition: testcreatefdt.cpp:333
Dtk_Volume::Create
static Dtk_VolumePtr Create(const Dtk_BodyPtr &inParentBody)
Create a volume in a body.
sampleWriter::CreateOpenShell
Dtk_BodyPtr CreateOpenShell()
Definition: testcreatecube.cpp:1343
sampleWriter::CreateGeometricalTolerance
Dtk_FdtPtr CreateGeometricalTolerance()
Definition: testcreatefdt.cpp:225
Dtk_MetaData::CreateMetaData
static Dtk_MetaDataPtr CreateMetaData(const MetaDataTypeEnum &inEnumType, Dtk_string inTitle, Dtk_string inValue, Dtk_string inValueType=Dtk_string(L"STRING"))
Create a Dtk_MetaDataPtr .
Dtk_ToleranceSpecificationContainer::TypePosition
@ TypePosition
Definition: util_draw_dtk.hpp:6076
DTK_PI
#define DTK_PI
Definition: str_def.h:8
sampleWriter::Loop3_GDCH
@ Loop3_GDCH
Definition: testcreatecube.cpp:62
Dtk_Entity::info
Dtk_InfoPtr & info()
sampleWriter::Loop4_EFGH
@ Loop4_EFGH
Definition: testcreatecube.cpp:63
sampleWriter::Loop2_FBDG
@ Loop2_FBDG
Definition: testcreatecube.cpp:61
sampleWriter::Edge_HG
@ Edge_HG
Definition: testcreatecube.cpp:33
Dtk_CylindricalSurface::Create
static Dtk_CylindricalSurfacePtr Create(const Dtk_pnt &inOrigin, const Dtk_dir &inNormal, const Dtk_dir &inUDirection, const Dtk_Double64 &inRadius, const Dtk_dir &inYDirection=Dtk_dir())
Create an infinite cylinder.