A coordinate system is a system which uses one or more numbers, or coordinates, to uniquely determine the position of a point or other geometric element. Do not use this tag for questions regarding longitude and latitude. Please use [geospatial] instead.
4
votes
1answer
69 views
Heavily templated mathematical vector class
I started to write a library for linear algebra for personal use, but also for revitilization of my C++.
Below is the first class of this library, a templated vector class, which is templated over ...
1
vote
0answers
29 views
Deleting all points in a quadrilateral
I have a sorted (by x value) ArrayList of points and four separate points that make up a quadrilateral. My code deletes all points in the ArrayList that are inside ...
0
votes
0answers
32 views
Get vertical acceleration from rotation vector and accelerometer values
My goal here is to calculate the acceleration towards the ground, which I call "vertical acceleration". This seems to be working OK for the most part, except when there is a lot of rotation going on ...
-3
votes
1answer
55 views
Restricting (x, y) coordinates to be within 0 to 4800
Is there a way to write this if tree more elegantly?
...
3
votes
2answers
53 views
Simple Octree implementation
I've implemented a rather straightforward octree, but I don't feel that good about the coding style or some of the implementation. In particular, I use some nasty ...
3
votes
3answers
71 views
Template 3d vector class
I've created this 3D vector class and would like it to be reviewed. I wonder if there are still some improvements that can be made. This is a header only implementation.
...
1
vote
1answer
114 views
Converting an SVG polygon path from relative to absolute coordinates
This question was moved from StackOverflow as suggested by some users.
I developed a function that aims to (should) provide a simple and effective method to transform a polygon ...
10
votes
0answers
93 views
Tracking the bounding box of a map
Context
I have a bunch of data points that look roughly like this:
...
10
votes
4answers
1k views
Find the closest unvisited visible home
I'm writing a 2d top down game where I perform a lot of "closest" searches between one point and all the rest of the points.
In this example, "me" wants to search for the closest visible house (Home) ...
2
votes
0answers
59 views
Calculating the distance between several spatial points
I am developing a CUDA program and I want to enhance my performance. I have a kernel function which is consuming more than 70% of execution time. The kernel calculates the distance between several ...
5
votes
2answers
107 views
Enums for the four directions
I have walls that I can spawn. They wll move in one of four directions, up, down, right or left. Now I can set, wether the wall is thin, wide, long or short, but the problem is:
Nearly everything I ...
12
votes
1answer
127 views
A* Go application
I've written a generic implementation of the A* algorithm as a first Go
program, since I had implemented that both in C and in Python before and Go
reminds me a bit of both. I'm looking for general ...
9
votes
2answers
100 views
A 3-D vector class built on top of numpy.array
I wanted a convenient class to easy access the parameters inside. I am using a lot of math in my game; that's why a wanted to access them through x, ...
6
votes
1answer
57 views
Normalizing forces for basketball game
Recently I found the need to implement a normalization formula in a couple of places in my basketball game, so I created some static methods inside of a class to do so.
...
5
votes
1answer
59 views
Haskell compositor
This is a concept for a compositor. It would help me if you could review how well I expressed my ideas into the functional language.
I first divide everything in an areas that each window covers ...
5
votes
2answers
91 views
Attempt at templates by creating a class for N-dimensional mathematical vectors
Originally I had tried to implement this topic after having learned about Inheritence and posted it on here, but that forced complexity and the main suggestion was that this was ideal for templates. ...
11
votes
1answer
141 views
Counting paths in an n-dimensional grid that stay within the boundaries
Problem Statement
You are situated in an N dimensional grid at position (x1, x2, …, xN).
The dimensions of the grid are (D1, D2, …, DN). In one step, you can
walk one step ahead or behind in ...
3
votes
0answers
41 views
After effects expression to prevent objects to lay on odd pixels when a Keyframe is applied
I made a scripted expression for after effects a while ago. This script is preventing objects to lay on odd pixels when a Keyframe is applied.
...
4
votes
1answer
86 views
Movement code for a game that should be able to handle almost infinite coordinates
Now I've grasped the very basics of Pygame, I thought it'd be useful to make a few classes that I could use later on if I try make a simple RPG style game. I've done this to handle the coordinates for ...
1
vote
0answers
124 views
Dice rolling swipe Android app
So I've got an Android app where if you swipe in a particular direction (UP, DOWN, RIGHT, LEFT), the dice move in that direction using TranslateAnimation. This is ...
8
votes
3answers
351 views
Check if one shape is in another shape
I have a code to check if one shape (circle or square) envelops another. I have used this code. It gives true if the this object envelops the passed shape. Can anyone suggest me an improvement or ...
11
votes
4answers
359 views
N closest points to the reference point
Here is working code to get N closest points to some reference point.
Please help to improve it, specifically by commenting on my use of std algorithms and ...
1
vote
1answer
34 views
Get radial distance between vector1 and vector2
A small script to calculate total units of distance between two vector entities. Especially useful in games and grid snaps, inventory snaps etc..
...
3
votes
1answer
47 views
Converting polar coordinates to Cartesian coordinates
I have a functional script that converts polar coordinates to Cartesian coordinates and then matches a value in a separate array to the coordinates. It works well, but I find that it takes a long time ...
4
votes
2answers
59 views
Achieving a rotated Vector magnitude
I am trying to convert this velocity into another 2 dimensional vector at some specified angle:
...
2
votes
3answers
102 views
Rotate and translate a 2D point N times
This is a C++ program that rotates a point initially located at origin by a given angle A (degree) counterclockwise and L translate its x-coordinate (sum L to it).
Here is my program:
Firstly it ...
3
votes
0answers
104 views
Finding Bounding Boxes
Given a set of overlapping boxes, and a set of points, I'd like to be able to determine which of the boxes contain each point. The number of points is much larger than the number of boxes, and I'd ...
2
votes
2answers
62 views
Library Class: Point - Follow up
This is a follow up of this post.
Changes:
I tried harder to make my code readable yet concise.
All Point instances are immutable and unique.
New, useful ...
4
votes
1answer
62 views
vector3 math module
I'm writing a little math module in C to handle vectors and matrices. This will be column-major style but right now I've only finished the basics of the vector functions and wanted some feedback on ...
1
vote
1answer
363 views
Converting an image from polar to cartesian coordinates
I have the following code which has too many loops inside it (almost 13 billion). This code is actually for image processing. I am first making a matrix of dimension 1024*360. This is the value of the ...
5
votes
2answers
157 views
Given a linked list of line segments, remove collinear points in the middle
This code removes any middle point find in line. It works only in x and y axis. This problem is a Java implementation of this.
...
6
votes
5answers
321 views
“Critter Tracking: When does it cross its own path?” Part 2
Basic Info: This question is my second attempt at this question. It is based on a question similar to this Codility question. The input (an int array), the outpout (an integer) and the method ...
5
votes
1answer
58 views
Gravity problem solver in Factor
After answering a question about Factor, I decided that it looked interesting. To get the hang of the syntax and such, I decided to write some basic physics code to "solve" the three-body problem. ...
5
votes
3answers
281 views
“Critter Tracking: When does it cross its own path?”
Added: Version #2 of this question
Minor Update/Additonal information: This question is based on a Codility question similar to this one. The input (an int array), the outpout (an integer) and the ...
4
votes
3answers
289 views
Determining which octant has a specific point
I am interested in octants in plane geometry, which basically involves dividing a plane into 8 equal parts according to a certain point.
Octants are particularly useful while implementing the ...
4
votes
1answer
328 views
Plotting a vector field in R + ggplot
I've written a small program that draws a vector field in R using ggplot for a given differential equation.
There is a topic on the subject here however, the proposed solutions either don't provide ...
4
votes
1answer
42 views
Ensuring data consistency in a PointsAlongCircle object
I'd like to write classes which are Pythonic, readable and easy-usable. A main issue for me is to keep data consistency. Here is an example (version 1):
...
8
votes
4answers
709 views
Checking if a point is on screen
I'm working on a tile-based game, and am looking to improve the efficiency of my code to slightly improve framerate. I call this method on every tile, every frame, so it is very performance critical. ...
2
votes
1answer
63 views
Print a square graph and dot based on co-ordinates
I've written a simple script, that takes a 0, 0 style co-ordinate input, following the pattern of:
$$0 \le n \le 9$$
Tacked onto ...
6
votes
4answers
141 views
6
votes
1answer
209 views
Finding the bounding box of a polygon array
I have a Polygon array, and I need to get a Rectangle object which bounds all of the polygons inside the array. Think convex ...
10
votes
3answers
146 views
Distance between two n-dimensional points (NASM)
I just finished writing a function that computes the distance between two n-dimensional points.
The original one was written in C and it's basically a translation of this formula:
...
2
votes
4answers
384 views
Rule Of Three for a Coordinate class [closed]
I just recently got back into C++ and did a quick and simple exercise in the Rule of Three. The code for the copy constructor, overloaded assignment operator, and destructor follows below for my class ...
6
votes
3answers
263 views
Enum Constants for Convert Units
I have a few constants in a game that I'm doing for hobby. I need to store constants for the total size of the a Physical World and the size of the Screen.
I can position the world's objects to the ...
5
votes
2answers
51 views
Calculating positions along the edges of a rectangle
I had the following three Tcl procedures, which calculate positions along three edges of a rectangle:
...
10
votes
1answer
330 views
Simulating a polygon
This code simulates a polygon (say a triangle) with a person at each vertex, every person is looking at the next adjacent vertex/person. They all start moving towards each other with a constant ...
3
votes
1answer
238 views
ASCII game Java applet
My code first creates a Point object. Then it creates a 25 x 25 array of ASCII in a string where _ marks a miss and the point's ...
3
votes
2answers
99 views
2D vertex of multiple countries
CodeChef - QPOINT
Given a 2D vertex of multiple countries, find which country contains a certain point.
Input format:
...
15
votes
3answers
9k views
Quadtree implementation
I've implemented a quadtree in C++. Ignore any apparent similarity to the pseudocode on Wikipedia, it's all in your head, I swear.
How can I improve it? Algorithm speed/space improvements, any extra ...
2
votes
1answer
21 views
1-D intersection of lines given begin and end points
I have a fairly basic question here: I want to find if two lines on a 1-D plane intersect. I know of two simple ways to solve this, but I wanted to know if Python has a more elegant way to solve this.
...