wolfram mathematica - Plot3D: Drawing Points at Mesh Intersections -
i want draw points @ visible mesh intersections, this:
plot3d[sin[x + y^2], {x, -3, 3}, {y, -2, 2}, mesh -> {1, 4}, boxed -> false]
desired output:
i calculate mesh going be, based on plotrange , mesh cardinality, , draw points there, think there should easier alternative way.
a big plus able chose point color based upon function value. also, labeling points wonderful.
any ideas?
for it's worth, simple solution well. plus easy use same coloring function both surface , points:
g = plot3d[sin[x + y^2], {x, -3, 3}, {y, -2, 2}, mesh -> {1, 4}, boxed -> false, colorfunction -> "rainbow"]; p = listpointplot3d[table[{x, y, sin[x + y^2]}, {x, -3, 3, (3 - (-3))/(1 + 1)}, {y, -2, 2, (2 - (-2))/(4 + 1)}], colorfunction -> "rainbow", plotstyle -> pointsize[large]]; show[g, p]
edit: if want make customized myplot3d, think following should do:
myplot3d[f_, {x_, xmin_, xmax_}, {y_, ymin_, ymax_}, mesh -> {i_integer, j_integer}, opts : optionspattern[]] := module[{g = plot3d[f, {x, xmin, xmax}, {y, ymin, ymax}, mesh -> {i, j}, evaluate@filterrules[{opts}, options[plot3d]]], stx = (xmax - xmin)/(i + 1), sty = (ymax - ymin)/(j + 1), pts}, pts = listpointplot3d[ table[{x, y, f}, {x, xmin + stx, xmax - stx, stx}, {y, ymin + sty, ymax - sty, sty}], evaluate@filterrules[{opts}, options[listpointplot3d]]]; show[g, pts]];
note options applied both plots, filtered first. removed points on contour of plot. example,
myplot3d[sin[x + y^2], {x, -3, 3}, {y, -2, 2}, mesh -> {4, 10}, boxed -> false, colorfunction -> "rainbow", axes -> false, plotstyle -> pointsize[large]]
will give result
Comments
Post a Comment