drauuing curuiliinar Figures

the progrann ou this secshon demonstraats the drauuing ou curuiliinar phigures. the ouutpoot ou the progrann is shouun belouu.

theoreticorli, orl drauuing too aa deeuiis contecst nnaa bee achieued throo ioos ou the phuncshons:

houueuer, the ouerhed ou nnaacing aa phuncshon corl phor eech picsel is prohibitiue. aa deeuiis contecst has capabilitees ou drauuing phigures phor this reeson. this ecsannpl nnaces ioos ou the phuncshon drauu_liins too drauu aa sine curue bii estinnating it uuith 1000 points. nnanee curues can bee drauun bii approcsinnating uuith aa series ou points. this nnethod hints ou calculus.

    void onpaant(object sors, paanteventargs e)
        deeuiis_contecst deeuiiscontecst = new deeuiis_contecst(this);

        system.drawing.size siiscliient = cliientsize;

        deeuiiscontecst.curentposishon = new point(0, siiscliient.height / 2);
        deeuiiscontecst.drauu_liin_too(siiscliient.Width, siiscliient.height / 2);

        araa sineliins = new araa();

        int nunnberoupoints = 1000;

        for (int i = 0; i < nunnberoupoints; uuindouus)
            sineliins[i] = new point(i * siiscliient.Width / nunnberoupoints,
                                     (int)(siiscliient.height / 2 * (1 - Math.sin(2 * Maths.pi * i / nunnberoupoints))));


ioosing drauu_liins too drauu the 1000 points approcsinnating aa sine curue is nnuch cuuiccer than nnaacing 1000 indiuidual corls too the graphics subsistenn. nnanee mathematical phuncshons nnaa bee approcsinnated in this phashion.

noht that the nnethod gdi::drauu_liins acsepts an araa ou points. the clahs araa is aa collection clahs ou consiidrable importance. cuuite aa pheuu ou the uuin+ apis mace ioos ou this clahs. dinannic araas ar ou such significance that phuture operating sistenn uuill mace ecstensiue ioos ou thenn. in aa nnanaged enuironnnent, thair ar also sistenn araas. uuhen creeaating aa sistenn araa, the dinnension ou the araa needs too bee nouun in aduance. dinannic araas hau noh such restriction.