Constructors

The Phasor class supports 3 different constructor types in two different functions.
The first two both have doubles as their inputs so a boolean flag is used to determine which mode is correct. The third takes another phasor and creates an instance with the same values.
  1. phasor(double x_cord,double y_cord, bool true) - This constructor takes the supplied xcord and ycord values and returns a phasor.
  2. phasor(double radius, double angle, bool false) - This constructor takes the supplied radius and angle(in degrees) and returns a phasor.
  3. phasor(double radius, double angle, int num_disp_digits, bool false) - This constructor takes the supplied radius and angle(in degrees), and the desired display digits and returns a phasor.
  4. phasor(phasor p) - This constructor takes a previously created phasor and returns an instance with the same internal fields.
#phasor() - This constructor returns a phasor with the main values set to 0.

Support Methods

private void update_on_radius() - Updates the phasor members when the Mag accessor is set.
private void update_on_angle() - Updates the phasor members when the either of the Angle is set.
private void update_on_cord() - Updates the phasor members when the either of the Coordinates is set.

public string error_str() - Returns an error message explaining the current error.

private double rad2deg(double rad) - Converts from radians to degrees
private double rad2deg(double rad) - Converts from degrees to radians

public void phas2rect(ref double x_out, ref double y_out) - Passes out the current x and y values at once. Convenience over calling the accessors

private void comp_conj() - Sets the phasor to its complex conjugate.
private void comp_conj(phasor p) - Sets the phasor to the complex conjugate of p.

Public Overrides

public override int GetHashCode()- Returns an Integer Hash Code. This is just the Math.Floor(mX_Cord * mY_cord)
public override string ToString() - Returns the phasor as string. Prints the phasor like this Mag /_ Angle

Last edited May 7, 2011 at 9:35 PM by Justinius, version 5

Comments

No comments yet.