|
This is not a simple problem. There are some open-source packages for doing solid modeling, but they require a lot of work and you will have to link to these non-managed code libraries (written in C, not dot-net) in order to use them in C#. The most well known is http://www.opencascade.org/ but there are others. Search for "solid modeling" and "free library" or "open source" to find them. I wish you a lot of luck.
|
|
|
|
|
Thank you! I suspected it was going to be hard, I dont even dare to think of figuring out myself. I will check out your suggestions, still hoping I will be able to find a solution.
|
|
|
|
|
Hi,
Below is the code to create a 3 x 3 matrix with the vector (A system of linear equstions)
2x+ y -z = 8
-3x -3y +2z = -11
-2x +y + 2z = -3
The method works fine and displays the solution. Instead of typing in the numbers for the 3 x 3 matrix I would like to create a method for an arbitrary n x n matrix with data in an excel file. For example I would like to do the operations on a file that is 50 x 50 in an excel file. ( iguess I could type in all 2500 values but that would be stupid even for a C# newbie. What would be the code to perform such an operation?
static void TestGaussJordan()
{
LinearSystem ls = new LinearSystem();
MatrixR A = new MatrixR(new double[3, 3] { { 2, 1, -1 }, { -3, -1, 2 }, { -2, 1, 2 } });
Console.WriteLine(" Matrix is \n " + A);
VectorR b = new VectorR(new double[3] { 8, -11, -3 });
Console.WriteLine(" Vector b is \n " + b);
VectorR x = ls.GaussJordan(A, b);
Console.WriteLine("Solution x=\n" + x)
|
|
|
|
|
It would go something like this:
double[,] FillMatrix(int wide, int tall)
{
double[,] matrix = new double[wide, tall];
for(int x = 0; x < wide; x++)
{
for(int y = 0; y < tall; y++)
{
matrix[x, y] = GetValue(x, y);
}
}
return matrix;
}
double GetValue(int x, int y)
{
}
If it must come from an Excel file, I can't help you as I don't know much about that. However, you could export it to a CSV format and then parse that text file if that is an option.
|
|
|
|
|
|
By the way, I just noticed that your title doesn't relate to your question at all.
|
|
|
|
|
Hello
I was trying to use a Clip to define the drawing area on a graphic
Let says that I'm woking with a Graphics on a page : bound 0,0,1200,1800
I define a clip at 100,100,700,900
So the clipBound is 100,100,700,900
I was expecting that if I draw something at 0,0 on that graphics it will be 0,0 on my clip so 100,100 on my page
But it remain 0,0 on the page
So my question is : What is the use of a clip ? Is it really usefull for some purpose ?
Thank for your help
|
|
|
|
|
Ummm, according to the documentation a Clip "gets or sets a Region that limits the drawing region of this Graphics."
Why would you think it translates coordinates?CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Thanks for you reply Walt
"gets or sets a Region that limits the drawing region of this Graphics."
Let's assume that
So how that limit works ?
If I set a clip as
Graphics.Clip(new Region(new Rectangle(100,100,500,800));
The limited region will be 100,100,500,800
So at least if the coordinates are not translated, drawing at 0, 0 is outside the clip and I will see nothing
But is seems that I can continue to draw anywhere on the original graphics
|
|
|
|
|
You are supposed to be able to use any valid coordinate, but only the ones inside the clip bounds would be drawn on the graphic surface. Opacity, the new Transparency.
|
|
|
|
|
You are supposed to be able to use any valid coordinate, but only the ones inside the clip bounds would be drawn on the graphic surface.
That was not the result I got
I will try again... Maybe the fact that I was using a TransFormMatrix on the Graphics affects the normal behaviour
|
|
|
|
|
|
As you mentioned in another post, perhaps the transformation is affecting the way it appears to work
Indeed !
Thank you Walt
|
|
|
|
|
at to fast message sending i get 1 incoming message with 10 grouped packets and not 1 packet for each of 10 incoming messages
for
p.s. sry for terrible english
|
|
|
|
|
I am not sure what the 1 message with 10 packets means... specially compared to 1 packet to 10 messages, but I think I have the "solution".
For example:
Send("Test1");
Send("Test2");
Send("Test3");
The client can receive:
Test1Test2Test3
Or you can receive the message as:
Test
1Tes
t2Te
st3
In fact, TCP/IP only "streams" data. If you expect to send "one packet" and receive "one packet" you are going the wrong way.
Ahh... and that's has nothing to do with synchronous or asynchronous programming... it's the TCP/IP way of working.
If you expect for messages, you must Receive the buffer, accumulate it to the last buffer (if it exists) and then search as many "begin/ends" as it is possible in the message, so it's up to you to do that.
|
|
|
|
|
|
I know that LINQ, Entity Model and RIA Services (when it is available) are great and all, but I find that all the extrapolation makes me stupid and makes it harder to solve problems. I know it takes a few extra hours to write your own classes that represent your database objects, but I like the having the extra control.
One of the things that kills me about ASP.Net MVC is that MS tells us one of the benefits is the granular control over the HTML. Well, I kind of like having the granular control over my database transactions. I also find that it is an important skill in the business world to be good at writing SQL. Being able to easily adhoc query your databases is also very important. I know it is a bit of extra work, but frankly I prefer to program that way.
Anyone else agree with me?
I didn't get any requirements for the signature
|
|
|
|
|
I still write my own data object classes, etc. For one thing, I have a lot of code and objects that were developed long before Linq, etc. that are still in use.
Maybe I'm just missing something, but I don't see where Linq, etc. save me much work.CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Walt Fair, Jr. wrote: Maybe I'm just missing something, but I don't see where Linq, etc. save me much work.
Agreed.
I didn't get any requirements for the signature
|
|
|
|
|
I always write my own SQL and I have found very little use for "entities" in my work and I can imagine few cases where they may be beneficial, so I expect that they are over-used (an anti-pattern).
I was discussing this with a colleague the other day.
The bottom line, to me, is the duration of the object -- will it last long enough to warrant spending time and effort creating it? And will it interact with other objects? If the answers to these questions are both "yes", then go right ahead and use an object. If not, why bother?
Let's put it this way... if all you're doing is querying data and writing it to a file (a simple list of customers for instance) then I see no point in bothering with instantiating an object for each customer just to dispose it immediately.
P.S. I don't do stored procedures, I don't do WCF, I don't do databinding.
|
|
|
|
|
I agree with you. I do use stored procedures, but I don't really need to. I don't really like databinding either.
I didn't get any requirements for the signature
|
|
|
|
|
I have written quite a few automated tests now with things like NUnit, and I find that they generally don't look very elegant. I find that code reuse is usually very difficult and code all ends up looking very similar. Books generally only show simple cases and in the real world with databases etc. things aren't quite so simple.
A good example of what I mean is database stuff. Every table works in pretty much the same way, but they all have different fields and types so you can't reuse much code. I find that most of my code looks like this:
SetupConnectionEtc();<br />
SetupDataForTest();<br />
DoSomething();<br />
ReadTheDataAndCheckEverything();
Although the first line probably isn't unique, all of the others usually are. So if your application uses 20 database tables then you will probably end up with 20 files containing a ReadTheDataAndCheckEverything() function, as well as some of the other ones.
What do people think? Am I doing something wrong or is there an easier way?
|
|
|
|
|
I find testing (and writing tests) invaluable. In fact, it's the only reason I sleep soundly at night (no, really). I'm working on some low-level frameworky stuff (that has to work and has to work fast) and end up writing slightly higher level tests than the ones mentioned in your post. I find them to be more useful (i.e. akin to how my APIs are used) than traditional unit testing.
To answer your question, I probably wouldn't write tests that check table reads and writes - instead, I'd write tests for the APIs that end up calling them. I hope this makes sense.
/ravi
|
|
|
|
|
|
How many times are you going to ask the same question?
You already got a good answer yesterday, to your original post.
|
|
|
|
|