Issue with DelaunayMesh, wrong mesh or bad construction? please help

Software: Away3D 4.x

Avatar
martiniDave, Newbie
Posted: 15 October 2013 09:04 PM   Total Posts: 9

I am trying to make a plane in the shape of a pie wedge and am having trouble with reliability. Could anyone tell me what I am doing wrong.
I have included an illustration of the issue.
A is an example of the plotted points.
B is how it comes out sometimes.
C is how it comes out sometimes but is undesirable.

If there is a better alternative to DelaunayMesh or I am in error, any assistance would be appreciated.

Here is my code:

private function makeCharts():void{
 
var counter:Number = 0;  
 for(
i=0;i<pieEventsArray.length;++i){
  
for(j=0;j<annualEventArray.length;++j){
   
if(pieEventsArray[i] == annualEventArray[j].refNumber){
    
var pMat:ColorMaterial = new ColorMaterial (0x11A200, 1);
    var 
piePlaneY:Number = PIE_PLANE + (i * PIE_SEP);    if(annualEventArray[j].numOfSegs > 0){
     pieChart3d
.makePieCharts(piePlaneY, annualEventArray[j].start1,annualEventArray[j].end1, counter);
     var 
panelPPts = new Vector.<Vector3D>;
     for(
q=0;q<pieChart3d.pieSegArray.length;++q){
     panelPPts
.push(new Vector3D(pieChart3d.pieSegArray[q].AX,pieChart3d.pieSegArray[q].AY,pieChart3d.pieSegArray[q].AZ));
    
}
   _chartPie 
= new DelaunayMesh(pMat,panelPPts);
   
_view.scene.addChild(_chartPie);
   
counter +=1
   }
  }
 }
}

////////////////////////////// in class named pieChart3d.as

public function makePieCharts(piePlane:Number, startNum:Number, endNum:Number, count:Number):void{
 
//////////plotting the points////////////////
 
var segWidthNum:Number = endNum - startNum;
 var 
pointProgresser:Number = 0;
 var 
adjustedRadius:Number = MAIN_RADIUS - (PIE_SEG_HIEGHT * count);
 
pieSegArray[0]=[];
 
pieSegArray[0].AX = 0;
 
pieSegArray[0].AY = piePlane;
 
pieSegArray[0].AZ = 0;
 for(
q= 1; q< segWidthNum + 1; ++q){
  pieSegArray[q]
=[];
  
pieSegArray[q].AX = Math.sin(pointProgresser)*(adjustedRadius);
  
pieSegArray[q].AY = piePlane;
  
pieSegArray[q].AZ = Math.cos(pointProgresser)*(adjustedRadius);
  
pointProgresser += POINT_WIDTH;
 
}
 pieSegArray[segWidthNum 
+ 1]=[];
 
pieSegArray[segWidthNum + 1].AX = 0;
 
pieSegArray[segWidthNum + 1].AY = piePlane;
 
pieSegArray[segWidthNum + 1].AZ = 0;   
} 

Thanks
ps. any thoughts on the right mesh to extrude this shape would be appreciated.

 

 

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X