public PicPoint RotateAroundOrigin(int origX, int origY, double rot) { PicPoint result = new PicPoint(m_x, m_y); // Create a rotated point double offsetX = m_x - origX; double offsetY = m_y - origY; offsetX = offsetX * Math.Cos(rot) - offsetY * Math.Sin(rot); offsetY = offsetY * Math.Cos(rot) + offsetX * Math.Sin(rot); offsetX = offsetX + origX; offsetY = offsetY + origY; int rotX = Convert.ToInt32(offsetX); int rotY = Convert.ToInt32(offsetY); return(new PicPoint(rotX, rotY)); }
protected double GetPixelValue(int x, int y) { double pointValue = 0; // Store original point PicPoint origPt = new PicPoint(x - (_xSize / 2), y - (_ySize / 2)); PicPoint finalPt = origPt; finalPt.RotateAroundOrigin(0, 0, _rotation); for (int z = 0; z < _nexii.Count; z++) { double dist = 0.0; // Mod determines whether to judge distance on X, Y, or both (majority will be both) switch (z % _mod) { case 0: dist = _nexii[z].point.XDistanceTo(finalPt.X); break; case 1: dist = _nexii[z].point.YDistanceTo(finalPt.Y); break; default: dist = _nexii[z].point.DistanceTo(finalPt.X, finalPt.Y); break; } if (dist < _maxDist) { pointValue += dist * _nexii[z].boost; } } return(pointValue); }