Draw bezier curves in mapbox-gl-js - mapbox

I am looking for a way to draw bezier curves in my mapbox gl js app.
Just like this very interesting example : https://demos.mapbox.com/bezier-drawing-tool/
Unfortunately i don't find any documentation about this demo and its exactly what i am searching for.
In this demo, when you select the pen tool you can start a bezier curve by dragging the mouse. In edit mode, Bezier handles shows up and allow the user to modify the bezier spline.
The mapbox gl draw https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/API.md
is a very promising API but there is currently no support for bezier curve. i also looked in the available custom modes but found nothing.
As a fallback, i think i could develop a custom mode with mapbox gl draw to support bezier curves by subdividing the line in multiple segment. But before going that way i would like to know if there is already an existing support for drawing bezier curves ?
Thank you

Related

Add dome-like sphere with Mapbox GL

How can I add a 3 dimensional sphere to Mapbox GL using the Javascript API? I've read about the fill-extrusion property but I'm unsure how I would use it for a sphere. I'm trying to create a semi-transparent dome around a latitude/longitude coordinate based on a distance radius.
There's no way to do anything like that at present. The only 3D features are fill-extrusions, which have flat tops. Maybe you could create an image that looked like a 3D dome, and overlay that.

curved road detection in satellite images matlab

My project is to extract the skeleton of the road in an image using matlab. How to remove the green color shades of trees in the image. I tried hough transform for detecting lines. What could be a better method to detect curved roads in image. I am a beginner in matlab. Kindly help me asap..!
http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/resources.html
These people have provided code for contour detection and it is widely used in the computer vision community. You can use it for detecting curved lines also

Shape recognition (recognizes hand drawn basic shapes - rectangles, ellipses, triangles etc.)?

I want to detect hand drawn basic shapes - rectangles, ellipses, triangles etc.
Does anybody have an idea how to implement this?
Maybe you can try the OpenCV library. Actually this library has the focus of computer vision, i.e. analyzing pixeldata of images and video and might be too heavy for your task. But on the other hand it is very powerfull and available on many plattforms (even on iOS). And a hand drawn image with shapes is also just a set of pixels, isn't it ;-)
You might have a look at the manual:
http://www.sciweavers.org/books/opencv-open-source-computer-vision-reference-manual
There is plenty of information about OpenCV here on stackoverflow as well. Some hints on stackoverflow are here:
DETECT the Edge of a Document in iPhoneSDK
and here
iPhone and OpenCV

What is the best way to draw a glossy circle in iPhone OpenGL or Coregraphics?

I want to draw a circle on the iPhone screen with Shadow and glossy effect.I am new to coreGraphics and OpenGL and dont really know the difference between the two.And which library is to be used when.
How can I draw following image in iPhone? any reference point to learn the appropriate library would be great.
have 3 of those images [1] [2] [3]
and a slider to control the glow.when you slide to change the glow it should go across all these, and furthermore some levels could have upto 50 circles.
OpenGL is not a library, it's an API that gives you a "no-frills" access to the graphics system. All it provides are graphics primitives (points, lines, triangles) that it places on the screen and rasterizes them applying colour, textures through mathematical formula and/or a program called shader.
Sure, what you want to draw can be drawn using OpenGL, but it will require several intermediate steps and an artistic understanding of how that image is created from drawing operations.
So to answer your question: The most simple approach is to store this kind of, well whatever it is, as a vector graphics (SVG), and draw it using a library that provides drawing from a file.
The choice between CoreGraphics and OpenGL should be based on what your application does primiarily: Is it rendering some 3D graphics, a custom written 3D engine maybe: Use OpenGL. If you're aiming to draw some kind of UI then CoreGraphics probably is the better choice.

CGPath curve from points (iPhone)

I'm looking for a way to draw a curve (perhaps a parametric function?) into a CGContext
The best example which I can think of is the Adobe Ideas iPad application. As the user drags their finger, the application draws lines for every touchesMoved: using CGContextAddLineToPoint. After the user picks up their finger at touchesEnded:, the application does some math and replaces all of the lines with a single, smoothed curve.
What I have is a list of CGPoints, and I am looking to draw a smooth curve which follows those CGPoints into the CGContext.
Any assistance?
I'd advise creating a CGPathRef and use the CGPathAddQuadCurveToPoint method.
Hope this helps!