c# - OxyPlot Contour Series -
i want make contour plot live x-y coordinate data (using oxyplot).
i've seen example given using contourseries
, , i'm having trouble understanding how achieve contours.
here example code:
namespace examplelibrary { using system; using oxyplot; using oxyplot.axes; using oxyplot.series; [examples("contourseries"), tags("series")] public class contourseriesexamples { private static func<double, double, double> peaks = (x, y) => 3 * (1 - x) * (1 - x) * math.exp(-(x * x) - (y + 1) * (y + 1)) - 10 * (x / 5 - x * x * x - y * y * y * y * y) * math.exp(-x * x - y * y) - 1.0 / 3 * math.exp(-(x + 1) * (x + 1) - y * y); [example("peaks")] public static plotmodel peaks() { var model = new plotmodel { title = "peaks" }; var cs = new contourseries { columncoordinates = arraybuilder.createvector(-3, 3, 0.05), rowcoordinates = arraybuilder.createvector(-3.1, 3.1, 0.05) }; cs.data = arraybuilder.evaluate(peaks, cs.columncoordinates, cs.rowcoordinates); model.subtitle = cs.data.getlength(0) + "×" + cs.data.getlength(1); model.series.add(cs); return model; } }
some of things don't understand 'peaks' math equation (what's purpose, how derived?) , other thing don't understand how contour derived.
to understand "peaks", need familiar general delegate func<t, tresult>
. in example, generate delegate "peaks" has 2 double
inputs, , 1 output result double
also. inputs assumingly x , y. output function after lambda "=>".
regarding second question; how contour derived? can imagine contours 3d object drawn on plain xy cartesian, @ each x,y there value of z on same plain.
Comments
Post a Comment