0

I try to make my own function for drawing lines on bitmap. All lines pass through center coordinate. I faced with several problems:

  1. Well known line equation y=tan(a)x as is doesn't work for me. Because I don't know how to match i,j coordinates in bitmap and x,y in Cartesian coordinate system.

  2. How to make start point center of bitmap and end its bound. Maybe someone know library for this for c# it will be worse than own implementation but still help me a lot.

scheme

SkiF
  • 45
  • 8
  • Very unclear what exactly you have problem with. Possibly https://stackoverflow.com/questions/11678693/all-cases-covered-bresenhams-line-algorithm could help, but it sounds like you have problems even before drawing line... – Alexei Levenkov Nov 21 '18 at 18:45
  • [Matrix.RotateAt](https://learn.microsoft.com/en-us/dotnet/api/system.drawing.drawing2d.matrix.rotateat). Or [Graphics.RotateTransform](https://learn.microsoft.com/en-us/dotnet/api/system.drawing.graphics.rotatetransform). These in the `System.Drawing` namespace. In `System.Windows.Media` you have similar methods [Matrix](https://learn.microsoft.com/en-us/dotnet/api/system.windows.media.matrix) and [RotateTransform](https://learn.microsoft.com/en-us/dotnet/api/system.windows.media.rotatetransform.-ctor). Start from these. – Jimi Nov 21 '18 at 19:05

0 Answers0