|
Hi
How to find hit testing of Circle/ellipse using mathematical formulas(not using Regions)?
thanks
|
|
|
|
|
one way would be to store the centers and radius of circle(In case of ellipse it depends on the length of the major and minor chords) and when the mouse is clicked you can get the point of click and check if the coordinates are within the range of the circle or the ellipse.
For ex: in case of a circle, if you have a circle with center at (100,100) and radius as 100 then if the user clicks on x,y then check if the new points are still in the space occupied by the circle. In other words you can check if x,y both lie between 0 and 200
There will be some refinements required though with this approach.
EDIT: BTW circle is a special case for ellipse with the major and minor chords of the same length, called the radius in a circle.
I am a HUMAN. I have that keyword (??? too much) in my name........
_AnsHUMAN_b>
modified on Wednesday, September 15, 2010 2:54 AM
|
|
|
|
|
The straight way is: use the curve equations for finding possible intersections.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
How to use the C++ dynamic load DLL which compiles with C#
tks!
|
|
|
|
|
I suggest you start looking at p/invoke - here's two starters ...
http://www.perceler.com/articles1.php?art=pinvoke1
http://www.codeproject.com/KB/dotnet/PInvoke.aspx
'g'
|
|
|
|
|
What do you mean by a dll which compiles with C#? I think you have a native (C++) dll which you want to use in C#. As already suggested you can either use PInvoke to call the functions from that dll or if its a COM dll you might be interested in generating a tlb for it, then you can add the reference to this .tlb in your C# application and consume it.
I am a HUMAN. I have that keyword (??? too much) in my name........
_AnsHUMAN_b>
|
|
|
|
|
Is it possible to write a code that adds today's date to a jpg photo?(the date is changed everyday)
|
|
|
|
|
1. read JPG without date
2. draw the date text onto the image
3. save the image as a new JPG
4. wait 23.9999999 hours
5. goto 1
there are a million ways to do 1, 2 and 3.
|
|
|
|
|
Still using goto ?!?
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
if it's good enough for a CPU, it's good enough for me
|
|
|
|
|
Add it to the visible part of the photo, or to its metedata?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
for the easiness, you can make use of CImage class declared in atlImage.h for loading and saving jpg images. The rest in usual way, is as easy as creating a memory dc, selecting HBIMAP from CImage object into it, and calling TextOut() on memdc. For anti aliasing support and additional smoothness, you may make use of GDI+ functions too.
|
|
|
|
|
using GDI+ you can add metadata (any additional information)to your image file.
see EncoderParameters in GDI+
|
|
|
|
|
Hi all,
is it possible to get the contents of a drive i.e the list of all files and folders inside the drive ?
i have the drive letter with me.
so please can i get some help to get all the contents inside the drive ???
Thank You
|
|
|
|
|
Are you looking for WIN32_FIND_DATA in conjunction with FindFirstFile and FindNextFile?
I am a HUMAN. I have that keyword (??? too much) in my name........
_AnsHUMAN_b>
|
|
|
|
|
Not exactly...
however..could it be elaborated a bit on how to get the first, next or last file from a drive, where the drive letter is known?
|
|
|
|
|
Subrat Patnaik wrote: ...could it be elaborated a bit on how to get the first, next or last file...
Based on what criteria?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
As i have already said the criteria is we have the drive letter. That's all....
now we need to get all the files and folders within it.
|
|
|
|
|
Use the FindFirstFile() /FindNextFile() pair.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
FindFirstFile/FindFirstFileEx/FindNextFile should do that.
Just pass the appropriate filter; I guess it's "X:\*"
|
|
|
|
|
Hi
I have list of URL in a text file. I want to save all the URL in local mahcine and display in a HTmlView. Can any give idea on this
|
|
|
|
|
Read each URL from the text file and pass it to your view. Or perhaps your question means something else.
It's time for a new signature.
|
|
|
|
|
Hi,
I have written an MDI MFC (using VS2010) application which one of our distributors in China is testing. He is running Windows 7, Simple Chinese.
The problem he has encountered are that for some of the dialogs the text shows ??? instead of the text. These dialogs are MFC ones i.e. prompt to save an unsaved file or response to a value beign out of range in a dialog.
since all the remaining text from the application resources show without any problems I wonder if it may be down to the application using a "Multi-byte Charactor Set" and not unicode. (can't remember why I choose "Multi-byte Charactor set")
Should I build the application as a Unicode application?
and would this help pave the way for localised resources?
thanks in advance
Robin
|
|
|
|
|
Robin,
Its good if you build your application using Unicode character set, hopefully this will solve the problem.
Thanks,
Anand.
|
|
|
|
|
Hi Anand,
Thanks for your suggestion. I had suspected that building my application using unicode would solve my problem.
I have heard back from our Chinese distributor this morning that the display issues are now resolved.
Thanks,
Robin.
|
|
|
|