I am trying to add a trianlge shape from the Popup "Address Details" to the pin point I have on the map. To try and give it the effect that the Address Details is coming from the pin point. I tried messing around with some code from Abode to get a triangle to show up but all it did was make my Address Details disappear. This is the site from Abode I tried using. http://livedocs.adobe.com/flex/3/html/help.html?content=Drawing_Vector_Graphics_4.html
If anyone could help me figure out how to do the triangle or maybe another suggestion for what I am trying to accomplish it would be greatly appreciated.
EDIT: Showing code I have tried
// green triangle, starting at point 200, 0
triangle.graphics.beginFill(0x00FF00);
triangle.graphics.moveTo(200 + triangleHeight/2, 0);
triangle.graphics.lineTo(200 + triangleHeight, triangleHeight);
triangle.graphics.lineTo(200, triangleHeight);
triangle.graphics.lineTo(200 + triangleHeight/2, 0);
this.addChild(triangle);
var line:Graphics;
line.moveTo(100,100);
line.lineTo(200,200);
Above are the two different things I tried. I didn't try to match the points exactly yet just trying to get it to display first. But If I added any of this I never saw a shape, didn't get any errors, and my Address Detail Panel would simple show the blue header and nothing more.
This is what I would like to attempt to do.
Related
How i can generate a Island shaped 2d Map with tiled cubes? Does someone can give me tipps or links or some other help please?
I already tried it with Noise but it ends in weird results cause i dont get how i use it in a 2d way.
Also i tried to give each tiles numbers so i knew what was the last placed tile.
But that ended in a big Chaos.
What i dont understand right now is how to "move" in that grid or how to know what was last and what could be the next and ye.
I really guess there is a simple way to handle that all which i dont realize at the moment?
I work for right now only with BP.
Thanks
What options should I use for making my graph looking like an Elipse ? I was messing with the hierarchical option under the layout module, but I've not gotten nowhere near my desired shape.
My graph is left to right, left node group connects to middle one, and middle one connects to the right one. It can be perceived as this image below.
Can someone point me in the right direction ? Thanks for your expertise
As for the elliptic shape around the nodes and edges, you can either set a background image to your graph area or create a node of large size (but this way you may have troubles with node repulsion, though). Unfortunately, there's no way to make sure that all the nodes will always be inside the ellipse (unless you access the vis' canvas and deal with it on low level or do some other hackery).
Also AFAIK it is impossible to create those wavy edges, but for those rounded ones you may want to use repulsion physics instead of barnesHut. See also physicsConfiguration example.
I have to plot a graph in processing by the feedback from encoder motors of the bot. so I have two variables basically left motor encoder and right motor encoder. I planned to vary on in x-axis and another in y-axis. While I went through some of the code on internet I found that, almost everyone has written the graph part code in serial event itself?
So my first doubt is why do they write it in serial event() function rather than void draw()? Another thing is when I tried to write my code for graph in void draw() it had a pseudo code something like this:
xpos1=0,ypos1=height;
void draw():
line(xpos1,ypos1,xpos,height-ypos);// obviously the data(xpos,ypos) is mapped with the width and height of the processing ide window.
xpos1=xpos;
ypos1=height-ypos;
if(xpos1>=width)
{
xpos1=0;
}
if(ypos1>=height)
{
ypos1=0;
}
So I get to see only a small dot traversing on processing ide window and I cannot see the older path that my line has travelled which in the case of the sites which I described when wrote the similar piece of code in serial event() they had a whole graph getting made on the processing window.
Where am I getting wrong? Also is there any alternative to plot the graph using void draw()? I want to vary both xpos as well as ypos as i get two feedbacks form left motor and right motor.
Screenshot of my attempted graph in different frames!
Image
Screenshot of one of the graphs made by somewhat the similar code displayed above but written in the serial event() available on the internet:
As stated in the comments, there are too many subquestions here.
Regarding the question relative to the code, there is one main line that is making the code much more complex than it has to be. You are trying to draw a line between each and every couple of numbers received by the two encoders. There is no need to do that. When plotting a graph, I personally use the point(x,y) function. It's much easier to implement for prototyping purposes, and adjusting the frameRate() at which the sketch is running, you won't notice the difference.
void draw() {
point(encoder1, encoder2);
if (encoder1 >= width) {
encoder1 = encoder1 - width;
}
if (encoder2 >= height) {
encoder2 = encoder2 - height;
}
}
A simple sketch like this one will do the job.
The other thing that is not quite clear is the initialisation of the variables. Usually you initialise a variable if it's continuously increasing, like time, but from your description you want to plot on the X axis one encoder, and on the Y axis the other encoder. So wouldn't it be better to map the values to start with in order not to have them go out of the canvas range?
Please edit the question so that the code is clear and concise, following these guidelines, and try to ask one question per post.
If I have an object performing this CAKeyframe Animation path (it is just an oval shape in the upper region of an iphone..
UIBezierPath *trackPath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(20, 100, 280, 150)];
Now imagine that at anytime during this paths travels I want to create a smooth path from its current position at a point in time and some point at the bottom of the screen.
By the way I am assuming that once I have a path I can stop the current CAKeyframeAnimation and add this path to a new CAKeyframe animation, but maybe if this is incorrect you can give me pointers here as well please.
So I said to myself "Self.....it looks like you are going to have to answer this one yourself as nobody even wants to edit it or say that it is a duplicate......"
So I was hoping for some easier or ready made way to do this. From what I have found there is no easy way. It seems the steps are going to be;
get the current position of the animated layer
calculate yourself with all your own code a nice smooth curve
add this path to an animation and animate it.
As for the calculation of a Bezier Curve I am still looking to find some class or code where points can be plugged into it and the two control points are produced for the UIBezier class to produce a curve.
In my case I am going to only animate "out" of my above questioned shape a determined points and thus have ready made smooth curves which I have prepared.
Animating a smooth exit from an oval at any point is very complicated and In my case just not worth it. So I have not done that.
I want to generate a cube where each face is divided into bits, like the following image:
http://img59.imageshack.us/img59/2504/gridcube165c3.jpg
Now, I can do this pretty simply if I'm just rendering quads, by just spacing vertices along each face plane at regular intervals, but my problem comes in when I want to turn the whole thing into a triangle strip. I've just got no idea how to unwrap it programmatically- is there some pattern to unwrapping that I'd follow?
I'm thinking of starting with the vertex at the top left corner as Row 0 Column 0 (R0C0), I'd want (first triangle) R0C0, ROC1, R1C1, (second triangle) R0C0, R1C0, R1C1 and so forth, and then when I reach the end of a row I guess I'd use a degenerate triangle to move to the next row, and then when I reach the end of the face I'd do the same to start a new face.
My main problem is that I can't visualize the program loop that would do this. I can reason out which vertex comes next visually, which is how I worked out the order above, but when I try to think programmatically I just stare blankly.
Even worse, with the end product I want the generated cube to be UV-mapped with a simple cube-map unwrap (the kind that looks like a T or t).
I guess, really, the best solution would be to find a library that already does this for me.
You could take a look at Ignacio CastaƱo's 'Optimal Grid Rendering' even though it's not triangle strips, it may inspire you.
Otherwise, you could use NVTriStrip library and be done with it.