コード例 #1
0
        void AddCoef(Point vertex1, Point vertex2, List <LineEquationCoef> equationCoef)
        {
            LineEquationCoef coef = new LineEquationCoef();

            coef.kx = (vertex2.y - vertex1.y) / (vertex2.x - vertex1.x);
            coef.c  = (-1 * (vertex1.x * (vertex2.y - vertex1.y) / (vertex2.x - vertex1.x))) + vertex1.y;
            equationCoef.Add(coef);
        }
コード例 #2
0
        int GetY(LineEquationCoef coef, int x)
        {
            double toReturn = (coef.kx * x + coef.c);

            return((int)Math.Ceiling(toReturn));
        }