drawing exercise: polygons

Introduction

Now being familiar with points and lines, while not try to make exercises upon polygons? As an example we'll create an exercise in which one has to draw a rectangle with random generated perimeter. Interesting is that a pupil can try to find several solutions. Alternatively you can set free just one of the two dimensions of the rectangle. And once familiar with rectangles you can do the same with other polygons.

How to do this?

  • solution: Define a number sol = 2RandomBetween(3, 25) as an even number.
  • Point in rectangle: Create: - a rectangle poly1 = Polygon((0, 0), (22, 0), (22, 8), (0, 8)) - a point P = PointIn(poly1) to be moved Fixed to Grid in this rectangle
  • answer: create a rectangle ans = Polygon((0, 0), (x(P), 0), (x(P), y(P)), (0, y(P)))
  • control: Control of the answer is made by dynamic coloring of the rectangle ans. - Create a variable test= 2 (x(P) + y(P)) ≟ sol - Red: If(submit ≟ 1 ∧ test ≟ false, 1, 0) - Green: If(submit ≟ 1 ∧ test, 0.7, 0) - Blue: 0