All pastes #454302 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-04-23 14:42 UTC
rendered paste body
        private void knopOppervlakte_Click(object sender, EventArgs e)
        {
            int oppervlakte = 0;
            int n = puntLijst.Count;
            Punt oorsprong = new Punt(0, 0);
            Vector vi, vii;
            for (int i = 1; i < n - 3; ++i)
            {

                /*vi = new Vector(puntLijst[i - 1].X, puntLijst[i - 1].Y);
                vii = new Vector(puntLijst[i].X, puntLijst[i].Y);*/
                vi = puntLijst[i - 1] - oorsprong;
                vii = puntLijst[i] - oorsprong;
                oppervlakte += (vi % vii);
                schrijfLog("Oppervlakte na " + i + " : " + oppervlakte);
            }
            /*vi = new Vector(puntLijst[n - 2].X, puntLijst[n - 2].Y);
            vii = new Vector(puntLijst[n - 1].X, puntLijst[n - 1].Y);*/
            vi = puntLijst[n - 2] - oorsprong;
            vii = puntLijst[n - 1] - oorsprong;
            oppervlakte += (vi % vii);
            schrijfLog("Oppervlakte n-2, n-1:" + oppervlakte);
            /*vi = new Vector(puntLijst[n - 1].X, puntLijst[n - 1].Y);
            vii = new Vector(puntLijst[0].X, puntLijst[0].Y);*/
            vi = puntLijst[n - 1] - oorsprong;
            vii = puntLijst[0] - oorsprong;
            oppervlakte += (vi % vii);
            schrijfLog("Oppervlakte n-1, 0:" + oppervlakte);
            oppervlakte /= 2;

            schrijfLog("Oppervlakte: " + oppervlakte);
        }