### 26.8.3 Rectangles in the plane

See Section 27.7.3 for rectangles in space.

The rectangle creates rectangles.

- rectangle takes three mandatory arguments and two optional arguments:
  - A,B, two points.
  - k, a nonzero real number.
  - Optionally, varc, vard, two variable names.
- rectangle(A,B,k⟨,varc,vard⟩) returns and draws the rectangle ABCD, where AD=|k|· AB and the angle from AB to AD is counterclockwise if k > 0, clockwise if k<0.

  If the arguments varc and vard are given, then C and D will be assigned to them.

#### Examples

rectangle(0,1+i,1/2)

rectangle(0,1+i,-1/2)

rectangle(0,1+i,-1/2,C,D)

affix(C),affix(D)

1
2

−

i
2

,

3
2

+

i
2

Given rectangle(A,B,k), Xcas computes D by affix(D)=affix(A) + k eiπ/2(affix(B)−affix(A)). If k is complex, then rectangle draws a parallelogram.

#### Example

rectangle(0,1,1+i)