[GRASS-dev] Vect_line_buffer tolerance setting

Hamish hamish_b at yahoo.com
Sun May 18 04:08:45 EDT 2008


Maris:
> Unfortunately this is a quite big problem for GRASS if nobody
> from -dev ML can not explain how GRASS internal stuff works :(

It's not so bad, Radim did leave notes.  e.g. in lib/vector/Vlib/buffer.c in the case of public functions they are even Doxygen-ized so they appear in the programmer's manual. For me "grep" does the job.


/*!
  \brief Create parrallel line
  
  \param InPoints input line
  \param distance create parrallel line in distance
  \param tolerance maximum distance between theoretical arc and polygon segments
  \param rm_end remove end points falling into distance
  \param[out] OutPoints output line

  \return
*/
void
Vect_line_parallel ( ... )
{
....
}

here is the relevant code:


Vect_line_buffer()
....
    dangle = 2 * acos( 1-tolerance/fabs(distance) ); /* angle step */


 parallel_line()
....
    atol = 2 * acos( 1-tol/fabs(d) );
....
    /* TODO: a <= PI can probably fail because of representation error */
    if ( a <= PI && a > atol)
    {
	na = (int) (a/atol);
	atol2 = a/(na+1) * side;
	for (j = 0; j < na; j++)
	{
	    av+=atol2;
	    nx = x[i+1] + fabs(d) * cos(av);
	    ny = y[i+1] + fabs(d) * sin(av);
	    Vect_append_point ( nPoints, nx, ny, 0 );
	}
    }



Hamish



      



More information about the grass-dev mailing list