polygon

wrong border coords on draw a polygon with the fabric.js

会有一股神秘感。 提交于 2020-01-15 09:12:06
问题 i try to draw a polygon with the mouse , and i have found that example on jsfiddle: http://jsfiddle.net/Kienz/ujefxh7w/. the problem is that when we finish the draw and try to selet the object, the borders are outside of the shape. can we fixe that or is it a fabric.js bug? as we can also see on the official fabricjs.com/ page, on the front page examples, the free hand drawings are also out of the border frame. // initialize fabric canvas and assign to global windows object for debug var

How do i find pixels points inside quadrilateral using Java?

回眸只為那壹抹淺笑 提交于 2020-01-14 19:24:26
问题 Im doing some image processing and I have the coordinates of the 4 points of a quadrilateral. (something like a trapezium) How can i get the coordinates of all the pixels inside it? I'm using Java by the way. Thanks! 回答1: You need scanline polygon filling. Here's a quick PDF lecture on the subject: http://www.cs.binghamton.edu/~reckert/460/lect11_2009-areafill-transformations.pdf Here's a web page example with some sample C code and a good illustration of the basic idea: http://alienryderflex

White Pixels With GL_POLYGON_SMOOTH

时光毁灭记忆、已成空白 提交于 2020-01-14 05:21:11
问题 I had a problem where white pixels appeared randomly (sort of) on objects in OpenGL. This is an example of what was going on. While searching Stack Overflow for other people who may have had this problem, I found that GL_POLYGON_SMOOTH wasn't worth enabling. I disabled it, and the spots disappeared (this was lucky of me). This was very lucky, but I still don't understand why enabling GL_POLYGON_SMOOTH creates these artifact-thingies. Can someone explain why they appear? Also note I had

FillPolygon with holes

眉间皱痕 提交于 2020-01-11 12:32:21
问题 I want to create a "fill" that fills the inside of a polygon, created using a point list, but be able to remove its holes. My old code: Private Sub DrawSomething(ByVal points as List(of Point), _ ByVal myBrush As System.Drawing.Brush, _ ByVal myGraphics As System.Drawing.Graphics) myGraphics.FillPolygon(myBrush, points) End Sub It simply fills a polygon created by the contour of the points in the list. How can I fill the polygon, but exclude the holes in it (which I know are inside, I have

rotate polygon around point in leaflet map

…衆ロ難τιáo~ 提交于 2020-01-11 04:12:06
问题 I have an issue, in my leaflet map I've created a triangle from polygon: var polygon = L.polygon([ [parseFloat(decimal_lat),parseFloat(decimal_lon)], [parseFloat(decimal_lat) + 1, parseFloat(decimal_lon) - 1], [parseFloat(decimal_lat) + 1, parseFloat(decimal_lon) + 1] ], { color:'green' }); polygon.addTo(map); and I want to rotate this polygon around Point[decimal_lon, decimal_lat] . But I'm not able to solve it.. I've created DEMO, where I'm rotating polynom the same I want to rotate my

MKCircle is not updating radius but it's translating

一曲冷凌霜 提交于 2020-01-10 16:15:08
问题 I've to draw an MKCicle into an MKMapView. Then I've to re-draw it when user, through a slider, change the radius. I remove it and I re-create it, re-adding it to the map. But instead of do what I'm expecting, I see the MKCircle translating over the map, maintaining the same size. Here's my code: - (MKOverlayView *)mapView:(MKMapView *)map viewForOverlay:(id)overlay { MKOverlayView* overlayView = nil; if(overlay == self.circle) { //if we have not yet created an overlay view for this overlay,

MKCircle is not updating radius but it's translating

こ雲淡風輕ζ 提交于 2020-01-10 16:12:00
问题 I've to draw an MKCicle into an MKMapView. Then I've to re-draw it when user, through a slider, change the radius. I remove it and I re-create it, re-adding it to the map. But instead of do what I'm expecting, I see the MKCircle translating over the map, maintaining the same size. Here's my code: - (MKOverlayView *)mapView:(MKMapView *)map viewForOverlay:(id)overlay { MKOverlayView* overlayView = nil; if(overlay == self.circle) { //if we have not yet created an overlay view for this overlay,

How can I change the size of a figure made in Java Graphics2D with a slider?

北城以北 提交于 2020-01-10 06:16:38
问题 I'm trying to make a program with java using Graphics 2D that paints polygons between 3 and 8 sides and that I can resized with a slider but I do not know how to do for change it size with the slider evenly. Here is a example of my pentagon drawn if (sides == 5){ g.drawLine(110+x,135-y, 10+x,205-y); g.drawLine(10+x,205-y, 48+x, 320-y); g.drawLine(48+x,320-y, 170+x,320-y); g.drawLine(170+x,320-y, 205+x,205-y); g.drawLine(205+x,205-y, 110+x,135-y); } Now I want to change its size evenly. (I can

How can I change the size of a figure made in Java Graphics2D with a slider?

痴心易碎 提交于 2020-01-10 06:15:26
问题 I'm trying to make a program with java using Graphics 2D that paints polygons between 3 and 8 sides and that I can resized with a slider but I do not know how to do for change it size with the slider evenly. Here is a example of my pentagon drawn if (sides == 5){ g.drawLine(110+x,135-y, 10+x,205-y); g.drawLine(10+x,205-y, 48+x, 320-y); g.drawLine(48+x,320-y, 170+x,320-y); g.drawLine(170+x,320-y, 205+x,205-y); g.drawLine(205+x,205-y, 110+x,135-y); } Now I want to change its size evenly. (I can

Center of gravity of a polygon

心已入冬 提交于 2020-01-09 04:22:29
问题 I am trying to write a PHP function that will calculate the center of gravity of a polygon. I've looked at the other similar questions but I can't seem to find a solution to this. My problem is that I need to be able to calculate the center of gravity for both regular and irregular polygons and even self intersecting polygons. Is that possible? I've also read that: http://paulbourke.net/geometry/polyarea/ But this is restricted to non self intersecting polygons. How can I do this? Can you