Back to notes -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'  Slide program -- Keyboard shortcut: 't'    A version of class Point modified to use polar coordinates - NOT Recommended.Lecture 3 - slide 10 : 29
Program 3
// 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.