|
Phil,
Well I don't remember much of the math I lerned in High School, which is really my problem. Perhaps you can enlighten me.
What exactly do you mean by "Velocity Vector"? I know the velocity and the bering, how do these relate to a "Velocity Vector"?
Also, what in the world is a "dot product"?
I actually figured out how to do it after staring at the screen for several hours last night, smoking cigarette after cigarette, but my method is quite a bit more complex than the one you describe seems to be.
Thanks
dB
|
|
|
|
|
I was afraid you'd ask that. You seem to be in a 2D world with a bearing (presumably in degrees) and a velocity, so my answer will be based off that assumption.
A 2D vector can be thought of as a line going from the origin of a cartesian coordinate system <0,0> to the point <x,y>, so the vector can be represented with 2 scalar values x and y.
To calculate the length of a vector we simply calculate the distance between the origin and the point at <x,y> :
length = sqrt( (x-0)*(x-0) + (y-0)*(y-0) )
= sqrt(x*x + y*y)
You can think of the "length" of the velocity vector as the actual velocity of the ship, and the coordinates as the bearing. So the velocity vector contains both the direction and the velocity. If, for example, the ship is traveling at a 45 degree angle, the velocity in vector notation might be <1, 1> or <2, 2>, or <3, 3>, etc., depending on how fast it's going. If the vector is <1, 1> it means the length (i.e., velocity) is sqrt(2), if the vector is <2, 2>, the velocity is sqrt(8), etc.
In your case you need to take the sine of the bearing as the X coordinate for the velocity vector, and the cosine of the bearing becomes the Y coordinate for the vector. Then you scale that vector by your velocity amount by multiplying the x and y component of the vector by that amount.
Rather than get into vector dot products and cross products and other scary stuff, I think it would be better if I just refer you to another document that I think does what you're looking for.
http://www.gamedev.net/reference/articles/article1019.asp
This shows an implementation of 2D vectors and also a function for computing the angle to adjust a ball striking a pool table edge, which sound like the kind of thing you're doing. Look for the function "CBall::HitBoundary".
If you want to read up on 2D vector math, etc. there's a million places you can go on the web. Here's a page that explains unit vectors and vector dot products: http://www.geocities.com/SiliconValley/2151/math2d.html
Good luck!
Phil
|
|
|
|
|
Oh Yea, well that aught to make things a bit easier.
Thanks!
|
|
|
|
|
Hey Phil,
I've got one more problem. I've been taken the data you gave me and assembled it into a 2DVector class. I am almost finished but I am stuck on one thing. Is there an equasion to determine the bering in degrees from the vector coords? I can't seem to find the answer to this question anywere on the internet. I've been through pages and pages of search results for hours today and I'm starting to get a little pissed off.
Thanks,
dB
|
|
|
|
|
I was wondering if there is a MFC ShellExecute(...) equivalant in the .NET Framework that would allow me to execute programs and web addresses (opening the default browser). Thanks.
BNEACETP
|
|
|
|
|
Process.Start()
You can specify if it should use the OS method (ShellExecute) or managed implementation (?)
greetz
*Niels Penneman*
Software/Dev Site Personal Site
|
|
|
|
|
Thanks for the help!
Happy Programming!
BNEACETP
|
|
|
|
|
hi,
i am developing installer using .net framework, package wizard.
And i use to make custom action, so i develop dll.
I would like to get install path in dll.
if you have some solutions, please tell me.
best regards,
yu-yu
|
|
|
|
|
If you developed a native DLL to use in your custom action, you can use MSIHANDLE passed to your stdcall function then use the MsiGetProperty . See the Windows Installer SDK on MSDN[^] for more information.
If you wrote a .NET Installer -derived class, you'll have to pass the SourceDir property from MSI as a command-line parameter, such as /SRC=[SourceDir] . To get the value of this command-line parameter, use Installer.Context to get an InstallContext , then InstallContext.Parameters["SRC"] (for example) to get the value of that property.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Dear Stewart,
thank you for your advice.
I got this.
best regards,
yu-yu
|
|
|
|
|
Hi, I have a subclass of System.Windows.Forms.Panel and I need to know when the panel is scrolled. But there doesn't seem to be a "scrolling" event for Panel. So I'm guessing I need to add a handler to the scroll event of the scrollbar itself. But how do you get access to the scrollbar?
Thanks!
Phil
|
|
|
|
|
Extend Panel and override WndProc . Handle the WM_HSCROLL (0x0114) and WM_VSCROLL (0x0115) messages accordingly. See the Scroll Bars[^] in the Platform SDK for more details. Some background in Windows programming will be very helpful.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks Heath, I'll check into doing it that way. Sure seems strange to me that the framework doesn't just expose either the scrollbar handle or a scrolling event, though. Sigh...
Phil
|
|
|
|
|
Hi,
I'm writing a plugin system in VB.net, and each plugin Implements a base class. (Done).
Now I'm making the parent framework that will house and execute each plugin. What I am doing is I will be creating a Thread for each plugin. Then what I want to have is a safe way run the Threads so that if the parent application wants to close, it gracefully closes down the thread before close.
Has anyone got any examples of performing something like this?
|
|
|
|
|
I have a project where i have a tab layout containing 12 tabs now on one of these tabs there is section of code that requires a word document to open and retreive bookmarks and insert them in the corresponding text boxes. i got this to work fine but it takes a while to complete the whole process. what my problem is because of the ammount of controls this tab has on it and the amount of code it needs to go through during run time the tab seems to pause during the switching between the tabs until the code is completed.i tried to use a progress bar and suspend /resume the layout of the tab and the form but to my luck this didnt work if anyone has an idea how to make the switch viewable after the code is completed any help would be apreciated
|
|
|
|
|
I am having an interesting, but very annoying problem related to making web service requests from .NET to a Perl SOAP::Lite web service that is running on Linux. Here is the situation:
(1) In most cases, we are able to make web service calls from ASP.NET to the Perl web service just fine. There may be problems, but the test methods that we've tried seem to work fine.
(2) A .NET console application is able to make calls to the Perl web service without any visible problems.
(3) The problem comes in when the Perl web service throws a SoapException. When this happens and the web service was called from the ASP.NET client, a System.Runtime.Serialization.SerializationException is thrown that says the following:
An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in Unknown Module.
Additional information: The type System.Web.Services.Protocols.SoapException in Assembly System.Web.Services, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f57f11d50a3a is not marked as serializable.
What is confusing is that we can make make the same call from a .NET console application to the Perl web service and it works properly, throwing a SoapException.
In each of the clients (ASP.NET & .NET console app), a web reference to the Perl web service was created the exact same way in Visual Studio based on a WSDL file, so there are no apparent differences in that area.
In summary, we are finding a difference in behavior between an ASP.NET client and a .NET console application and I can't figure out what the difference is between them.
If anyone has any suggestions or information on this, it would be most appreciated.
Thank you,
Clark Laughlin
|
|
|
|
|
hi,
Now, I'm developing installer using VS.net 2003.
When I installed, I would like to create directory except
for target directory.
for example,
c:\test <-- this is target directory
d:\test\test2 <-- my gole
The package installer have a function to create custom directory. But this directory create below target directory.
I looked for other function, but i couldn't do.
If you have some solution, please tell me.
And If you know some sites about Package installer,
please tell me.
best regards,
yu-yu
|
|
|
|
|
Use custom actions. Set the InstallerClass property to True, Then add a Insaller class to your app, and there are some methods that you can override (Ex. Install, Commit, Rollback). Add your code to create the directory (what ever you want) to this Installer class. I think this will do the job.
UB
You may stop this individual, but you can't stop us all... after all, we're all alike. +++Mentor+++
|
|
|
|
|
Mr.UB
thank you for your advice.
I resolved!
but I have some problem (ex. how to get install path).
If you have some solutions, please tell me.
thank you in advance for your kindness.
best regards,
yu-yu
|
|
|
|
|
Try System.Configuration.Install.Installer class's Context member. It is a type of InstallContext class which has a member - Parameters . With this you can get the command line parameters. I haven't try this, but you might be able get the install path with this. Pls let me know if this works.
Good Luck !
UB
You may stop this individual, but you can't stop us all... after all, we're all alike. +++Mentor+++
|
|
|
|
|
Dear UB
thank you for your advice.
Today, I will try this, so as a result of this,
i will announce you.
Anyway, I have a trouble.
I think you have many .Net knowledge, so could i ask you
my question?
I develop package installer, i set shortcut icon on my desktop.
After installed, i clicked this.
Then installer dialog( prepared install, canceled install)
appeared, and application was running.
I checked shortcut property. I noticed that this link was package installer msi file name.
When i clicked this, at first this check msi file, next check application.
I'd like to run application smoothly.
If you have some solutions, please tell me.
best regards,
yu-yu
|
|
|
|
|
Dear UB,
I resolved this.
I set Argument of shortcut property exe file name,
so I click shortcut, exe file run.
thank you.
yu-yu
|
|
|
|
|
I don't know the way you created that shortcut, but if you do it as follows then you shouldn't be having any problem.
1. Create a "primary output file" (your main exe file) in the "Application Folder" of your setup project.
2. Inside the Application folder right click the added primary output file and choose "Create shortcut" from the menu.
3. Drag & Drop the newly created shortcut to "User's Desktop" folder.
If you've done this the above way and still having the problem then I'm sorry, I don't have an answer to that.
Good Luck !
UB
You may stop this individual, but you can't stop us all... after all, we're all alike. +++Mentor+++
|
|
|
|
|
Dear UB
My case is different from yours.
My case didn't include exe file project in installer project.
Your case include this in installer project.
I believed this success, but today, I noticed a thing.
When I changed install path on install menu, I couldn't run
application smoothly. I tried to develop your case(the way
including exe file project in installer project).
But the same error occuered.
Now I'm looking for this solution.
If you look for this, please tell me how to do.
best regards,
yu-yu
|
|
|
|
|
I'm sorry, I still can't understand your problem, anyway here goes nothing.
1. If you have your Application project and the setup project under the same solution, then you can add the project output to the Application Folder in the setup project, and make shortcut then move it to the User's Dekstop folder in the setup project.
2. If you've created your setup project under a different solution then you can follow the above procedure, but instead of adding project output, right click the Application Folder and get Add-->File, and add what ever the files you want to add (EXEs, DLLs).
UB
You may stop this individual, but you can't stop us all... after all, we're all alike. +++Mentor+++
|
|
|
|
|