Fixed bug which could cause excessively slow computation of low point densities - far more points were being considered than necessary due to a wraparound doing unsigned arithmetic when negative results were possible. Tested with the code below, showing that performance remains the same for computing large densities but is vastly improved for computing small densities.
Fixed bug which could cause excessively slow computation of low point densities - far more points were being considered than necessary due to a wraparound doing unsigned arithmetic when negative results were possible. Tested with the code below, showing that performance remains the same for computing large densities but is vastly improved for computing small densities.

import os

import IECore

os.environ["CORTEX_POINTDISTRIBUTION_TILESET"] = "test/IECore/data/pointDistributions/pointDistributionTileSet2048.dat"
pd = IECore.PointDistribution.defaultInstance()

bound = IECore.Box2f( IECore.V2f( 0 ), IECore.V2f( 1 ) )

t = IECore.Timer()

points = pd( bound, 20000000 )

print t.stop()

size = IECore.V2f( 0.05 )
t.start()

for i in range( 0, 1000 ) :
	
	min = IECore.Rand32().nextV2f()
	points = pd( IECore.Box2f( min, min + size ), 20000000 )

print t.stop()

size = IECore.V2f( 0.05 )
t.start()

for i in range( 0, 10000 ) :
	
	min = IECore.Rand32().nextV2f()
	points = pd( IECore.Box2f( min, min + size ), 1000 )

print t.stop()

# results
#########################################
# baseline
#
#	0.61	3.08	3.48
#	0.61	3.08	3.48
#	0.59	3.09	3.48
#
# with fixed unsigned underflow
#
#	0.61	3.08	0.22
#	0.61	3.08	0.22
#	0.62	3.08	0.21


ruschelp/cortex-vfx,code-google-com/cortex-vfx,ruschelp/cortex-vfx,code-google-com/cortex-vfx,code-google-com/cortex-vfx,code-google-com/cortex-vfx,ruschelp/cortex-vfx