Hey, I want to write the line modeling application. You've got a line and you can model it in the way you want, add new points on the line, drag them, making brezier curves between them, making straight lines between them etc. I was trying with QPainterPath and functions like cubicTo etc, but there is not much information about current line (for example: y coordinate at given x coordinate on that line). I was also trying to use OpenCascade libraries, but it seems too complicated for such application and I cannot find easy examples which shows how to make 2D scene and draw on it.
Could you give me some hints what tools may i use? Or maybe some examples with such applications?
Hi, welcome to devnet
bq. but there is not much information about current line (for example: y coordinate at given x coordinate on that line)
Because at any given x there might be several or no y if it's a curve. QPainterPath is not a mathematical tool to solve equations.
You can easily get a point in a distance from one end of the line using percentAtLength() and then feed it into pointAtPercent().
What functionality are you looking for specifically?
I should be able to add new movable points on the line and model the path between them (straight line, arc, other curve). It would be nice if i can have information about y coordinate of the line at given x. I was thinking about checking QImage for pixels to get this information if there would no other way.
You want to create a platform to be able to draw and change what you have previously drawn. Want to create a CAD right?
Yes, something like that, but i need only line modeling functionality.
Look at QGraphicsScene Class. -> addLine