P
Purple_Apple
Guest
Hello. For drawing lines (edges of triangles) I use the following GDI+ function:
Status DrawLine(
IN const Pen *pen,
IN const PointF & pt1,
IN const PointF & pt2
);
I have the structure that I use.
// Represents the edge of a triangle that is part of the set
// of triangles drawn in the application window that make up
// the triangulation mesh.
struct EdgeToDraw
{
EdgeToDraw() {}
EdgeToDraw(long X_begin, long Y_begin, long X_end, long Y_end)
{
Begin.X = X_begin;
Begin.Y = Y_begin;
End.X = X_end;
End.Y = Y_end;
}
// X and Y coordinates of begin edge vertex.
PointF Begin;
// X and Y coordinates of end edge vertex.
PointF End;
};
The thread of constructing a triangulation places the coordinates of the edges in the concurrent_queue container
concurrent_queue<EdgeToDraw> MeshEdgesBuffer;
and another thread takes them from there (in WndProc WM_PAINT) in order to draw. Below I show how I put instances of EdgeToDraw in a concurrent_queue container.
// Add an edge for the drawn triangulation mesh.
MeshEdgesBuffer.push(EdgeToDraw(X_begin, Y_begin, X_end, Y_end));
But here, the accuracy of the added values is lost. For example if X_begin == -0.522 and Y_begin == 2.169 (where X_begin and Y_begin have double type), then MeshEdgesBuffer[0].Begin.X == 0 and MeshEdgesBuffer[0].Begin.Y == 2. And so on. But for me, the numbers to the right of the decimal point are very important. Highly. As I understand it, the PointF class is specifically designed to express coordinates with decimal point values. Please tell me what I am doing wrong and how can I make sure that the accuracy of numbers is not lost? That is, if X_begin == -0.522, then Begin.X is of the same value (-0.522) but not is 0 or 0.000. Thank you in advance.
Continue reading...
Status DrawLine(
IN const Pen *pen,
IN const PointF & pt1,
IN const PointF & pt2
);
I have the structure that I use.
// Represents the edge of a triangle that is part of the set
// of triangles drawn in the application window that make up
// the triangulation mesh.
struct EdgeToDraw
{
EdgeToDraw() {}
EdgeToDraw(long X_begin, long Y_begin, long X_end, long Y_end)
{
Begin.X = X_begin;
Begin.Y = Y_begin;
End.X = X_end;
End.Y = Y_end;
}
// X and Y coordinates of begin edge vertex.
PointF Begin;
// X and Y coordinates of end edge vertex.
PointF End;
};
The thread of constructing a triangulation places the coordinates of the edges in the concurrent_queue container
concurrent_queue<EdgeToDraw> MeshEdgesBuffer;
and another thread takes them from there (in WndProc WM_PAINT) in order to draw. Below I show how I put instances of EdgeToDraw in a concurrent_queue container.
// Add an edge for the drawn triangulation mesh.
MeshEdgesBuffer.push(EdgeToDraw(X_begin, Y_begin, X_end, Y_end));
But here, the accuracy of the added values is lost. For example if X_begin == -0.522 and Y_begin == 2.169 (where X_begin and Y_begin have double type), then MeshEdgesBuffer[0].Begin.X == 0 and MeshEdgesBuffer[0].Begin.Y == 2. And so on. But for me, the numbers to the right of the decimal point are very important. Highly. As I understand it, the PointF class is specifically designed to express coordinates with decimal point values. Please tell me what I am doing wrong and how can I make sure that the accuracy of numbers is not lost? That is, if X_begin == -0.522, then Begin.X is of the same value (-0.522) but not is 0 or 0.000. Thank you in advance.
Continue reading...