|
I didn't get you.
What does build-if funtions mean?
The data are in double. But how are you displaying them.
Before drawing the image are you converting them to int? or typecast etc.
|
|
|
|
|
|
Your going to like me....
The very clever stuff was taken almost exactly from http://www.faqs.org/faqs/graphics/algorithms-faq/ which is a superb repository of this sort of stuff.
I'm sure you could make a more compact version of this stuff, but many of these functions are used elsewhere in my code, so it made sense to keep them multi-purpose.
ptPoly is an array of the vertices of the polygon.
BOOL PointInPolygon (const CPoint *ptPoly, const int nPoints, const CPoint ptTest)
{
return (LineCrossesPolygon (ptPoly, nPoints, CPoint (-99999999, ptTest.y), ptTest) % 2) == 1;
}
int LineCrossesPolygon (const CPoint *ptPoly, const int nPoints, const CPoint ptA1, const CPoint ptA2)
{
int nPt, nCross = 0;
for (nPt = 0; nPt < nPoints; nPt++)
{
if (LinesIntersect (ptA1, ptA2, ptPoly [nPt], ((nPt + 1) == nPoints) ? ptPoly [0] : ptPoly [nPt + 1], NULL))
nCross++;
}
return nCross;
}
BOOL LinesIntersect (CPoint a, CPoint b, CPoint c, CPoint d, CPoint *ptIntersect)
{
if (Colinear (a,b,c,d))
return FALSE;
double rTop, rBot, sTop, sBot, r, s;
double Ax = a.x, Ay = a.y, Bx = b.x, By = b.y, Cx = c.x, Cy = c.y, Dx = d.x, Dy = d.y;
rTop = (Ay-Cy)*(Dx-Cx)-(Ax-Cx)*(Dy-Cy);
rBot = (Bx-Ax)*(Dy-Cy)-(By-Ay)*(Dx-Cx);
sTop = (Ay-Cy)*(Bx-Ax)-(Ax-Cx)*(By-Ay);
sBot = rBot;
if (sBot == 0.0)
return FALSE;
r = rTop / rBot;
if (r < 0.0)
return FALSE;
if (r > 1.0)
return FALSE;
s = sTop / sBot;
if (s < 0.0)
return FALSE;
if (s > 1.0)
return FALSE;
if (ptIntersect)
*ptIntersect = InterpolatePoint (a, b, r, 1.0);
return TRUE;
}
BOOL Colinear(CPoint a, CPoint b, CPoint c, CPoint d)
{
int dot = (b.x-a.x)*(d.y-c.y) - (d.x-c.x)*(b.y-a.y);
return !dot;
}
CPoint InterpolatePoint (CPoint Begin, CPoint End, double Which, double OutOf)
{
CPoint pt;
pt.x = (int)InterpolateDouble (Begin.x, End.x, Which, OutOf);
pt.y = (int)InterpolateDouble (Begin.y, End.y, Which, OutOf);
return pt;
}
double InterpolateDouble ( double Begin, double End, double Which, double OutOf)
{
if (OutOf == 0.0)
return Begin;
return ((End - Begin) * Which / OutOf) + Begin;
}
Good luck!
Iain.
|
|
|
|
|
Thank you!!!
Great link
Have a nice code day
|
|
|
|
|
Thank U
able to get good knowledge, great site
|
|
|
|
|
Hey Guys,
I have a a dialog with id IDD_AGREE_FRAME_ABSTRACTION and its associated with a class CSegisAgreementsLeaseAbs. But when i want to see any inforation in the class wizard its not showing there. I have a check box in the dialog and i want to associate this chk box to a variable using class wizard and its giving me meaasge that IDD_AGREE_FRAME_ABSTRACTION is a new resource. You want to associate it to a class..........,etc. Please help me why its not showing and how to fix it.
|
|
|
|
|
delete the .clw file and open the class wizard again.
the .clw file will be created again and this time you will see the class.
-- modified at 4:39 Friday 3rd February, 2006
|
|
|
|
|
Hey Thanks a lot for this. But i am having another problem. I am able to see the class in class whizard but when i try to open this class in class wizard its giving me one error as
Parsing error: Expected ")",
Input Line: "//DDX_Text(pDX, IDC_LE_TENANT_IMPROV_AMT, mcs_le_improv_amt);"
This line is there in the dodata exchange. What i need to do for this. Pleas suggest.
|
|
|
|
|
Check for ";" at the end of all the DDX statement.
I think you must getting compiler error too...
|
|
|
|
|
Class wizard is probably not clever enough to understand comments. Keep the grey bit free of this sort of thing, If you need to remember this line for another time, move it outside the classwizard block.
Iain.
|
|
|
|
|
Any API/code piece is to get number Drive & names present in a System?
|
|
|
|
|
GetLogicalDriveStrings(...)
GetLogicalDrives()
Owner drawn
Jesus Loves
|
|
|
|
|
|
Do Search CP(Code Project). You are assured of plenty.
Owner drawn
Jesus Loves
|
|
|
|
|
|
|
hi!
i has a program with c++.net for project!
i don't know about fractal
who can help me?
thanks
all things are possible to him that believeth.
|
|
|
|
|
|
|
|
But the question was not in Fractal, it was about fractal.
|
|
|
|
|
Mr.Prakash wrote: But the question was not in Fractal, it was about fractal
but the question was rude... so the answer is rude
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
|
Ok, I get it now, but we are suppost to be helping and not entertaining our selfs. A simple statement of "look it up" would do.
You remind me of someone that a friend of mine thought I would get along with, and that guy thought the statement "I have problems with comparing floating point values" was funny. I told him, straight faced, that I did not have that problem. Of course it did not occure to me, until later, that he was talking about direct comparison ("=="), that's just foolish.
I do not think like that! Here is a simple one (in C++), what is wrong with this: "i++".
INTP
Every thing is relative...
|
|
|
|
|
No you don't! You have an assignment or some thing! Wait a second, that is a project. It is just one that has not been written yet. In my lap is a "Dictionary of Computer Terms", which contains a QBASIC program for drawing snowflakes, if I grabed a standared dictionary off my bookshelf or looked at an encyclopidia, I would probably find the same information.
Please do not ask questions here, before you have researched them. There is lots of information on factals on the Web, and many programs with source available.
INTP
Every thing is relative...
|
|
|
|
|