Ok, so I have a ray that's coming down from a known angle. I know the angle, the ray's length, the top and bottom end's coordinates. I chose a predefined (x,y) bottom end and with sin() and cos() I managed to determine the (x,y) position of the top end of the ray in order to maintain the angle. But what I've done so far is draw the ray in it's starting position. In order for me to move it while maintaining the angle, I need velocity.
but I just can't figure out how to calculate that velocity. If you guys could throw me some piece of code or make me understand how to do it, I would be so grateful.
I just can't make the toggle() function to work. I want to change a variable's value in there and it just won't work. I'm an amateur so please excuse me if this seems like a "1+1" question.
Here's how I created my toggle:
tog.addToggle("off")
.setPosition(40,260)
.setSize(15,15)
.setState(false)
;
and here's how I figured out the toggle() function should work:
void toggle(boolean theFlag)
{
if(theFlag==true)
bisect=1;
else
bisect=0;
}
Also, how can I change the toggle's captionLabel? How about the highlight color?
1. Ok, so... I want to make a line come from the top of the screen down. I know the angle from which that line will come and the length of the line. I've pictured it as my line being the hypothenuse on a right triangle. If I know the hyphotenuse length and the angle theta and let's say... the (x,y) position of the bottom end of the hypothenuse, how can I determine the (x,y) position of the top end of the hypothenuse in order for the line to maintain the angle theta? And after I know the (x,y) position of the top end and drew my line, I would like to know the formula that changes the (x,y) position of both bottom end and top end at the same time, in order for the line to go all the way down while maintaining the angle theta. Picture it as a solar ray coming down.
2. After that solar ray comes down and hits an obstacle, it reflects right? Changing the angle in which it goes. I would like to know the formulas that calculate the new angle of the ray when it comes in contact with the surface of a sphere, a rect and a parabole.
Ok, so I was wondering if I can set the InputFilter of a textfield to INTEGER and also let it write only numbers from 00 to 23 (yeah, for hours)... I was thinking of restricting the first digit beeing above 2 and if it is 2 to restrict the second digit of going above 3, but I don't have any idea of how to do that. I tried with regex, but as I'm kind of a novice in programming, it didn't work for me.
Here's the piece of code in which i restrict the textfield with regex. As it is, it let's me write only numbers, but I would like to make it write only numbers ranged from 00 to 23.
Ok, so I managed to do a drag and drop of some figures, but if I drag it really quick it drops... like I released the mouse button. The figure doesn't keep up with the mouse's speed. I saw a similar question, but couldn't really understand what's been done.
Can someone please tell me exactly how to stop the dropping? Thank you in advance!