Search Results

Search found 383 results on 16 pages for 'polygon'.

Page 3/16 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • determine if line segment is inside polygon

    - by dato
    suppose we have simple polygon(without holes) with vertices (v0,v1,....vn) my aim is to determine if for given point p(x,y) any line segment connecting this point and any vertices of polygon is inside polygon or even for given two point p(x0,y0) `p(x1,y1)` line segment connecting these two point is inside polygon? i have searched many sites about this ,but i am still confused,generally i think we have to compare coordinates of vertices and by determing coordinates of which point is less or greater to another point's coordinates,we could determine location of any line segment,but i am not sure how correct is this,please help me

    Read the article

  • Using polygons instead of quads on Cocos2d

    - by rraallvv
    I've been looking under the hood of Cocos2d, and I think (please correct me if I'm wrong) that although working with quads is a key feature of the engine, it should't be dificult to make it work with arrays of vertices (aka polygons) instead of quads, being the quads a special case of an array of four vertices by the way, does anyone have any code that makes cocos2d render a texture filled polygon inside a batch node? the code posted here (http://www.cocos2d-iphone.org/forum/topic/8142/page/2#post-89393) does a nice job rendering a texture filled polygon but the class doesn't work with batch nodes

    Read the article

  • How can I make Maya export a mesh as double-sided?

    - by bobobobo
    I'm exporting from Maya 2009 to OBJ. The mesh I'm exporting has in it's Render Stats "Double Sided" checked, but when the polygon is exported, only a single side is actually exported. What really needs to happen is for each polygon that is double sided, two polygons need to be exported, facing in opposite directions.. I can do this manually, but is there a way to make the OBJ exporter do it for me?

    Read the article

  • Point in Polygon, Ray Method: ending infinite line

    - by user2878528
    Having a bit of trouble with point in polygon collision detection using the ray method i.e. http://en.wikipedia.org/wiki/Point_in_polygon My problem is I need to give an end to the infinite line created. As with this infinite line I always get an even number of intersections and hence an invalid result. i.e. ignore or intersection to the right of the point being checked what I have what I want My current code based of Mecki awesome response for (int side = 0; side < vertices.Length; side++) { // Test if current side intersects with ray. // create infinite line // See: http://en.wikipedia.org/wiki/Linear_equation a = end_point.Y - start_point.Y; b = start_point.X - end_point.X; c = end_point.X * start_point.Y - start_point.X * end_point.Y; //insert points of vector d2 = a * vertices[side].Position.X + b * vertices[side].Position.Y + c; if (side - 1 < 0) d1 = a * vertices[vertices.Length - 1].Position.X + b * vertices[vertices.Length - 1].Position.Y + c; else d1 = a * vertices[side-1].Position.X + b * vertices[side-1].Position.Y + c; // If points have opposite sides, intersections++; if (d1 > 0 && d2 < 0 ) intersections++; if (d1 < 0 && d2 > 0 ) intersections++; } //if intersections odd inside = true if ((intersections % 2) == 1) inside = true; else inside = false;

    Read the article

  • Howto project a planar polygon on a plane in 3d-space

    - by sum1stolemyname
    I want to project my Polygon along a vector to a plane in 3d Space. I would preferably use a single transformation matrix to do this, but I don't know how to build a matrix of this kind. Given the plane's parameters (ax+by+cz+d), the world coordinates of my Polygon. As stated in the the headline, all vertices of my polygon lie in another plane. the direction vector along which to project my Polygon (currently the polygon's plane's normal vector) goal -a 4x4 transformation matrix which performs the required projection, or some insight on how to construct one myself

    Read the article

  • Highlight polygon and tint rest of map using Google Maps

    - by Haes
    Hi, I'd like to display a highlighted polygon using Google Maps. The idea is that the polygon in question would be displayed normally and the rest of the map should be darkened a little bit. Here's an example image what I would like to accomplish with a polygon from Austria: Unfortunately, I'm a complete rookie when it comes to Google Maps API's and map stuff in general. So, is this even possible do this with Google Map API's? If yes, with what version (v2, v3)? Would it be easier to do it with other map toolkits, like openlayers? PS: One idea I had, was to build an inverse polygon (in this example, the whole world minus the shape of austria) and then display a black colored overlay with transparency using this inverted polygon. But that seems to be quite complicated to me.

    Read the article

  • Construct A Polygon Out of Union of Many Polygons

    - by Ngu Soon Hui
    Supposed that I have many polygons, what is the best algorithm to construct a polygon--maybe with holes- out of the union of all those polygons? For my purpose, you can imagine each piece of a polygon as a jigsaw puzzle piece, when you complete them you will get a nice picture. But the catch is that a small portion <5% of the jigsaw is missing, and you are still require to form a picture as complete as possible; that's the polygon-- maybe with holes-- that I want to form. My naive approach is to take two polygons, union them, and take another polygon, union it with the union of the two polygons, and repeat this process until every single piece is union. Then I will run through the union polygon list and check whether there are still some polygons can be combined, and I will repeat this process until a satisfactory result is achieved. But this seems to be like an extremely naive approach. I just wonder is there any other better algorithm?

    Read the article

  • Collision detection with multiple polygons simultaneously

    - by Craig Innes
    I've written a collision system which detects/resolves collisions between a rectangular player and a convex polygon world using the Separating Axis Theorem. This scheme works fine when the player is colliding with a single polygon, but when I try to create a level made up of combinations of these shapes, the player gets "stuck" between shapes when trying to move from one polygon to the other. The reason for this seems to be that collisions are detected after the player has been pushed through the shape by its movement or gravity. When the system resolves the collision, it resolves them in an order that doesn't make sense (for example, when the player is moving from one flat rectangle to another, gravity pushes them below the ground, but the collision with the left hand side of the second block is resolved before the collision with the top of the block, meaning the player is pushed back left before being pushed back up). Other similar posts have resolved this problem by having a strict rule on which axes to resolve first. For example, always resolve the collision on the y axis, then if the object is still colliding with things, resolve on the x axis. This solution only works in the case of a completely axis oriented box world, and doesn't solve the problem if the player is stuck moving along a series of angled shapes or sliding down a wall. Does any one have any ideas of how I could alter my collision system to prevent these situations from happening?

    Read the article

  • A* navigational mesh path finding

    - by theguywholikeslinux
    So I've been making this top down 2D java game in this framework called Greenfoot [1] and I've been working on the AI for the guys you are gonna fight. I want them to be able to move around the world realistically so I soon realized, amongst a couple of other things, I would need some kind of pathfinding. I have made two A* prototypes. One is grid based and then I made one that works with waypoints so now I need to work out a way to get from a 2d "map" of the obstacles/buildings to a graph of nodes that I can make a path from. The actual pathfinding seems fine, just my open and closed lists could use a more efficient data structure, but I'll get to that if and when I need to. I intend to use a navigational mesh for all the reasons out lined in this post on ai-blog.net [2]. However, the problem I have faced is that what A* thinks is the shortest path from the polygon centres/edges is not necessarily the shortest path if you travel through any part of the node. To get a better idea you can see the question I asked on stackoverflow [3]. I got a good answer concerning a visibility graph. I have since purchased the book (Computational Geometry: Algorithms and Applications [4]) and read further into the topic, however I am still in favour of a navigational mesh (See "Managing Complexity" [5] from Amit’s Notes about Path-Finding [6]). (As a side note, maybe I could possibly use Theta* to convert multiple waypoints into one straight line if the first and last are not obscured. Or each time I move back check to the waypoint before last to see if I can go straight from that to this) So basically what I want is a navigational mesh where once I have put it through a funnel algorithm (e.g. this one from Digesting Duck [7]) I will get the true shortest path, rather than get one that is the shortest path following node to node only, but not the actual shortest given that you can go through some polygons and skip nodes/edges. Oh and I also want to know how you suggest storing the information concerning the polygons. For the waypoint prototype example I made I just had each node as an object and stored a list of all the other nodes you could travel to from that node, I'm guessing that won't work with polygons? and how to I tell if a polygon is open/traversable or if it is a solid object? How do I store which nodes make up the polygon? Finally, for the record: I do want to programme this by myself from scratch even though there are already other solutions available and I don't intend to be (re) using this code in anything other than this game so it does not matter that it will inevitably be poor quality. http://greenfoot.org http://www.ai-blog.net/archives/000152.html http://stackoverflow.com/q/7585515/ http://www.cs.uu.nl/geobook/ http://theory.stanford.edu/~amitp/GameProgramming/MapRepresentations.html http://theory.stanford.edu/~amitp/GameProgramming/ http://digestingduck.blogspot.com/2010/03/simple-stupid-funnel-algorithm.html

    Read the article

  • Can one use polygon() or equivalent in lattice and ggplot2 plots?

    - by Alex Reynolds
    Is it possible to annotate lattice (or ggplot2) figures with elements created with polygon() (or elements created with a similar function) from the graphics library? I'm not too familiar with either library beyond examples of simple graphs posted on the web and printed in Deepayan Sarkar's book. Therefore, while I have code for what I've been doing in R with the graphics library, pointing me to relevant, equivalent functions and usage examples for lattice or ggplot2 specifically would be appreciated. Thanks.

    Read the article

  • Why do game engines convert models to triangles compared to keeping it as four side polygon

    - by Grant
    I've worked using maya for animation and more film orientated projects however I am also focusing on my studies on video game development (eventually want to be either programmer or some sort of TD with programming and 3D skills). Anyways, I was talking with one of my professor and we couldn't figure out why all game engines (that I know of) convert to triangles. Anyone happen to know why game engines convert to triangles compared to leaving the models as four sided polygons? Also what are the pros and cons (if any) of doing this? Thanks in advance.

    Read the article

  • converting 2d grid of squares to polygon nav mesh

    - by Roflha
    I haven't actually started programming for this one yet, but I wanted to see how I would go about doing this anyway. Say I have a 2D matrix of squares, all of the same size, some traversable and some not. How would I go about creating a navigation mesh of polygons from this grid. Is there any reading I can look at until I get a chance to get to my computer or should I just give it a go. My idea was to take the non-traversable squares out and extend lines from there edges to make polygons.. that's all I have got so far. Any advice?

    Read the article

  • Find the centroid of a polygon with weighted vertices

    - by Calle Kabo
    Hi, I know how to find the centroid (center of mass) of a regular polygon. This assumes that every part of the polygon weighs the same. But how do I calculate the centroid of a weightless polygon (made from aerogel perhaps :), where each vertex has a weight? Simplified illustration of what I mean using straight line: 5kg-----------------5kg ^center of gravity 10kg---------------5kg ^center of gravity offset du to weight of vertices Of course, I know how to calculate the center of gravity on a straight line with weighted vertices, but how do I do it on a polygon with weighted vertices? Thanks for your time!

    Read the article

  • Polygonal Triangulation - algorithm with O(n log n) complexity

    - by Arthur Wulf White
    I wish to triangulate a polygon I only have the outline of (p0, p1, p2 ... pn) like described in this question: polygon triangulation algorithm and this webpage: http://cgm.cs.mcgill.ca/~godfried/teaching/cg-projects/97/Ian/algorithm2.html I do not wish to learn the subject and have a deep understanding of it at the moment. I only want to see an effective algorithm that can be used out of the box. The one described in the site seems to be of somewhat high complexity O(n) for finding one ear. I heard this could be done in O(n log n) time. Is there any well known easy to use algorithm that I can translate port to use in my engine that runs with somewhat reasonable complexity? The reason I need to triangulate is that I wish to feel out a 2d-outline and render it 3d. Much like we fill out a 2d-outline in paint. I could use sprites. This would not serve cause I am planning to play with the resulting model on the z-axis, giving it different heights in the different areas. I would love to try the books that were mentioned, although I suspect that is not the answer most readers are hoping for when they read this Q & A format. Mostly I like to see a code snippet I can cut and paste with some modifications and start running.

    Read the article

  • Is there any hueristic to polygonize a closed 2d-raster shape with n triangles?

    - by Arthur Wulf White
    Lets say we have a 2d image black on white that shows a closed geometric shape. Is there any (not naive brute force) algorithm that approximates that shape as closely as possible with n triangles? If you want a formal definition for as closely as possible: Approximate the shape with a polygon that when rendered into a new 2d image will match the largest number of pixels possible with the original image.

    Read the article

  • Finding the centeroid of a polygon?

    - by user146780
    I have tried: for each vertex, add to total, divide by number of verities to get center. I'v also tried: Find the topmost, bottommost - get midpoint... find leftmost, rightmost, find midpoint. Both of these did not return the perfect center because I'm relying on the center to scale a polygon. I want to scale my polygons so I may put a border around them. What is the best way to find the centroid of a polygon given that the polygon may be concave, convex and have many many sides of various lengths. Thanks

    Read the article

  • Draw polygon using mouse on google maps

    - by Kunal
    I need to draw polygon using mouse and mark a particular area on google maps. The purpose is to mark an area on google maps and then showing hotels and attractions on that area. The user will mark the hotels on google map while creating them so the db will have their latitude and longitudes. How can I draw the polygon and fill it with a color as background to mark the area in Google Maps? I have read the API Manual “how to draw polygons?” basically you would need to mark multiple points and then combine them into a polygon. But I will need to do this using mouse drag, just like drawing a shape. Kindly help me out how to achieve this. Thanks in advance.

    Read the article

  • Texture coordintes for a polygon and a square texture

    - by user146780
    basically I have a texture. I also have a lets say octagon (or any polygon). I find that octagon's bounding box. Let's say my texture is the size of the octagon's bounding box. How could I figure out the texture coordinates so that the texture maps to it. To clarify, lets say you had a square of tin foil and cut the octagon out you'd be left with a tin foil textured polygon.I'm just not sure how to figure it out for an arbitrary polygon. Thanks

    Read the article

  • Determine the lat lngs of markers within a polygon

    - by subh
    I have a google maps app which plots markers as it loads. One of the new requirment is to to add a Polygon overlay encompassing a selection of markers by the user. I was able to achieve that using the Geometry Controls of the GMaps Utility Library Now, the next step is to form a group of the selected markers for which I would need to determine if the lat lngs of the markers falls within the lat lngs of the polygon? Is there a way to determine the lat lngs of a polygon and compute if the marker's lat lng is within its boundaries?

    Read the article

  • Finding the centroid of a polygon?

    - by user146780
    I have tried: for each vertex, add to total, divide by number of verities to get center. I'v also tried: Find the topmost, bottommost - get midpoint... find leftmost, rightmost, find midpoint. Both of these did not return the perfect center because I'm relying on the center to scale a polygon. I want to scale my polygons so I may put a border around them. What is the best way to find the centroid of a polygon given that the polygon may be concave, convex and have many many sides of various lengths. Thanks

    Read the article

  • Generate a polygon from line.

    - by VOX
    I want to draw a line with thickness in j2me. This can easily be achieved in desktop java by setting Pen width as thickness value. However in j2me, Pen class does not support width. My idea is to generate a polygon from the line I have, that resembles the line with thickness i want to draw. In picture, on the left is what I have, a line with points. On the right is what I want, a polygon that when filled, a line with thickness. Could anyone know how to generate a polygon from line? http://www.freeimagehosting.net/uploads/140e43c2d2.gif

    Read the article

  • Determine outer boundries of polygon from lat/lng point array

    - by DustinDavis
    I have a large array of lat/lng points. Could be up to 20k points. I'm plotting them using KML. What I want to do is to take only the outter most points and use them to draw a polygon instead. I already know how to draw a polygon in kml, I just need to figure out how to select only the outer most points of the group. Any ideas? I'd like to have at least 5 points to the polygon but no more than 25 points total. So far i've come up with checking for top most and bottom most points (basically crearing a square) using < & logic. The points will be in america & canada only if that matters. Thanks for any help.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >