diff options
Diffstat (limited to 'src/display/canvas-axonomgrid.cpp')
| -rw-r--r-- | src/display/canvas-axonomgrid.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index 49ca07ca7..0c2c627c9 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -654,13 +654,13 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) } } -CanvasAxonomGridSnapper::CanvasAxonomGridSnapper(CanvasAxonomGrid *grid, SPNamedView const *nv, NR::Coord const d) : LineSnapper(nv, d) +CanvasAxonomGridSnapper::CanvasAxonomGridSnapper(CanvasAxonomGrid *grid, SPNamedView const *nv, Geom::Coord const d) : LineSnapper(nv, d) { this->grid = grid; } LineSnapper::LineList -CanvasAxonomGridSnapper::_getSnapLines(NR::Point const &p) const +CanvasAxonomGridSnapper::_getSnapLines(Geom::Point const &p) const { LineList s; @@ -685,20 +685,20 @@ CanvasAxonomGridSnapper::_getSnapLines(NR::Point const &p) const // - 2 angled x grid lines, one above and one below the point // Calculate the x coordinate of the vertical grid lines - NR::Coord x_max = Inkscape::Util::round_to_upper_multiple_plus(p[NR::X], scaled_spacing_h, grid->origin[NR::X]); - NR::Coord x_min = Inkscape::Util::round_to_lower_multiple_plus(p[NR::X], scaled_spacing_h, grid->origin[NR::X]); + Geom::Coord x_max = Inkscape::Util::round_to_upper_multiple_plus(p[Geom::X], scaled_spacing_h, grid->origin[Geom::X]); + Geom::Coord x_min = Inkscape::Util::round_to_lower_multiple_plus(p[Geom::X], scaled_spacing_h, grid->origin[Geom::X]); // Calculate the y coordinate of the intersection of the angled grid lines with the y-axis - double y_proj_along_z = p[NR::Y] - grid->tan_angle[Z]*(p[NR::X] - grid->origin[NR::X]); - double y_proj_along_x = p[NR::Y] + grid->tan_angle[X]*(p[NR::X] - grid->origin[NR::X]); - double y_proj_along_z_max = Inkscape::Util::round_to_upper_multiple_plus(y_proj_along_z, scaled_spacing_v, grid->origin[NR::Y]); - double y_proj_along_z_min = Inkscape::Util::round_to_lower_multiple_plus(y_proj_along_z, scaled_spacing_v, grid->origin[NR::Y]); - double y_proj_along_x_max = Inkscape::Util::round_to_upper_multiple_plus(y_proj_along_x, scaled_spacing_v, grid->origin[NR::Y]); - double y_proj_along_x_min = Inkscape::Util::round_to_lower_multiple_plus(y_proj_along_x, scaled_spacing_v, grid->origin[NR::Y]); + double y_proj_along_z = p[Geom::Y] - grid->tan_angle[Z]*(p[Geom::X] - grid->origin[Geom::X]); + double y_proj_along_x = p[Geom::Y] + grid->tan_angle[X]*(p[Geom::X] - grid->origin[Geom::X]); + double y_proj_along_z_max = Inkscape::Util::round_to_upper_multiple_plus(y_proj_along_z, scaled_spacing_v, grid->origin[Geom::Y]); + double y_proj_along_z_min = Inkscape::Util::round_to_lower_multiple_plus(y_proj_along_z, scaled_spacing_v, grid->origin[Geom::Y]); + double y_proj_along_x_max = Inkscape::Util::round_to_upper_multiple_plus(y_proj_along_x, scaled_spacing_v, grid->origin[Geom::Y]); + double y_proj_along_x_min = Inkscape::Util::round_to_lower_multiple_plus(y_proj_along_x, scaled_spacing_v, grid->origin[Geom::Y]); // Calculate the normal for the angled grid lines - NR::Point norm_x = NR::rot90(NR::Point(1, -grid->tan_angle[X])); - NR::Point norm_z = NR::rot90(NR::Point(1, grid->tan_angle[Z])); + Geom::Point norm_x = Geom::rot90(Geom::Point(1, -grid->tan_angle[X])); + Geom::Point norm_z = Geom::rot90(Geom::Point(1, grid->tan_angle[Z])); // The four angled grid lines form a parallellogram, enclosing the point // One of the two vertical grid lines divides this parallellogram in two triangles @@ -708,8 +708,8 @@ CanvasAxonomGridSnapper::_getSnapLines(NR::Point const &p) const // The vertical grid line is at the intersection of two angled grid lines. // Now go find that intersection! Geom::Point result; - Geom::IntersectorKind is = line_intersection(norm_x, norm_x[NR::Y]*y_proj_along_x_max, - norm_z, norm_z[NR::Y]*y_proj_along_z_max, + Geom::IntersectorKind is = line_intersection(norm_x, norm_x[Geom::Y]*y_proj_along_x_max, + norm_z, norm_z[Geom::Y]*y_proj_along_z_max, result); // Determine which half of the parallellogram to use @@ -717,7 +717,7 @@ CanvasAxonomGridSnapper::_getSnapLines(NR::Point const &p) const bool use_right_half = true; if (is == Geom::intersects) { - use_left_half = (p[NR::X] - grid->origin[NR::X]) < result[Geom::X]; + use_left_half = (p[Geom::X] - grid->origin[Geom::X]) < result[Geom::X]; use_right_half = !use_left_half; } @@ -726,21 +726,21 @@ CanvasAxonomGridSnapper::_getSnapLines(NR::Point const &p) const // Return the three grid lines which define the triangle that encloses our point // If we didn't find an intersection above, all 6 grid lines will be returned if (use_left_half) { - s.push_back(std::make_pair(norm_z, NR::Point(grid->origin[NR::X], y_proj_along_z_max))); - s.push_back(std::make_pair(norm_x, NR::Point(grid->origin[NR::X], y_proj_along_x_min))); - s.push_back(std::make_pair(component_vectors[NR::X], NR::Point(x_max, 0))); + s.push_back(std::make_pair(norm_z, Geom::Point(grid->origin[Geom::X], y_proj_along_z_max))); + s.push_back(std::make_pair(norm_x, Geom::Point(grid->origin[Geom::X], y_proj_along_x_min))); + s.push_back(std::make_pair(component_vectors[Geom::X], Geom::Point(x_max, 0))); } if (use_right_half) { - s.push_back(std::make_pair(norm_z, NR::Point(grid->origin[NR::X], y_proj_along_z_min))); - s.push_back(std::make_pair(norm_x, NR::Point(grid->origin[NR::X], y_proj_along_x_max))); - s.push_back(std::make_pair(component_vectors[NR::X], NR::Point(x_min, 0))); + s.push_back(std::make_pair(norm_z, Geom::Point(grid->origin[Geom::X], y_proj_along_z_min))); + s.push_back(std::make_pair(norm_x, Geom::Point(grid->origin[Geom::X], y_proj_along_x_max))); + s.push_back(std::make_pair(component_vectors[Geom::X], Geom::Point(x_min, 0))); } return s; } -void CanvasAxonomGridSnapper::_addSnappedLine(SnappedConstraints &sc, NR::Point const snapped_point, NR::Coord const snapped_distance, NR::Point const normal_to_line, NR::Point const point_on_line) const +void CanvasAxonomGridSnapper::_addSnappedLine(SnappedConstraints &sc, Geom::Point const snapped_point, Geom::Coord const snapped_distance, Geom::Point const normal_to_line, Geom::Point const point_on_line) const { SnappedLine dummy = SnappedLine(snapped_point, snapped_distance, getSnapperTolerance(), getSnapperAlwaysSnap(), normal_to_line, point_on_line); sc.grid_lines.push_back(dummy); |
