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.
3
votes
0answers
70 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 ...
0
votes
2answers
37 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
59 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
83 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
64 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
301 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 ...
4
votes
0answers
34 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
125 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 ...
3
votes
3answers
53 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
68 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
37 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
596 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
54 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
119 views
6
votes
1answer
77 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
122 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
340 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
213 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
41 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
271 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
115 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
81 views
2D vertex of multiple countries
CodeChef - QPOINT
Given a 2D vertex of multiple countries, find which country contains a certain point.
Input format:
...
12
votes
1answer
3k 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
20 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.
...
3
votes
1answer
48 views
Convert points into an octree
I set about doing it as a challenge (and it's still far from finished) but I hit lots of problems. The main one that caused most of them was it can't deal with even numbers (it can be ...
4
votes
0answers
67 views
Creating 2D vectors
I've made a little mechanism for creating 2-D vectors in Lua. Vectors have two components i and j, and support addition, dot ...
2
votes
1answer
185 views
Vector of vectors in contiguous memory
I have a class Vector3d with 3 double components and want to store several of them in a Field. For reasons of efficiency when ...
4
votes
0answers
89 views
Building Data abstraction and ADT for rectangle using “objects”
For the below given exercise:
Exercise 7: Abstracting Rectangles
Implement a representation for rectangles in a plane. (Hint: You may want to make use of your procedures from exercise 5). ...
6
votes
2answers
128 views
3-D Space Vector
I wrote the following implementation of a Vector in Java. I was wondering what you folks thought of it.
...
8
votes
2answers
103 views
Type-safe cartesian co-ordinates
I've recently been fiddling around with a type safe implementation of cartesian co-ordinates (and a few operations on those co-ordinates). Often it's easy to get units mixed up: is something in ...
6
votes
1answer
209 views
Particle class for physics simulation
This is a very lengthy class called Particle, it relies on two other headers, one of them is a simple struct which contains an x and y (...
0
votes
1answer
29 views
Moving between two angles in a set amount of time [closed]
I need to slowly change from one angle to another angle over a certain amount of time, using the shortest path between them. I have a function that accepts four parameters — the start and end angles ...
4
votes
1answer
51 views
Converting xy coordinates to theta without discontinutities
This one is, or rather, should be, fairly simple. I have a list of tuples of XY positions, and am trying to pull out angles relative to the origin from it. However, unlike ...
3
votes
2answers
47 views
2
votes
0answers
51 views
Calculating all combinations to make sure a Random algorithm has done them all
I have done this, but it's pretty ugly and it feels like I may be missing something to shorten it:
...
4
votes
1answer
91 views
Tested cartesian plane utility
I am starting to explore automated testing of code, so I decided to write some trivial code about the cartesian plane and test it. I am particularly interested in automated testing conventions and ...
1
vote
2answers
282 views
Defining std::vector::push_back(new Object)
Is this the best way to construct a vector of 2D points for return?
I don't entirely understand new and delete so I'm concerned ...
2
votes
0answers
64 views
Updating the coordinates of items possessed by a moving person
A Person has coordinates and an Item has coordinates as well, and hence both are derived from ...
7
votes
1answer
74 views
Unit test for Unique Position Point
Here is one of my msTest Unit Tests and possibly one of the worst "looking" tests.
...
1
vote
2answers
410 views
Generate random unit vectors around circle
I'm trying to generate a bunch of uniformly distributed unit vectors around the unit circle. Here's my code, which is working, but unfortunately I have a for-loop. How do I get rid of this for-loop?
...
3
votes
1answer
104 views
Iterate over coordinates and correct constraint violations
I am creating an algorithm to take a series of labelled points placed randomly and move them until they fulfil a set of constraints.
The constraints have been pre-computed and are each a lower and ...
3
votes
2answers
80 views
Multiclassing and updating each of its component classes whenever it changes
A Multiclass character can consist of any number of component classes. For example, if Fighter, ...
4
votes
1answer
250 views
Class representing both cartesian and spherical coordinates
I have had little experience with OO programming, being a typical engineer I tend to hack together functional code. However, I'm trying to change that and I see value in implementing OO when modelling ...
1
vote
3answers
95 views
Coding on Point interfaces/superclasses instead of implementations
From pretty much any book I've read it always said to code on interfaces/superclasses and rarely on implementations, today though that advice made a bit confused about how I should format my code.
...
0
votes
1answer
160 views
Class for finding the median of a two-dimensional space
I have a simple static class that it's purpose is given an RDD of Point to find the median of each dimension and return that as a new ...
0
votes
1answer
334 views
Nearest point using 2D tree, static variable for the closest point so far
This is a problem from a Coursera class:
Write a data type to represent a set of points in the unit square (all points have x- and y-coordinates between 0 and 1) using a 2D tree to support ...
2
votes
4answers
898 views
Octree code performance
I'm using a simple octree in my program and wanted to know if my implementation could be faster. It is part of this program.
Octree.H:
...
6
votes
1answer
418 views
Get all points on a uniform discrete grid inside a circle's radius
I have a 2-dimensional grid defined by a known point gridCenter and distance between points gridStep and need to find all points ...
1
vote
1answer
65 views
Reflection of an object in a 3D world
The following is a excerpt from a class that is supposed to represent a reflection of an object in a 3D world, like in a mirror.
After I started I discovered that mirroring is a property of an ...
4
votes
2answers
1k views
Getting the neighbors of a Point in a 2D grid
I am trying to find an algorithm to find all the defined neighbors of a 2D Point (efficiently would be nice, but does not make much of a difference).
Here is my ...