Exemple #1
0
	tri2_closest_edge_info tri2::get_closest_position_on_edge(const vec2& p, int edge_index) const {
		const auto ray = make_edge_ray(edge_index);

		tri2_closest_edge_info cei;
		cei._edge_t = ray.get_closest_t_constrained(p);
		cei._position_on_edge = ray.get_position_on_ray(cei._edge_t);
		cei._distance_squared = get_distance_squared(p, cei._position_on_edge);
		cei._edge_index = edge_index;
		return cei;
	}
static inline float get_distance (ColorSample s, int x, int y)
{
  // TODO(rggjan): Remove sqrt to get faster code?
  return sqrt(get_distance_squared(s, x, y));
}