|
Hi all--
I've got a program where you click and add points to make a polygon using a linked list, and now I want it where by pressing a button it will take the points on the polygon and make it a cubic b spline curve. However I have no experience with the b spline curves and am having trouble with were to start. So I was wondering if you would be able to help me with the pseudo code for this, using C so that I can better understand what I'm trying to do. Here is what I have come up with so far (which isn't much unfortunately):
Create a drawCurve function that traverses the linked list in order.
Take the first four points to draw the spline curve, then the next one over each time.
[insert how to do the math here (of which I am confused about)]
Use a state machine to implement. So pressing a button of my choice will change between the drawing polygon state and the draw curve state.
Thank you very much for your help.
|
|
|
|
|
Now, where's that 'homework' tag?
L u n a t i c F r i n g e
|
|
|
|
|
I'm not asking you to do it for me, I'm just trying to figure out where to start
|
|
|
|
|
Carl De Boor's book "A practical guide to splines" has pseudo code for what you want.
|
|
|
|
|
|
Buddys,
How to create database and manipulations on that databse by using sqlite databse. plz provide me solution.
iam trying to create with add CppSQLite3.h in my code, but its not working, getting some sqlite exception.
|
|
|
|
|
kirancgi wrote: plz provide me solution.
This is not possible in a forum; try reading some of the articles on databases.
kirancgi wrote: its not working, getting some sqlite exception.
We cannot guess what this could mean. Show your code where the exception occurs, and include the exact wording of the exception. Only then can anyone try and help to diagnose the problem.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Richard MacCutchan wrote: Only then can anyone try and help to diagnose the problem.
Well, you're not much of a mindreader now are you?
"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
|
|
|
|
|
DavidCrow wrote: Well, you're not much of a mindreader now are you?
True, but at my age some talents start to fade.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
At 27, I've almost lost all the mind reading capabilities. So, you're out of question!
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Truth to tell I lost mine when I was half your age.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
I knew you were going to say that!
Ali
|
|
|
|
|
Alison P wrote: I knew you were going to say that!
Wow, spooky!
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
You should start with drugz then.
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]
|
|
|
|
|
|
I am currently working on a project for a class, and what I need to do is make a .txt file with a letter on the first line and two two-digit numbers on the second line, and have it write to another text file what the ASCII code for the letter and add and multiply the two numbers.
I've been able to get the code to compile, but it prints out strange numbers instead of what the answers should be. I've been told to initialize my variables, but when I set them to 0, thats all the program reads. So I get a file like, the ASCII is 0, and 0 + 0 = 0, and the like.
Here is the code. Please tell me where I am messing up!
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream inFile;
ofstream outFile;
char letter1;
double num1;
double num2;
inFile.open("input.txt");
outFile.open("answers.txt");
inFile >> letter1 >> num1 >> num2;
outFile << "The ASCII value of your character: " << letter1<< " is " << static_cast<int>(letter1) <
|
|
|
|
|
why are num1 and num2 declared as double ? I would try 'int' (looking at your input file example)..
int num1 = 0;
int num2 = 0;
what is that static_cast doing ? try
<< (int)letter1 << endl;
ok, thats old school these days, but Im an old f@rt, so it doesnt matter ... in the next two lines, bracket the operations so you get
<< (num1 + num2) << endl;
<< (num1 * num2) << endl;
the 'system(pause)' isnt doing much - you can step through your prog using F10 for example (if you're using MSVC) and look at the variable contents - or, sprinkle some 'cout' statments around to display things on the console/stdout instead of just to the file
ie
cout << "The Value of num1 is : " << num1 << endl;
|
|
|
|
|
I have just tried this as it stands changing only the static_cast(letter1) to (int)letter1 , and the results are correct. Looking at your results I can only assume that the program cannot find your input file, but as you do no error checking there is no notification of that condition. Check the return value of the open call to see that it is not NULL.
I would also agree with Garth's suggestion that you use int rather than double for your numeric values.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Thanks a bunch for the help guys! For some reason my class is telling me that static_cast<int>(letter1) works fine, but I can't get it to work at all. (int)letter1 worked amazingly well. The system("PAUSE"); was only in there due to my debugging, so that got removed before the final submitting. I did switch from double to int, but was using double before because, well, I still haven't fully fleshed out the differences in int, double, and float. I found another problem I had was I put the input.txt file in as a source file, not a resource file, so that probably had a chunk to do with it also. Anyways. They are hitting us hard with this term in programming, and since it's all done online, I really didn't have anyone to turn to. Thanks again for bailing me out!
|
|
|
|
|
Glad you figured it out. Just a couple of things extra:
1. See here[^] for documentation on static_cast .
2. The different numeric types are:
2.1 int for holding values in integer format (i.e. without any fractional part) e.g. 1, 3, 212, 134788 etc.
2.2 float and double for holding values with a fractional (or decimal) part e.g. 3.14, 0.000497 etc.
Generally speaking it is best to use integer types unless you must deal with decimals, as they lose precision owing to the manner in which they are stored in computer words.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Hello,
I'm trying to build a project but getting errors 2001 and 2019. Here is an error data in normal and verbose mode.
1>MBackProp.obj : error LNK2019: unresolved external symbol "public: __thiscall CudaMultipleBackPropagation::~CudaMultipleBackPropagation(void)" (??1CudaMultipleBackPropagation@@QAE@XZ) referenced in function "public: void * __thiscall CudaMultipleBackPropagation::`scalar deleting destructor'(unsigned int)" (??_GCudaMultipleBackPropagation@@QAEPAXI@Z)
1>MBackPropDlg.obj : error LNK2001: unresolved external symbol "public: __thiscall CudaMultipleBackPropagation::~CudaMultipleBackPropagation(void)" (??1CudaMultipleBackPropagation@@QAE@XZ)
1>MBPTopologyCtrl.obj : error LNK2001: unresolved external symbol "public: __thiscall CudaMultipleBackPropagation::~CudaMultipleBackPropagation(void)" (??1CudaMultipleBackPropagation@@QAE@XZ)
1>MBackPropDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall Cuda::Cuda(void)" (??0Cuda@@QAE@XZ) referenced in function "public: __thiscall CMBackPropDlg::CMBackPropDlg(void)" (??0CMBackPropDlg@@QAE@XZ)
1>MBackPropDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall CudaMultipleBackPropagation::CudaMultipleBackPropagation(class Pointer<class MultipleBackPropagation> &,class Matrix<double> &,class Matrix<double> &)" (??0CudaMultipleBackPropagation@@QAE@AAV?$Pointer@VMultipleBackPropagation@@@@AAV?$Matrix@N@@1@Z) referenced in function "private: static unsigned int __cdecl CMBackPropDlg::TrainNetwork(void *)" (?TrainNetwork@CMBackPropDlg@@CAIPAX@Z)
1>MBackPropDlg.obj : error LNK2019: unresolved external symbol "public: void __thiscall CudaMultipleBackPropagation::CopyNetworkHost(class Pointer<class MultipleBackPropagation> &)" (?CopyNetworkHost@CudaMultipleBackPropagation@@QAEXAAV?$Pointer@VMultipleBackPropagation@@@@@Z) referenced in function "protected: void __thiscall CMBackPropDlg::TrainOneEpochUsingCuda(void)" (?TrainOneEpochUsingCuda@CMBackPropDlg@@IAEXXZ)
1>MBackPropDlg.obj : error LNK2019: unresolved external symbol "public: void __thiscall CudaMultipleBackPropagation::Train(double,double,bool,double,double)" (?Train@CudaMultipleBackPropagation@@QAEXNN_NNN@Z) referenced in function "protected: void __thiscall CMBackPropDlg::TrainOneEpochUsingCuda(void)" (?TrainOneEpochUsingCuda@CMBackPropDlg@@IAEXXZ)
1>C:\Documents and Settings\Administrator\MBP_clone\MBackProp\Debug\MBackProp.exe : fatal error LNK1120: 5 unresolved externals
Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:
Found __imp__GetLastError@0
Referenced in BackPropagation.obj
Referenced in MBackPropDlg.obj
Referenced in MultipleBackPropagation.obj
Referenced in VariablesData.obj
Loaded kernel32.lib(KERNEL32.dll)
Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\gdiplus.lib:
Searching C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\comsuppwd.lib:
Found "void __stdcall _com_issue_error(long)" (?_com_issue_error@@YGXJ@Z)
Referenced in MBackPropDlg.obj
Loaded comsuppwd.lib(comsupp.obj)
Found "void __stdcall _com_raise_error(long,struct IErrorInfo *)" (?_com_raise_error@@YGXJPAUIErrorInfo@@@Z)
Referenced in comsuppwd.lib(comsupp.obj)
Loaded comsuppwd.lib(comraise.obj)
Found "long __cdecl _com_invoke_helper(struct IDispatch *,long,unsigned short,unsigned short,void *,wchar_t const *,char *,struct IErrorInfo * *)" (?_com_invoke_helper@@YAJPAUIDispatch@@JGGPAXPB_WPADPAPAUIErrorInfo@@@Z)
Referenced in comsuppwd.lib(comsupp.obj)
Loaded comsuppwd.lib(invkprxy.obj)
Found "long __stdcall _com_handle_excepinfo(struct tagEXCEPINFO &,struct IErrorInfo * *)" (?_com_handle_excepinfo@@YGJAAUtagEXCEPINFO@@PAPAUIErrorInfo@@@Z)
Referenced in comsuppwd.lib(invkprxy.obj)
Loaded comsuppwd.lib(invkerr.obj)
Can anybody direct me how to proceed wit this. I set already lib path
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib
But it dont help
Krzysztof
|
|
|
|
|
I hope CudaMultipleBackPropagation is from a another library?
If so did u included that lib correctly without any mismatach from the header you included for that?
Величие не Бога может быть недооценена.
modified on Sunday, March 28, 2010 1:17 AM
|
|
|
|
|
Do you have a path set to the Cuda library?
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Hi Adam, Tim
Yes paths to the CUCDA library are set OK, there is a path to header and object file.
Krzysztof
|
|
|
|
|
The external reference CudaMultipleBackPropagation::~CudaMultipleBackPropagation(void) and others, cannot be found by the linker. This indicates that the object or library containing these calls is not being found. The reason could be either that the path to the library has not been set in your project, or the name of the library or object file has not been added to the linker parameters. Check your project parameters again to be sure they are correct. Incidentally the path C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include should be in your compiler include list not in your linker lib list.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|