Because of a school project I'm working on (a 3D modeler using
GnomeCanvas), I need to make sure that the routine that checks if a point
belongs to an item. I'm using exclusively GnomeCanvasLine. 
  gnome_canvas_get_item_at  calls the function
gnome_canvas_item_invoke_point, which calls the item's point virtual
function.  This function calculates the distance between the point and
each of the item's edges, using formulas like 			
	dist = sqrt (dx * dx + dy * dy) - width / 2.0;

  This is very slow; my teacher says we should use something like
	dist = dx; if the line's inclination is < 1.0, or
	dist = dy; otherwise.

  gnome_canvas_item_invoke_point is also invoked as the pointer moves
across the canvas, to synthesize enter/leave notify events to canvas
items. This is also very slow. Amazingly, I don't notice it being slow. I
must be reading the code wrong. If not, can I make a patch to GnomeCanvas?

Gustavo J.A.M. Carneiro

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]