-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I use brick/geo for a wood cutting project ? #31
Comments
Hi, You can very well use Line-based geometries are supported by all engines, including MySQL and GEOS, so no problem for area/distance calculations with polygons such as rectangles. Polygons can have « holes » in them, which perfectly fits your use case. For ellipses however, while the library itself has support for those ( Given that SQL Server uses a non-standard syntax, it is not currently supported by Possible alternative Another solution, compatible with MySQL & GEOS, would be to perform calculations using an approximation of every ellipse, as a Polygon with say, 100 points or more. This is the poor man's solution to the problem, but given a sufficient number of points, the precision can fall within your acceptable range. There is a built-in function, buffer(), that can return an approximation of a circle given a center $numPointsInPolygon = 100;
$centerX = 0.0;
$centerY = 0.0;
$radius = 1.0;
$polygonPoints = [];
for ($i = 0; $i < $numPointsInPolygon; ++$i) {
$angle = 2.0 * pi() * $i / $numPointsInPolygon;
$x = $centerX + $radius * cos($angle);
$y = $centerY + $radius * sin($angle);
$polygonPoints[] = Point::xy($x, $y);
}
// close the ring
$polygonPoints[] = $polygonPoints[0];
$circleApprox = Polygon::of(LineString::of(...$polygonPoints)); Wrapping up Given that PostGIS supports the whole set of geometries that can solve the problem at hand, I would probably design my app around this engine, which again, does not mean that you cannot use MySQL for storage. But you could possibly achieve the same result (within a given precision) using MySQL or GEOS directly. |
Thanks for the complete answer ! The circular string example is perfect for me to understand. I let you know after my test with PostGIS. |
Hello, I'm trying to represent an ellipse withPOSTGIS When I read
I make : where a, b, c, d are the "peaks" points anticlockwise $geometry = $reader->read("CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING( but the calculated area is wrong. It give 2.47 m2. It shoud be 2.82m2 What do I miss ? |
Hi, sorry for the (very) late answer. Did you find the solution to your problem?
|
Hello, No I've finally re-calculate manually the area for ellipse. It did not works as expected. There were a small difference in results. I'm checking the version. |
There are the versions : |
Hello,
This is my first project in Geometry. I'm used to develop and search for PHP libraries but WKT, WKB, Geometry Calculation is quiet new for me. I'm not sure yet how to construct a simple closed circle so be tolerant :)
Context
I need to construct an HTML/JS/PHP for e-commerce website. This application should construct a final shape for woods panels (for kitchen, desktops, etc...).
I start with a simple shape (rectangle or ellipse). Then I add many cuts : interns and externals.
Then I will transform all my shapes in jpeg layers to make a preview.
Technical Context
Nginx Server/ PHP 7.1+ / MySql / Geos extension installed
Technical Expectations
I need to store each shapes to be sure there is no intersection between them, calculate a minimal distance between shapes, get the area (bonus to calculate the final weight).
I find easily how to store polygons (for my rectangle) but I understand that 'circle' (or curve) are not standard shapes so many functions are not available (distance, intersection).
Issue :
Thanks,
The text was updated successfully, but these errors were encountered: