i am trying to draw a perpindecular line to some existing line, like shown below:
I start with two points A and B that form a line, and calculate point C like so:
C.x = (A.x + B.x) / 2;
C.y = (A.y + B.y) / 2;
Now how could I calculate D?
I know I could just draw my line again and rotate it by 90° degrees but I would like to get it working without this little cheat ;)
Any help really appreciated, I guess its not that hard but I dont see it ...
Ends in "R does not have a field menu" , which is bullshit. I do have a plain menu.xml file, and it is also referenced in the generated R.java file.
Okay, so I thought maybe I can create the menu by code instead of using an xml. That works to some extent, I can create a menu with default text buttons using this method:
Cool, but: I cannot set Icons like that, so I am stuck with the default ugly text button style. When I try to reference my menu items in a variable and use "setIcon(..)" I again have to give it an icon resource, which it does not find (R has no field blabla...).
Very annoying. Any ideas why it tells me R does not have the fields although it has?
EDIT: When I use the code in a normal "Activity"-class, it works. When I use it inside a "PApplet"-class (having added the processing-core.jar to the build path of the project), it no longer finds any resources of the project from inside the class... Any ideas how to tackle this?
I am just starting with Android + Processing + Eclipse (yes it's evil I know, still...). Ive got a simple android app running, with one activity and a simple sketch inside that lets me draw colored ellipses. I can send it to my HTC Wildfire S with no problem.
Now I have 2 questions that I am having a tough time answering:
How do I use Toasts within the processing code? Is it even possible? Crashes my app instantly.
How do I override the default key behaviour? I want to use the volume keys to change some variables, and it works, but still they change the volume at the same time.
I have set the keyCode to 0 as described in the wiki, does not work, also not on the BACK button:
<code>
public void keyPressed() {
background(255); // clear canvas