// DAZ Studio version 4.9.2.70 filetype DAZ Script
//plot( 3, 10 );
//plot( 10, 3 );
//plot( -3, 10 );
//plot( 10, -3 );
//plot( 3, -10 );
//plot( -10, 3 );
//plot( -3, -10 );
plot( -10, -3 );
var dirx;
var diry;
function plot( dx, dy )
{
var adx = Math.abs( dx );
var ady = Math.abs( dy );
dirx = dx >= 0; //replace by set motor x direction
diry = dy >= 0; //replace by set motor x direction
if( adx >= ady )
{
subplot( 0, adx, ady );
}
else
{
subplot( 1, ady, adx );
}
}
function subplot( horizVert, dx, dy )
{
var D = 2 * dy - dx;
var y = 0;
for( x = 0; x <= dx; x++ )
{
if( horizVert == 0 )
{
subsubplot( x, y );
}
else
{
subsubplot( y, x );
}
if( D > 0 )
{
y = y + 1
D = D - dx
}
D = D + dy
}
}
function subsubplot( x, y )
{
debug( !dirx ? -x : x, !diry ? -y : y );
}
Tuesday, January 17, 2017
Bresenham Line implementation in Daz Studio Script
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment