// A very simple class point with public data representation.
// An incomplete sketch.
// This version uses polar representation.
// NOT RECOMMENDED because of public data representation.
using System;
public class Point {
public double radius, angle;
public Point(double x, double y){
radius = ...
angle = ...
}
public void Move(double dx, double dy){
radius = ...
angle = ...
}
public void Rotate(double angle){
this.angle += angle;
}
public override string ToString(){
...
}
} | | It becomes a big challenge to use this version of class
Point together with client shown previously.
A point represented by polar coordinates.
Still public. Still not recommended.
A point is constructed in terms of
rectangular coordinates. The transformation
is not shown here.
It is easy to program the Rotate method.
Rotation and polar coordinates fits well.
|