How to build arrow connected to a circle side - cesiumjs

I want to build a line with arrow, this arrow should be connected directly to a outer boundary of the circle.
The tricky thing is to maintain the same scenario when you zoom in and out, because the circle is bound to specific coordinate and when you zoom in, you start to see gap between arrow head and the circle.

Related

Google Slides Select Shape And Zoom to it

I am trying to use the functionality of Google Slides to create a complicated diagram of a complicated process. Basically, I have tiny rectangles (shapes) within larger rectangles within even larger rectangles, all on top of a huge rectangle that occupies my entire viewport with the maximum zoom out (Ctrl-Alt-Minus pressed many times). Rectangles have some small font text in them and there are also a bunch of connectors going from one rectangle to another.
It's a big mess.
When I want to see the details of a small rectangle, I use the provided Ctrl-Alt-Plus shortcut to zoom in as far as it lets me. However, it's incredibly cumbersome, because it will only zoom in to whatever is in the very center of the screen. So, I need to constantly adjust my view port to place what I want into the center of the screen.
What I want is to write a script (if such functionality is in fact provided - hence the question) where I could click on a specific rectangle and it would immediately zoom to this rectangle, placing it in the middle of my screen, it occupying about 50% of the screen space.
I looked through Google Slides API reference and found absolutely nothing related to zoom. Am I searching incorrectly, or is it simply not there?

How to have accurate collisions in Flash CS6 (AS3)

i am creating an endless runner game and the player as to jump over an obstacle, and if he touches it he looses health. The current collision code is this:
if (man_mc.hitTestObject(crate_mc)) {
health--;
health_txt.text=health.toString();
which is inside a loop. But the problem is that my obstacles are triangles, so when you jump over them if you touch the 'hit box' or dimensions of the triangle you loose health. So how do i make it so the collision is only true if my player is touching the triangle. (and the triangle is a png with transparent background)
EDIT: I found that i could use hitTestPoint instead of hitTestObject but how do i know what co ordinates to put into the parameters?
I would abandon the use of hitTestObject() (or even hitTestPoint()) for collision detection. Instead, I'd use another algorithm for collision detection in your game
I'll assume your player is a (pretty) skinny box and you said that your obstacles are triangles. I'd first try using a basic method of checking if any of the triangle's points are within the player's bounding box. If it is, then you have a collision.
You could also go the other way and check if a player's points in the bounding box are within any triangle, but you may end up with an odd case where a triangle is poking in to the player, but none of the player's points are within the triangle (which can happen if a player gets a triangle right up between the legs >.> ). Also, by going triangle first, there are less points to check per player and triangle pair.
Note that using this simple method won't tell you how much intersection there is, but I'm guessing you may not need that, since you were using the hitTestObject() method before.
Following my comment
I won't write the code for you line by line, but it's pretty easy to figure it out. So I'll describe one method:
Let's say your player is a rectangle that is 50px wide by 100px tall and the center of the player rectangle is set as the player's position. Half the width of the player is 25px and half the height is 50px.
So if the player is at say 240, 370 (a random spot I made up on screen), then to check if a point falls within you'd check if the x point is within 215 to 265 (240 +/- 25px) and if it is, then you'd check if the y point is within 320 and 420 (370 +/- 50px). If both these conditions are true, then the point is either touching or within the player box (so there is a collision). If any of them are false then the point is not (you could stop checking if the first condition is false, saving you a extra check operation).
Once you have that working (a point vs box test), then you'd just run a triangle's points through it to see if the triangle is intersecting the player box. How you get your triangle's points would vary based on your triangles.

AS3: having problems implementing correct rotation with atan2

I have the following scenario: player is in the middle of the screen and never moves from those coordinates. If I click with the mouse on the far right of the screen, the A* script kicks in and moves the background the player is on according with its own walkable/not walkable criteria, so for example if there is an obstacle in between the center of the screen where the player always is in the far right of the screen, the background correctly moves in the opposite direction And when needed moves around the obstacle, so you have the illusion of player walking, but instead only the background moves.
my problem is that I don't know how to rotate my player to simulate that he is following the path that the actual background is making. For example, in the beginning, the player is facing down. If I click on the right side of the screen, the player should face right. When an obstacle is present, the player should face the direction of the path around the obstacle and so on
but again technically my player never moves, so I don't know what coordinates should I have the atan2 use. In my mind I thought that the player should rotate toward the center of the next best hop in the array of best path created during the A* script, but for some reason I can't figure out the correct coordinates y and x for the atan2 command
I bet this is a simple thing I overlooked, but apparently my mind is in shutdown mode, so I can use a new fresh perspective :-)
thanks!
First, do not code in brain shutdown mode, this can save you lots of brainhurt time.
You don't need atan2() in this scenario, since your player is technically on a grid instead of on the screen. Give the player internal coordinates on the grid that will be updated as the player walks around the world, and use them in your A* script. The A* script generates a sequence of tiles the player should walk, thus you derive player's facing from current and next tile, for example, if the next tile to walk is adjacent upwards, you make the player face up and continue moving.

How to render a circular/radial progress bar in Libgdx?

For a game we develop with libgdx, we need to show the user the remaining time for making a move.
How can we render a circular progress bar which shows the remaining seconds?
In the following answer there is a javascript solution :
Circular / radial progress bar
Thanks.
First create a texture (region) with the full circular progress bar. Next deform a shape (mesh) made up of one or more triangles to fit the actual area which should be shown.
For this, think of a line from the center of the image to the bounds of the image. Calculate the intersection point (and "wall", i.e. left, right, top or bottom of the image) of the line at the given angle. This will give you the portion of the texture (region) that needs to be drawn.
For example, if the line at rest (angle is zero) crosses the bottom wall of the image at the middle, your image is square and you want to rotate clockwise, then everything between 45 and 135 degrees hits the left wall, between 135 and 225 degrees hits the top wall, and so on.
Now you have the shape, you'll need to express it in triangle. Or to maintain compatibility with libgdx's spritebatch, an even number of triangles. Make sure to update the U and V values according to the location of the vertex.
A simple implementation of this can be found over here: https://github.com/xoppa/world/blob/master/src/com/xoppa/android/misc/RadialSprite.java
You could use an OpenGL shader to generate a circular progress bar. Here is an animated timer that would be a good place to start: http://glsl.heroku.com/e#10201.0
However, I don't think there is any good Libgdx infrastructure for dropping in shaders like this. You would have to use the OpenGL APIs (see https://code.google.com/p/libgdx/wiki/OpenGLShader).

How to show Google Map in a different shape

I'm trying to find (without luck so far) any examples of Google Maps that are shown in a shape that is not the standard rectangle.
I know that ultimately the map IS a rectangle, but specifically I'd like examples of how I could show graphics on top of that rectangle to give the illusion that the map borders are a different shape.
To explain further what I mean, imagine a page with a black background with a standard Google Map (rectangle) in the top left. Now imagine placing a DIV over the bottom half of the map, where this DIV contains half a black circle and a transparent background. The purpose would be to give the illusion that the map has a curved bottom edge.
I'd then want to do something similar with the remaining 3 sides so that the map no longer appears like it's in a rectangle.
To explain further still, I'm going to be given a web page template which will have a shape - not a rectangle - into which I'm expected to put a Google Map...
Importantly, I'd still need to be able to 'grab' the map with the mouse and move it about within its 'new shape'.
Any advice would be appreciated - thanks.