13,275 questions
2
votes
3
answers
127
views
Rotating NumPy indices to produce a rotated image works only in two of four segments
I'm working on a Python program that calculates images by some function frame by frame to create a video.
Sometimes images need to be rotated (without cropping them). First, I rotated images as ...
Tooling
1
vote
2
replies
135
views
How to calculate the area of irregular shapes programmatically?
I’m working on calculating the area of irregular shapes (such as polygons with uneven or non-parallel sides) in code.
I understand how to calculate areas for regular shapes, but I’m unsure what the ...
Advice
1
vote
9
replies
75
views
How to model shared geometric objects (points, rays, lines) without duplication in Python?
I'm working on a small Python prototype to model basic Euclidean geometry objects (lines, rays, points). I've intentionally stripped it down to a minimal example to highlight a design issue I'm ...
Tooling
0
votes
4
replies
58
views
Is there a way to calculate sky view factor/PCV on a mesh3D object in R?
I am trying to find a way to calculate sky view factor/PCV in R.
I have a large series of .ply meshes (1000+) loaded as mesh3d objects into R. I want to calculate the sky view factor/PCV value for ...
Advice
2
votes
2
replies
77
views
How to shift two intersecting polygons
I'm working on a game with procedural generation for generating dungeons.
In a dungeon I have rooms and to put it simply, rooms are basically randomly generated polygons.
After the first room is ...
0
votes
1
answer
159
views
How to calculate the points on the "perimeter" on a bitmask?
I am making a drawing application and i have to show the borders of the pencil. To know where to place the pixels I use a list of integer offsets from the cursor that make up a shape, so the cursor is ...
1
vote
1
answer
187
views
How flash 8 brush worked?
I'll be questioning about a drawing program - flash 8 and how its brush worked.
The question is about math, bezier curves, vectors, algoritms, geometry.
i'm trying to recreate how Flash 8's brush tool ...
Best practices
1
vote
14
replies
6k
views
How to Cover an N × N Square Room with the least Square Tiles? (could be reused)
The problem is:
Cover an N × N square room with square tiles (the tiles do not all need to be the same size) without overlapping, where the side length of each tile is integral and less than N.
What ...
4
votes
1
answer
81
views
Is there a bug in the commutator of vector fields in scmutils?
I'm reading "Functional Differential Geometry" by Sussman and Wisdom. The book uses mit-scheme and the scmutils library to teach differential geometry. On page 48 equations (4.29), (4.30) ...
4
votes
1
answer
142
views
Area of a 2D projection from a 3D mesh object
I want to compute the 2D area of a 3D mesh surface that results after one of the three dimensions has been discarded. Basically, I want the area of the "shadow" (without any changes in ...
Advice
1
vote
2
replies
44
views
For a given list of normal vectors, I need a triangulation of the unit sphere such that its triangles' normals are the input normals
Is it even guaranteed that such a triangulation even exists for all expected list of normals? (It's easy to think of edge cases where it doesn't, in my case the normals will be composed of a long list ...
Advice
3
votes
5
replies
177
views
Computing line intersection points on trapezoid-type grid
I need to compute ~2 million coordinates (64-bit float tuples)
They're the intersection points of lines that form a trapezoid-shaped grid (see visual below)
The shape of the trapezoid is different ...
Advice
1
vote
3
replies
70
views
Finding a point on a line, a given length from one end
I need to find the x and y axis points of an arbitrary line, knowing the start point, the end point, and the length of the line from the start point.
To do this I have been using the equation of a ...
Advice
0
votes
5
replies
205
views
Drawing geometric diagrams in R, ggplot
To illustrate the ideas behind discriminant analysis, I created the image below containing a scatterplot with two groups and a plot of the densities of the scores, LD1 on the discriminant function.
...
2
votes
1
answer
196
views
Is there a way to Quad Mesh a 2D Polygon in Python?
Is it possible to quad mesh a 2D polygon in Python? I only manage to tri mesh using compas_CGAL / triangle.triangulate but I am unable to find a quad mesh solution in Python. Thanks in advance. I have ...
-3
votes
1
answer
116
views
How to compute an optimal enclosing segment of a circle from a 2D point set?
I am looking for some advice on how to fit a circular segment to a set of 2D points. My dataset looks like this: 2d data to fit segment to
For clarity, my definition of an "optimal" segment ...
Advice
0
votes
6
replies
138
views
Polygon centroid calculation - centroid outside the polygon
I have 2 polygons which are very simmular but one has is centroid inside and the other outside.
Polygon 1 (inside) with
"X: 2590431 Y: 5823888"
"X: 2590433 Y: 5823881"
"X: ...
2
votes
1
answer
144
views
Calculating a light volume that comes in through a window
I have a room that is a box. There is a single rectangular window on one of the walls of the room. A directional light source is shining into the room through the window. The light source has a ...
1
vote
0
answers
94
views
GeoGebra Classic 5 — Can I save and run a batch of Input Bar commands from a plain text file?
I remember (from around 10 years ago) that in GeoGebra I could save the commands I would normally type into the Input Bar into a textual file, and then open/load/run them all at once, without having ...
1
vote
1
answer
164
views
Turn a convexhull defined by a list of 3D point coordinates into a 0-1 binary mask
I have a convexHull given by a list of 3d point coordinate generated by scipy.spatial.ConvexHull. Now the question is, I want to turn this convexhull defined by the list of vertices into a 0-1 binary ...
0
votes
1
answer
92
views
Issue when rotating around multiple axes
I am trying to replicate how the Hadamard gate works. I have a system consisting of a sphere with a cylinder attached, and I would like to rotate the whole system by 90 degrees around X and then by ...
3
votes
0
answers
87
views
Efficient function to check if there is a convex k-gon in given n points in 2D?
Suppose I am given n points in the plane, (x_1, y_1), ... , (x_n, y_n). I want to check if there is a subset of k points from these n that make a convex k-gon.
For instance, say I am given 25 points ...
1
vote
1
answer
73
views
How to partially reconstruct a mesh from another mesh surface while preserving the initial topology
I'm trying to reconstruct a part of a triangulated mesh from a surface I'm acquiring from a higher precision method. The initial mesh is triangulated and watertight, the patch surface is also a ...
0
votes
1
answer
195
views
Simplified outer convex hull of a set of points using JTS
I'd like to use JTS to calculate a simplified (fewer points) convex hull from a collection of points including inner and perimeter points, where the hull is allowed to be a bit larger in area in order ...
0
votes
0
answers
186
views
Gmsh: “Wrong topology of boundary mesh for parametrization” or endless “Partitioning face…” warnings when creating geometry from STL
I’m trying to turn a 3D STL surface (exported from ImageJ/Fiji segmentation) into a volume mesh in Gmsh using the typical workflow given by the official tutorial (t13). I’m running this with the Gmsh ...
-1
votes
1
answer
103
views
How to compute the same surface area as regionprops3 without using regionprops3?
I need to compute the sphericity of a 3D object (binary mask) in MATLAB, especially for non-isotropic voxel spacing. To do this, I need an accurate surface area measurement.
I compared two methods (...
0
votes
1
answer
106
views
Detect if circle crossing arc, Lua
How can I detect whether a circle intersects or crosses a given arc segment?
The arc is defined by a center, radius, start angle (angle1), and end angle (angle2).
How to detect that arc AB has ...
-1
votes
1
answer
205
views
3D projection without matrices breaks on negative distance
I am drawing edges of triangles and quads with rotation and changing camera position, without projection matrices but multiplication and division, however I can not figure out what happens to the ...
4
votes
1
answer
215
views
Calculate rotation of a point around another point on earth (or sphere)
Essentially what I'm trying to do is moving a point relative to two different scales.
The reason is to edit values in a database of a 3d party application.
So basically I want to relocate the red ...
1
vote
1
answer
62
views
Is there a problem with calculating triangle area using two vectors instead of three points?
I looked up calculating the area of triangle given three vertices.
func calculate_area_of_triangle(a: Vector2, b: Vector2, c: Vector2) -> float:
return abs((a.x * (b.y - c.y) + b.x * (c.y - a.y)...
0
votes
1
answer
192
views
Finding a centerline of a contour?
I want to draw the centerline of a contour I made for the cable in the middle of the video I linked at the bottom. I also want to document the points of the centerline drawn in an array. How do I do ...
-3
votes
2
answers
324
views
How to best approximate a superelliptical arc with a Bezier curve?
What software algorithm can be used to approximate an arbitrary superellipse into a bezier path, consisting of multiple Bezier curves, just like an ellipse can?
As an example, https://superellipse....
0
votes
0
answers
70
views
NetTopologySuite issue
Has anyone encountered this error when working with NetTopologySuite:
System.InvalidCastException: Reading as 'NetTopologySuite.Geometries.Geometry' is not supported for fields having DataTypeName '...
9
votes
1
answer
158
views
Search for closest-distance multi-point array in array of multi-point arrays
Given an arbitrary-length array of same-length arrays containing 3D points in space (i.e., multi-segment lines) within the same min/max bounds, I'm looking for fast ways to find the nearest multi-...
0
votes
0
answers
151
views
Getting ORA-00942 error when running Insert Into
I am trying to insert data from a couple different tables in 2 different databases using database links. If I run the select query on it's own, it runs without error and returns the expected results. ...
0
votes
2
answers
168
views
OpenSCAD objects rotating around a circle
I have this code, which is supposed to make multiple fans which rotate around this circle, however I am unsure what went wrong. Pretty sure it's my bad math, haha.
This is what comes out of it:
I've ...
1
vote
1
answer
63
views
Inferring the drawing direction of a rotation+reflection matrix applied to a canvas
I am trying to extract the drawing direction of a DOMMatrix with reflection and rotation applied (using rotate, scale). What I want to know is whether it will draw upwards vs. downwards or leftwards ...
3
votes
1
answer
234
views
Average distance of any point of a disk to its boundary
I was wondering what was the average distance "d" of any point in a ball to its boundary (not specifically the closest point). I made a simple monte carlo computation using Muller's method ...
2
votes
1
answer
106
views
Calling a function that returns a vector by value in place and iterating over elements causes first value to be garbage
I have been trying to integrate boost geometry into a project but run into an issue when I return a polygon geometry from my custom class. The following is a minimal example that reproduces what I am ...
8
votes
1
answer
215
views
How to validate rectangle positions in a repeated 4-role layout with axis-based spatial constraints?
I'm working with a list of rectangles and need to validate whether each one is in the correct position based on a fixed pattern and a set of geometric constraints.
In the input list there can be any ...
-1
votes
1
answer
63
views
I want to reduce cost related to a specific geospatial filtering
This is the following query :
SELECT
id,
x,
date_range_start
FROM table_a
WHERE ST_DWITHIN(point, shape_polygon, 30)
After running some tests, i can confidently say that WHERE ST_DWITHIN(...
0
votes
2
answers
259
views
Swept AABB collision between circle and rectangle
I'm fairly new to javascript, and I've been trying to build a small game to learn new concepts. An issue I'm encountering is that projectiles in the game often have a higher velocity than the width of ...
8
votes
2
answers
346
views
How can I find the largest axis-aligned rectangle of a given aspect ratio that can fit inside a rotated rectangle?
Given a rotated rectangle, how can I find the largest axis-aligned rectangle of a given aspect ratio that can fit within the original rectangle? For example, I'd want to find the largest rectangle of ...
1
vote
0
answers
41
views
move a geometry line next to another by a distance with postgis?
I would like to move a geometry line next to another by a distance using PostGIS. The ST_OffsetCurve function allows you to move the geometry, but sometimes the movement is done in the opposite ...
0
votes
1
answer
168
views
How to create an apache iceberg table with geometry column?
from pyspark.sql import SparkSession
from sedona.spark import SedonaContext
from pyspark.sql.functions import expr
spark = (
SparkSession.builder
.appName("SedonaIcebergApp")
...
2
votes
1
answer
145
views
How to display a legend when plotting a GeoDataFrame
I have a GeoDataFrame I want to plot. This works fine, however somehow I cannot easily plot its legend. I have tried a number of alternatives and checked solutions from googling and LLM, but I do not ...
18
votes
3
answers
238
views
Trilateration where we have heading instead of distance to the known points
I'm trying to do a form of trilateration, where the distances between the point of interest (POI) and the anchor points are not given, but instead the heading observed from the POI to each of the ...
0
votes
0
answers
57
views
How do determine inner border points of polygon intersection
I am trying to write a Python script that will return me all vertice locations (x,y) of inner intersecting edge between a square tile and a closed polygon with n-vertices. I got this far with my code, ...
3
votes
2
answers
233
views
How can I calculate the number of local maxima in a 3D matrix in R?
I am currently working on a number of animal teeth stored as surface meshes in R. Some of the variables I am looking at may be influenced by the number of cusps on the tooth and I would like to try ...
0
votes
1
answer
148
views
Correctly Identifying Neighbors in Turf.js Hexagonal Grid
I'm developing a spatial analysis tool using a hexagonal grid generated using Turf.js (hexGrid). Although the grid itself is generated correctly, I cannot reliably identify neighbors for a selected ...