public void Transform(Matrix3 m, ChartStyle cs) { // Normalize the point: float x1 = (X - cs.XMin) / (cs.XMax - cs.XMin) - 0.5f; float y1 = (Y - cs.YMin) / (cs.YMax - cs.YMin) - 0.5f; float z1 = (Z - cs.ZMin) / (cs.ZMax - cs.ZMin) - 0.5f; float[] result = m.VectorMultiply(new float[4] { x1, y1, z1, W }); X = result[0]; Y = result[1]; // Coordinate transformation from World to Device system: float xShift = 1.05f; float xScale = 1; float yShift = 1.05f; float yScale = 0.9f; if (cs.Title == "No Title") { yShift = 0.95f; yScale = 1f; } if (cs.IsColorBar) { xShift = 0.95f; xScale = 0.9f; } X = (xShift + xScale * X) * cs.ChartArea.Width / 2; Y = (yShift - yScale * Y) * cs.ChartArea.Height / 2; }
public void TransformNormalize(Matrix3 m) { float[] result = m.VectorMultiply(new float[4] { X, Y, Z, W }); X = result[0] / result[3]; Y = result[1] / result[3]; Z = result[2]; W = 1; }