|
Nelek wrote: I had to write a dossier
"Pssst... this is grey squirrel....do you have the dossier?"1
1 Reminiscing over Trigger Happy TV.[^]
Semicolons: The number one seller of ostomy bags world wide. - dan neely
|
|
|
|
|
No Sorry, that was about 8 years ago and since then I lived in 4 different places. It got lost in one of the movings.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Hi,
I just figured the problem out. Turns out it was my basic integration that was the problem :P
<br />
<br />
Ao = 1/4<br />
An = (1/(n^2*PI^2))*(cos(n*PI)-1)<br />
Bn = (-1/(PI*n))*cos(n*PI)<br />
<br />
f(t) = Ao + SUM(An*cos(n*w*t)) + SUM(Bn*sin(n*w*t))<br />
<br />
Where SUM is from n=1 -> n =infinity, and w = (2*PI)/T<br />
<br />
Thanks for your help anyway.
Cheers,
|
|
|
|
|
Ah, great. I didn't have time to do the math yesterday - had to fumigate my apartment.
Anyways, I like the problems you post here - takes me waaaaay back and is a good review to keep the basics fresh. I kind of wish there was more participation on this particular board.
|
|
|
|
|
Hi,
Sorry for my english , i will try to explain my problem, i hope someone can tell me where can i find more information.
I write a program for drawing contour which can contain lines and arces. I need to somehow make constraints beetwin points of contour. e.g. one point can be horozontally or vertically aligned with another point or a X,Y distance can be given between points.
I come to point where i can draw contour with mouse and apply constraint, but my problem is that i can't conclude when can i apply new constraint so it does not confilct with existing.
Any help is welcome.
|
|
|
|
|
How are you drawing the contours now? Do you draw them in reference to an underlying grid?
|
|
|
|
|
No, there is no grid. I have problem where i can find out when my sketch is well defined. I think i have to solve a system of equations. If you imagine rectangle with points A,B,C,D and if point A is top left and point D is top right then i woud have following constraints that defines rectangle:
1. A.x = B.x
2. B.y = C.y
3. C.x = D.x
4. A.y = D.y
5. B.x = C.x + Kx , where Kx is widith of rectangle
6. D.y = C.y + Ky , where Ky is height of rectangle
I know that this constraints completly defines rectangle, but my program doesnt so it allows more constraint to be added, it usualy hapens that curve run away like a snake from the screen when i add one constraint more.
I think i need somehow solve this system of equatations , but i don't know how yet.
|
|
|
|
|
I don't think I understand. Initially I thought you were trying to determine if a point is inside the rectangle. I think you are trying to do something different. What you can do to define the rectangle is to make 4 equations for each side of the rectangle. For example, the equation of a line connecting two points (x1,y1) and (x2,y2) is:
(y2 - y1)
0 = y - y1 - --------- (x - x1)
(x2 - x1)
I'm not exactly sure what you are trying to do with the constraints...
Are you trying to join shapes together?
Are you trying to see if a point (x,y) lies inside or outside of the rectangle?
|
|
|
|
|
I use contraints to create parametric shape. This feature can be seen in CAD like drawing programs, i only need very small part of such feature in my program.
Simply when constraints are applied to points of the shape , i can modify shape by changing parameters of constraints e.g. like distance.
|
|
|
|
|
Your constraints look correct. Perhaps it is a coding problem? Are you able to post a section of the source code? If you are using C++, you can make your code aware of the rectangle by specifying it as a struct, for example...
|
|
|
|
|
I have a problem of choosing subsets. I wonder if anyone have any idea about it.
We have n sets each having k m-tuple subsets of a known set. I want how to know to find the maximum n-tuple sets each having one and only one member from each of n given sets. These sets also should be non-overlapping. To clarify it I make an example:
n=3, k=4, m=2
set 1: {{1,8}, {2,6}, {5,7}, {2,9}}
set 2: {{3,6}, {1,4}, {2,9}, {5,6}}
set 3: {{2,3}, {1,8}, {7,8}, {3,5}}
Now we are looking for maximum 4 (k) sets that are non-overlapping. Each set have a member from set 1, set 2 and set 3.
a solution can be:{{5,7}, {3,6}, {1,8}} -- {{2,9}, {1,4}, {3,5}} but this solution has 2 sets, can we find solution with 3 or 4 sets (to cover the maximum number of 3*4 members)?
|
|
|
|
|
Assign each subset an integer and make random draws from a uniform distribution to choose subsets randomly deleting them from the set as they are selected.
|
|
|
|
|
Hi All,
can anyone provide me related information or urls for calculation time complexities for algorithms
Thanks
vijay
|
|
|
|
|
Why don't you use Google?
|
|
|
|
|
Thanks for the reply,
i just want to check out , Expert people will suggest me good information.
|
|
|
|
|
What kind of time resolution do you want? If you want sensitive microsecond timing you'll have to look into alternatives for the Unix gettimeofday() function on Windows. Or perhaps there are other high-resolution timer classes available...depends what you want, exactly.
|
|
|
|
|
Anyone know how to *extract* the shear X and shear Y values from a 2D (3x3) affine transform matrix? I've got code extracts the rotation, translation, and scale values, but not shear. So far google isn't turning up much, other than tons of stuff on how to apply a shear to the matrix (I already have that in place).
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Well, the ShearX and ShearY values would be here:
1, Y, 0,
X, 1, 0,
0, 0, 1
If you already know how to apply shear to a matrix, whats so hard about getting the values? Am i completely missing something?
Infact, how are you getting the other values? If i were to scale along the x-axis by 2, and the y-axis by 3. Then translate by (5,3) i would end up with this matrix:
2, 0, 0
0, 3, 0
10,9, 1
But if i translate then scale we just get:
2, 0, 0
0, 3, 0
5, 3, 1
So how can you know what order transformations where done in, without knowing what transformations where applied and vice versa?
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
SK Genius wrote: Infact, how are you getting the other values?
Good question!
Here's the code for extracting the values. Note I got this from another lib, so I'm not 100% clear on all the math - I *think* I understand the idea behind it though.
double matrix_[3][3];
double Matrix2D::getRotation() const
{
double x1 = 0.0;
double y1 = 0.0;
double x2 = 1.0;
double y2 = 0.0;
apply(x1, y1);
apply(x2, y2);
return atan2(y2-y1, x2-x1);
}
void Matrix2D::getScale( double& x, double& y ) const
{
double x1 = 0.0;
double y1 = 0.0;
double x2 = 1.0;
double y2 = 1.0;
Matrix2D rot;
rot.rotate( -getRotation() );
rot.multiply( *this );
rot.apply(x1, y1);
rot.apply(x2, y2);
x = x2 - x1;
y = y2 - y1;
}
note that apply() simply transforms the (x,y) values by whatever is in the matrix_ array.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
I see, so you can get the rotation without worrying about scale or translate etc, because the rotation is completely separate. To get the scale you have to undo the rotation, so you can pretty much just get the values of X and Y here:
X, 0, 0
0, Y, 0
0, 0, 1
Shear and translate are in different parts of the matrix.
The problem is, both shear and translate are affected by Scale, so you'd have to know if the matrix was scaled before or after a shear or translate was applied (if at all).
Rotation isn't affected by scale because the angle remains the same, and the points just get further from the origin. So, the best you can do is to undo the rotation like you have in getScale() and just get the values from the matrix, even thought they may have been scaled.
So, using the apply method (rather than just using the array, i don't know if you have direct access to it):
void Matrix2D::getShear( double& x, double& y ) const
{
double x1 = 1.0;
double y1 = 1.0;
Matrix2D rot;
rot.rotate( -getRotation() );
rot.multiply( *this );
rot.apply(x1, y1);
x = x1-1;
y = y1-1;
}
I think...
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Jim,
SK is right, you should just be able to get these from inspection. Perhaps I don't understand what you want to extract. Do you want the shear equations?
|
|
|
|
|
|
Hi Guys. I posted this in the C# forum but I can't seem to get any help with finding something that can return a 16 digit number. I have a list of numbers that I need to sum up but the problem is that it totals to a 16 digit number or more. Problem is that currently I can't find anything that can do this in C# unless somebody here knows of anything else I can use.
Does anybody have any ideas??
Thanks in advance
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
If what you're totaling is overflowing a 16-bit number then you cannot return a 16 bit number without losing precision. You'd have to return at least a 32 bit number with the result of the summation.
For example:
short[] numbers = new short[] { short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue };
short total = 0;
foreach (short number in numbers)
total += number;
Console.WriteLine(total);
Returns -4 as the result, obviously not what you want, this is because you've overflowed and the number has rolled back to zero. If you change total to an int then you get the correct result.
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
Well, a 16-digit number is a 16-bit one only in base 2.
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
|
|
|
|
|