|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ajc.esim.core.Calc
public final class Calc
Field Summary | |
---|---|
static double |
grain
grain is the line length for drawing field lines, decreasing it does not improve resolution, the current value is the best one I have found. |
static double |
k
Coulomb's constant k |
Constructor Summary | |
---|---|
Calc()
|
Method Summary | |
---|---|
static double[] |
calcEF(int x,
int y)
Calculates the electric field and electric potential for a point. |
static double |
cLaw(double charge,
double radius)
Coulomb's law calculator |
static double |
dist(double x1,
double y1,
double x2,
double y2)
Pythagorean Therom - Calculates the distance between two points: (x1,y1) and (x2,y2). |
static java.util.ArrayList<CPoint> |
drawFieldLine(int x,
int y)
Draws a curve representing the electric field line of a group of charge(s). |
static void |
drawLines(java.util.ArrayList<CPoint> pts,
java.awt.Graphics2D g)
|
static void |
drawPELine(double val,
java.awt.Graphics2D g1)
Draws a 'line'(thin graident) where the points on that line all have the same electric potential |
static Prefix |
findPrefix(double val)
Gets the best prefix for a number. |
static boolean |
plus_minus(double val,
double target,
double plusminus)
Determines if a value is with in a range of a target value |
static double |
potential(double charge,
double radius)
Potential enegry formula |
static double |
totalForce(int x,
int y)
Calculates the magnitude of the force (in Newtons) exerted at a point using Pythagoras' Theorem. |
static double[] |
totalForce2(int x,
int y)
Returns an array containing the X force, Y Force and Total Force |
static double[] |
totalForceAngle(int x,
int y)
Returns the total force and angle. |
static double |
totalPE(int x,
int y)
Total potential enegery at a point. |
static java.lang.String |
toTruncString(double val,
int places)
Returns a string representation of a number truncated to a specificed number of places |
static double |
truncate(double val,
int deci)
Truncates a number to the specificed number of decimal places |
static java.awt.Color |
valuGrad(double min,
double max,
double val)
Calculates color based on the input value's location in the range |
static java.awt.Color |
valuGradBW(double min,
double max,
double val)
Modified version of valuGrad for the drawPELine method. |
static double |
vectorAngle(int x,
int y)
Calculates the angle clockwise from verticle that the force points |
static double |
xForce(int x,
int y)
Calculates the horizontal force exerted by all the charges at a given point |
static double |
yForce(int x,
int y)
Calculates the verticle force exerted by all the charges at a given point |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double grain
public static final double k
Constructor Detail |
---|
public Calc()
Method Detail |
---|
public static double[] calcEF(int x, int y)
x
- X Location (in pixels)y
- Y Location (in pixels)
public static double cLaw(double charge, double radius)
charge
- PointCharge with which to calculate the chargeradius
- Distance from the charge(in pixels) to calculate the force at.
public static double dist(double x1, double y1, double x2, double y2)
x1
- X Location of first elementy1
- Y Location of first elementx2
- X Location of second elementy2
- Y Location of second element
public static java.util.ArrayList<CPoint> drawFieldLine(int x, int y)
x
- X location to begin drawingy
- Y location to begin drawingg
- Graphics2D used to drawvaluGrad(double, double, double)
,
totalForce2(int, int)
public static void drawLines(java.util.ArrayList<CPoint> pts, java.awt.Graphics2D g)
public static void drawPELine(double val, java.awt.Graphics2D g1)
val
- Potential at which to draw the lineg1
- Graphics2D with which to paintpublic static Prefix findPrefix(double val)
val
- number to look for a prefix for
Data.getPrefix(int)
public static boolean plus_minus(double val, double target, double plusminus)
val
- value to checktarget
- target valueplusminus
- 'error term' maximum absloute distance from the target value.
public static double potential(double charge, double radius)
charge
- double, charge (in Coulombs)radius
- double, distance from charge to calculate PE at
public static double totalForce(int x, int y)
x
- X Location to calculate the force at.y
- Y Location to calculate the force at.
public static double[] totalForce2(int x, int y)
x
- X Locationy
- Y Location
public static double[] totalForceAngle(int x, int y)
x
- X Locationy
- Y Location
public static double totalPE(int x, int y)
x
- X Locationy
- Y Location
public static java.lang.String toTruncString(double val, int places)
val
- Number to truncateplaces
- Number of places to keep
truncate(double, int)
public static double truncate(double val, int deci)
val
- Number to be truncateddeci
- Number of decimal places to be kept
public static java.awt.Color valuGrad(double min, double max, double val)
min
- minimum value of rangemax
- maximum value of rangeval
- value to find color for
public static java.awt.Color valuGradBW(double min, double max, double val)
min
- Minimum value, if val==min, alpha value is 0: Color is
transparent.max
- Maximum value, if val==max alpha value is 255: Color is fully
opaque.val
- value, must between min and max or color returned will be
null!
public static double vectorAngle(int x, int y)
x
- X location to determine the angley
- Y location to determine the angle
public static double xForce(int x, int y)
x
- X Location to calculate the force aty
- Y Location to calculate the force at
public static double yForce(int x, int y)
x
- X Location to calculate the force aty
- Y Location to calculate the force at
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |