polygon

JAVA draw regular polygon

北战南征 提交于 2019-12-23 06:11:51
问题 I am looking for an algorithm to draw regular polygon like triangle, quadrangle, pentagon, hexagon etc. I guess it`s basically dealing with the fact that all polygon points are located on the line of the circle. What`s the algorithm to calculate those N points for Polygon object? After drawing a regular polygon I need to draw another regular polygon based on the first one but rotated by K degrees. 回答1: Use sin and cos: double theta = 2 * Math.PI / sides; for (int i = 0; i < sides; ++i) {

Fill a triangle in 3D matplolib plot with a color gradient

 ̄綄美尐妖づ 提交于 2019-12-23 06:08:35
问题 I am trying to apply a colormap to a 3d Polygon. The polygon is fine, shows up in the correct position. The only thing I can't do is filling it with a gradient. Here is my code: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib.colors import LinearSegmentedColormap from mpl_toolkits.mplot3d.art3d import Poly3DCollection fig = plt.figure() ax = Axes3D(fig) x = [0,0,0] y = [0,1,0] z = [0,0,1] verts = [zip(x, y,z)] #(0,0,0) (0,1,0) (0,0,1) colors = ['red',

Fill polygon with custom hatch with matplotlib

对着背影说爱祢 提交于 2019-12-23 05:36:10
问题 I want to fill a bunch of polygons with line hatch. The lines must have a specific angle with respect to x-axis. I found that matplotlib already suppots some hatch classes and one can define a custom class (like How to fill a polygon with a custom hatch in matplotlib?). I tried to generate a custom hatch but when I append it to the list of hatches the init function doesn't know the angle. I tried with the following class: class AngularHatch(HatchPatternBase): def __init__(self, hatch, density

fillColor in Google Maps API polygon not working

笑着哭i 提交于 2019-12-23 02:39:13
问题 I try to create a polygon to cover an area with these code: map.addPolygon(new PolygonOptions() .add(new LatLng(-7.542257, 110.446209), new LatLng(-7.557232, 110.420116), new LatLng(-7.580375, 110.400890), new LatLng(-7.592626, 110.389904), new LatLng(-7.596710, 110.391277), new LatLng(-7.599433, 110.381664), new LatLng(-7.604877, 110.376171), new LatLng(-7.617128, 110.361065), new LatLng(-7.628017, 110.345959), new LatLng(-7.636184, 110.334972), new LatLng(-7.655239, 110.303387), new LatLng(

Is there an efficient\easy way to draw a concave polygon in Direct3d

风流意气都作罢 提交于 2019-12-22 09:45:38
问题 I'm trying to draw a polygon using c# and directx All I get is an ordered list of points from a file and I need to draw the flat polygon in a 3d world. I can load the points and draw a convex shape using a trianglefan and drawuserprimitives. This obviously leads to incorrect results when the polygon is very concave (which it may be). I can't imagine I'm the only person to grapple with this problem (tho I'm a gfx/directx neophyte - my background is in gui\windows application development). Can

google maps api v3 rotate a polygon by certain degree

醉酒当歌 提交于 2019-12-22 08:29:49
问题 I am using google maps to allow the user to draw a polygon then using maps APIs and some sort of geometries draw the min bounded square that cover the drawn polygon at angle of 16 degree i.e. the bounded square should bound the whole polygon area AND should be rotated 16 degree with respect to y-axis. your help is highly appreciated Regards 回答1: This is a complicated problem. I can outline the steps to get you most of the way there: Solution Outline Get the map projection (map.getProjection()

Ray-Polygon Intersection Point on the surface of a sphere

試著忘記壹切 提交于 2019-12-22 07:58:30
问题 I have a point (Lat/Lon) and a heading in degrees (true north) for which this point is traveling along. I have numerous stationary polygons (Points defined in Lat/Lon) which may or may not be convex. My question is, how do I calculate the closest intersection point, if any, with a polygon. I have seen several confusing posts about Ray Tracing but they seem to all relate to 3D when the Ray and Polygon are not on the same Plane and also the Polygons must be convex. 回答1: sounds like you should

How did google get the outline for postcodes on maps?

ぐ巨炮叔叔 提交于 2019-12-22 05:40:48
问题 For example: http://g.co/maps/2dpkj has the outline around the postcode area. I understand this is unavailable through the API , but where else can I get this data, eg in a KML format. This is for UK Data 回答1: Most likely Google have a licensing agreement with Ordnance Survey that allows them to use the Code Points with Polygons data - I imagine they've then done some processing of the data to generate a KML file. Depending on your GIS skills and your ability to read the source file (ESRI

Scaling an arbitrary polygon

不问归期 提交于 2019-12-22 05:24:14
问题 I've been scouring the internet for days, but have been unable to find a good answer (or at least one that made sense to me) to what seems like it should be a common question. How does one scale an arbitrary polygon? In particular, concave polygons. I need an algorithm which can handle concave (definitely) and self-intersecting (if possible) polygons. The obvious and simple algorithm I've been using to handle simple convex polygons is calculating the centroid of the polygon, translating that

Detect corner coordinates of a non-convex polygon in clockwise order MATLAB

情到浓时终转凉″ 提交于 2019-12-22 05:10:24
问题 I have some images which includes both convex as well as non-convex polygons. Each image contains exactly one polygon. I need to detect the corner coordinates and need to sort them in clock-wise or counter-clockwise order. For convex polygons, I use Harris corner detection for detecting corners and convexhull for sorting the points. But i dont have any idea on how to sort non-convex polygon. As my inputs are images, i think some Image Processing Technique might help to sort them out by moving