|
Sorry, I only speak English.
|
|
|
|
|
Yusuf
|
|
|
|
|
@Zep
I know that N is the width and the height is (0.75 x N). But i dont know the value of N.
I only know the area and the height ratio.
Cheers
Cloughy
|
|
|
|
|
So what you are saying is solving 0.75*N*N = known_area for N is a problem?
Did you consider dividing both sides by 0.75?
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
yes N is a problem. Just to clarify, N*(0.75*N)=Known_area.
Cheers
Cloughy
|
|
|
|
|
Multiply out the brackets:
0.75*N^2 = A
0.75N^2 = A
Change subject:
N^2 = A/(3/4)
N^2 = (4/3)A
N^2 = 1.33A
N = (square root of)1.33A
Substitute:
A = 40000
1.33A = 53200
N = square root of 53200
N = 230.651252
Perhaps something like that?
modified on Sunday, March 8, 2009 7:40 AM
|
|
|
|
|
Thanks for the input, but no.
Once i get the width(N) and the height(0.75*N). If i multiply H x W then i would still get 40000 for my area.
What i really need is a squared root function, but more like a Rectangle root.
The most important factor, is N.
So if my area is 480000, then width(N) = 800 and the height(0.75*N)= 600.
So my window would need to be set at 800x600. BTW area is never constant. I always get the ClientArea size of the mdi control.
Cheers
Cloughy
|
|
|
|
|
Cloughy wrote: but more like a Rectangle root.
What is that
See my post below for an equation
Yusuf
|
|
|
|
|
Yusuf wrote: What is that
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
oh, my bad.
Yusuf
|
|
|
|
|
Welcome in the CP's Memorable Quotes list [^].
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]
|
|
|
|
|
Don't forget - 25.8069758. That's the root of all evil.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
Nah. I was trying to lift the scientific character of this forum, now you had to butt in.
Next you'll claim 6.480740698407860230965967436088 is the solution root to most questions here.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Well it is.
|
|
|
|
|
Computafreak wrote: Multiply out the brackets:
0.75*N*N^2 = A
No, you started out with wrong equation.
Shouldn't it be
A = h * w
A = N * .75N
A = .75 * N^2
A/.75 = N^2
N = sqrt(A/.75)
we know A = 480000
N = sqrt(480000/.75 )
N = sqrt(360000 640000)
N = 600 800
[edit] modified calculation error, thanks Computafreak[/edit]
Yusuf
modified on Sunday, March 8, 2009 7:53 AM
|
|
|
|
|
My bad; I misread the equation. I've edited my post. Either way, I didn't think that 480000/0.75 was equal to 36000. Did you accidentally multiply?
|
|
|
|
|
Computafreak wrote: I didn't think that 480000/0.75
my bad, a bug in my calculation.
480000/0.75 = 640000
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Sorry for the delay in responding. You have enough information to solve this. You have two equations and two unknowns. We know the area and the width to height ratio.
So:
1.) width * height = area
2.) height = 0.75 * width
so, substituting (2) into (1)
0.75 * width * width = area
Rearranging:
3.) width = sqrt(area/0.75)
Using your numbers as an example:
width = sqrt(480000/0.75) = 800
then putting this into the height constraint:
height = 0.75 * width = 0.75 * 800 = 600
So for the 480,000 example, width should be 800, height 600. So, just solve equation (3) for the width and then plug the width result into (2) to get the height.
modified on Saturday, March 14, 2009 8:31 AM
|
|
|
|
|
Zeppelin, thank you. Just like Led Zeppelin, top of your field.
I would have never got there, but once i see it i completly understand it.
Cheers
Cloughy
|
|
|
|
|
No problem. It's what this forum is for.
|
|
|
|
|
Do you know a free Computer Graphics library complex and wide enough to make advanced artistic Computer Graphic effects?
Since it's hard to explain exactly what I'm talking about, here you can see the kind of thing I'm would like to be able to make: www.picturetopeople.org[^]. There they say it's all been made absolutely from scratch, but I'm afraid their CG libraries are not open source.
Some photo effects you can see in this address are well explained in CG text books, like the dithering, mosaic and warping ones, but there are many effects there I have never seen in books, like pencil, drawing, painting and sketch.
About text and pattern effects, maybe it's even harder. They look like drawing with very complex procedural brushes matching directional fields or so. I couldn't find advanced enough explanations to achieve that result level.
Is there any CG library able to make all of that?
|
|
|
|
|
You could take a look at the Paint.Net source code.
|
|
|
|
|
I already made it. paint.net is too much simple. It has just the trivial.
I had a look at gimp source. It's much better than paint.net, but it's still far from what I want.
I'm afraid there is no so advanced people doing open source Computer Graphics software.
Anyway, I'm still looking for.
|
|
|
|
|
hi, there
It's my first time to post a question here to ask for help because the problem is drving me crazy. Everyone who give a direct answer or redirect-url resources is appreciable.
here is the problem:
I decide to grab web-pages from a website, what my policy is that I use a main thread to find many items in a page and i send each item to a thread to deal with. So this is a parallel muti-thread problem. and I find out that the whole process stuck somewhere and the usage of the CPU climed up to 100%. here is the main code that i think is asscociated:
<pre>
HANDLE hSemaThr,hSema,hContent;
main(){
....Handle hCont=CreateFile(....);
hSema=CREATESemaphore(0,1,1,0);
hSemaThr=CREATEMUTEX(0,10,10,0);//this Semaphore is to control thread-buildings so that there are 10 threads in the process at most
WHILE(regex_search(begin,end,stringmatch,r)){
string s=stringmatch[0];
begin=stringmatch[0].second;
WaitForSingleObject(hSemaThr,INFINITE);
CreateThread(0,0,Grab,(void*)dc,0,0);
}
CloseHandle(hCont);
}
void Grab(void* doc){
......
......
WaitForSingleObject(hSema,INFINITE);
if(!WriteFile(::hCont,lpBuf,(int)strlen(lpBuf),&lpN,0)){
cout < <"can't write file in thread" < <GetLastError() < <endl;
//system("pause");
}
ReleaseSemaphore(hSema,1,0);
WaitForSingleObject(hMutexThr,INFINITE);
CanThr--;
ReleaseSemaphore(hSemaThr,1,0);
}
</pre>
Can somebody help me!
Thanks very much!
|
|
|
|
|
sorry, when i extrat my code i forget to change some words:
here is the right one and I have release the semaphore in each thread, right in front of "return", and I know the queuing policy is better but I just want to find out what's wrong with my program,by the way at the same time there can only be 10 threads because of my semaphore controling policy.see"//"
<pre>main(){
....Handle hCont=CreateFile(....);
hSema=CREATESemaphore(0,1,1,0);
hSemaThr=CREATEMUTEX(0,10,10,0);//so there are only 10 threads at most in the same time
WHILE(regex_search(begin,end,stringmatch,r)){
string s=stringmatch[0];
begin=stringmatch[0].second;
WaitForSingleObject(hSemaThr,INFINITE);
CreateThread(0,0,Grab,(void*)dc,0,0);
}
CloseHandle(hCont);
}
void Grab(void* doc){
......
......
WaitForSingleObject(hSema,INFINITE);
if(!WriteFile(::hCont,lpBuf,(int)strlen(lpBuf),&lpN,0)){
cout < <"can't write file in thread" < <GetLastError() < <endl;
//system("pause");
}
ReleaseSemaphore(hSema,1,0);
ReleaseSemaphore(hSemaThr,1,0);
return;
}</pre>
|
|
|
|
|