google-code-export / papervision3d

Automatically exported from code.google.com/p/papervision3d
1 stars 1 forks source link

zero divide by zero #110

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Trace the code on John Lindquist's example http://pv3d.org/node/56
2. When you get into DisplayObject3D/Project the line of code says
   return this.screenZ = screenZs / children;
3. Both screenZs and children are zero.

What is the expected output? What do you see instead?
All works as expected so I guess the error is caught and handled.

What version of the product are you using?
Papervision3D v2.0 - public Beta Sept. 9th 2008

On what operating system?
Vista Ultimate x64 in Flex Builder 3.01

Please provide any additional information below.

Original issue reported on code.google.com by Whistler...@gmail.com on 26 Sep 2008 at 3:06

Attachments:

GoogleCodeExporter commented 9 years ago
Additional/contributing error...
public override function project( parent :DisplayObject3D,
renderSessionData:RenderSessionData ):Number
{
 // Vertices
 super.project( parent, renderSessionData );
 var line3D:Line3D;
 var screenZ:Number;  // COMING THRU AS NAN BELOW

 for each(line3D in lines){
  if(renderSessionData.viewPort.lineCuller.testLine(line3D)) {                
line3D.renderCommand.renderer = line3D.material;
   screenZ+=line3D.renderCommand.screenDepth = (line3D.v0.vertex3DInstance.z +
              line3D.v1.vertex3DInstance.z)/2;
  renderSessionData.renderer.addToRenderList(line3D.renderCommand);
 }
}

            return screenZ/(lines.length+1);
        }

Original comment by Whistler...@gmail.com on 6 Oct 2008 at 3:40

GoogleCodeExporter commented 9 years ago
This is not a bug. You need to set the calculateScreenCoords property to true 
for the
screen coords to be calculated.

Original comment by r.hauw...@gmail.com on 17 Oct 2008 at 1:46