OCC22357 Hidden face selection
[occt.git] / src / MeshVS / MeshVS_DataSource3D.cxx
CommitLineData
7fd59977 1// File: MeshVS_DataSource3D.cxx
2// Created: Fri Jan 21 2005
3// Author: Alexander SOLOVYOV
4// Copyright: Open CASCADE 2005
5
6#include <MeshVS_DataSource3D.ixx>
7
8//================================================================
9// Function : GetPrismTopology
10// Purpose :
11//================================================================
12Handle( MeshVS_HArray1OfSequenceOfInteger )
13 MeshVS_DataSource3D::GetPrismTopology( const Standard_Integer BasePoints ) const
14{
15 if( myPrismTopos.IsBound( BasePoints ) )
16 return myPrismTopos.Find( BasePoints );
17 else
18 {
19 Handle( MeshVS_HArray1OfSequenceOfInteger ) result = CreatePrismTopology( BasePoints );
20 if( !result.IsNull() )
21 ( ( MeshVS_DataSource3D* )this )->myPrismTopos.Bind( BasePoints, result );
22 return result;
23 }
24}
25
26//================================================================
27// Function : GetPyramidTopology
28// Purpose :
29//================================================================
30Handle( MeshVS_HArray1OfSequenceOfInteger )
31 MeshVS_DataSource3D::GetPyramidTopology( const Standard_Integer BasePoints ) const
32{
33 if( myPyramidTopos.IsBound( BasePoints ) )
34 return myPyramidTopos.Find( BasePoints );
35 else
36 {
37 Handle( MeshVS_HArray1OfSequenceOfInteger ) result = CreatePyramidTopology( BasePoints );
38 if( !result.IsNull() )
39 ( ( MeshVS_DataSource3D* )this )->myPyramidTopos.Bind( BasePoints, result );
40 return result;
41 }
42}
43
44//================================================================
45// Function : CreatePrismTopology
46// Purpose :
47//================================================================
48Handle( MeshVS_HArray1OfSequenceOfInteger )
49 MeshVS_DataSource3D::CreatePrismTopology( const Standard_Integer BasePoints )
50{
51 Handle( MeshVS_HArray1OfSequenceOfInteger ) result;
52
53 if( BasePoints>=3 )
54 {
55 result = new MeshVS_HArray1OfSequenceOfInteger( 1, BasePoints+2 );
56 Standard_Integer i, next;
57
58 for( i=0; i<BasePoints; i++ )
59 {
60 result->ChangeValue( 1 ).Prepend( i );
61 result->ChangeValue( 2 ).Append( i+BasePoints );
62
63 result->ChangeValue( 3+i ).Prepend( i );
64 result->ChangeValue( 3+i ).Prepend( i+BasePoints );
65 next = ( i+1 ) % BasePoints;
66 result->ChangeValue( 3+i ).Prepend( next+BasePoints );
67 result->ChangeValue( 3+i ).Prepend( next );
68 }
69 }
70
71 return result;
72}
73
74//================================================================
75// Function : CreatePyramidTopology
76// Purpose :
77//================================================================
78Handle( MeshVS_HArray1OfSequenceOfInteger )
79 MeshVS_DataSource3D::CreatePyramidTopology( const Standard_Integer BasePoints )
80{
81 Handle( MeshVS_HArray1OfSequenceOfInteger ) result;
82
83 if( BasePoints>=3 )
84 {
85 result = new MeshVS_HArray1OfSequenceOfInteger( 1, BasePoints+1 );
86
87 for( Standard_Integer i=1; i<=BasePoints; i++ )
88 {
89 result->ChangeValue( 1 ).Prepend( i );
90 result->ChangeValue( 1+i ).Append( 0 );
91 result->ChangeValue( 1+i ).Append( i );
92 result->ChangeValue( 1+i ).Append( i%BasePoints + 1 );
93 }
94 }
95
96 return result;
97}