occ sample geometry 分析初探2


occ 中的内存管理,也可以采取地址的方式来传引用。


gp_Pnt P1(0,0,5);                                                
gp_Pnt P2(1,2,3);                                                
gp_Pnt P3(2,3,-2);                                                
gp_Pnt P4(4,3,5);                                                
gp_Pnt P5(5,5,4);                                                
TColgp_Array1OfPnt array (1,5); // sizing array                  
array.SetValue(1,P1);                                            
array.SetValue(2,P2);                                            
array.SetValue(3,P3);                                            
array.SetValue(4,P4);                                            
array.SetValue(5,P5);                                            
                                                                 
Standard_Real Tolerance = 8; // ajout de la tolerance            
GProp_PEquation PE (array,Tolerance); 
//Following code is added             
TColgp_Array1OfPnt*  pArray = NULL ;     
pArray = &array;
std::cout << pArray->Length() << "\t" << array.Length() <<std::endl;


//Here I commit a stupid error

//I define a reference in the header file 

//But I define another name in the source code

//the pArray change to the array so bu la bu la

cause this error :

error C2248: 'TColgp_Array1OfPnt::TColgp_Array1OfPnt' : cannot access private member declared in class 'TColgp_Array1OfPnt'

//in the header file

	 static int datatrim(TColgp_Array1OfPnt & pArrayAfterTrim, TColgp_Array1OfPnt rawArray, int trimStep,Standard_Real Tolerance = 1);

//in the source code



int GeomSources::trimRawData( TColgp_Array1OfPnt & arrayAfterTrim, TColgp_Array1OfPnt rawArray, int trimStep, Standard_Real Tolerance/* = 8*/ )
{
	....
	
}

//even this i commit another error to 

I try do the deep copy in the 

 TColgp_Array1OfPnt rawArray
How stupid I was!!!








你可能感兴趣的:(occ sample geometry 分析初探2)