-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Description
Feature Suggestion
Overload VectorField() signature to allow for a List of vectors
Current VectorField signature is:
public VectorField(
Vector2[,] vectors,
double[] xs,
double[] ys,
Colormap colormap,
double scaleFactor,
Color defaultColor)which assumes that data are arrayed in a uniformly spaced 2D array, i.e., Vector2[,].
We are working with more or less randomly positioned vector data, which converts into a very sparse Vector2[,] matrix, which the current VectorField() function cannot process. Being able to send a 1D array or of doubleXY vectors (see code below) to the VectorField() function would allow the plotting of randomly positioned vectors. The overloaded VectorField() signature would look like this:
public VectorField(
doubleXY[] vectors,
double[] xs,
double[] ys,
Colormap colormap,
double scaleFactor,
Color defaultColor)where; the "vectors", "xs" and "ys" arrays are linked lists of vectors, xPositions and yPositions respectively; and doubleXY is defined as follows:
class doubleXY
public class doubleXY
{
public double X { get; set; }
public double Y { get; set; }
public doubleXY()
{
X = 0;
Y = 0;
}
public doubleXY(double x, double y)
{
X = x;
Y = y;
}
public doubleXY(string x, string y)
{
X = 0;
Y = 0;
double tempX;
if (double.TryParse(x, out tempX))
{
X = tempX;
}
double tempY;
if (double.TryParse(y, out tempY))
{
Y = tempY;
}
}
public override string ToString()
{
return String.Format("X: {0}, Y:{1}", X, Y);
}
public override bool Equals(Object obj)
{
//Check for null and compare run-time types.
if ((obj == null) || !this.GetType().Equals(obj.GetType()))
{
return false;
}
else
{
doubleXY p = (doubleXY)obj;
return (X == p.X) && (Y == p.Y);
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels