# Questions tagged [coordinate-system]

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.

185 questions
Filter by
Sorted by
Tagged with
4k 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: ...
5k views

### Convert geodetic coordinates to geocentric (cartesian)

I'd like to retain as much float precision as possible without having to resort to specialized libraries so I need this code to work with only standard modules. I'm doing this in QGIS where ...
401 views

### Find the area of the bounding box of a robot's moves on a grid

Given a string of directions (example: "LLRUDDULRDRU") find the area of the rectangle defined by the lowest-left point ...
16k 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 ...
6k 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 ...
235 views

### Calculates best angle on path and approximates cardinal direction

This program uses the C language. What's used are two points, and the usage of the inverse tan function finds the angle of the line between the two points. Afterward, it finds the cardinal direction ...
426 views

### 3-axis coordinate system for a Chinese Checkers board

About a year ago, my brother and I came up with this cool idea for how to solve the problem of determining if any given "cell" on a Chinese Checkers board was adjacent to the cell in question. ...
508 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 ...
124 views

### An N-dimensional mathematical vector template class deriving from std::array (C++-17)

I've coded up a Vector class for use in my simulation support code, which I offer up for review. I decided to extend std::array. Now, I know that std::array is an aggregate type, but with C++-17 we ...
229 views

### Haversine Formula in Clojure

I implemented the Haversine formula to calculate the distance between two (latitude, longitude) coordinates. I was wondering if it looks natural to Clojure programmers. What could be improved? <...
1k 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 ...
149 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. ...
101 views

### Class hierarchy for objects in a 3D engine

I am writing my own 3D engine. I initially made the code quick and dirty but after a while the code became pretty messy and it have a lot of repeating code so I am currently cleaning up some of the ...
203 views

### NamedPoint class using unique_ptr for members

After reading this old article from 2001 I have tried to implement the class from it using unique_pointer. An author's claim is that C++ is not appropriate for ...
108 views

### Passing uint64_t from C++ to R: Hilbert Mapping - xy2d function

I have been working with Rcpp to perform a forward and backward Hilbert Mapping. Below is an implementation based on this code. My application is in genomics and I may be dealing with enormous ...
291 views

### C++ Calculate euclidean distance between tuples, for specified indices

I wrote a small utility function that will take two tuples and returns the Euclidean distance for the given indices only: ...
461 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. ...
3k 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 ...
81 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: ...
199 views

### Determining directions for a 2D boad

My original code is: ...
909 views

### Extracting an adjaceny matrix containing haversine distance from points on map

I am extracting 10 lat/long points from Google Maps and placing these into a text file. The program should be able to read in the text file, calculate the haversine distance between each point, and ...
548 views

### C++ mathematical n-dimensional vector template using fold expressions

I'm writing a template to unify a few mathematical vector types I was using. The goal is low overhead, constexpr where possible and generic utility functions built-...
2k 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 ...
86 views

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 ...
74 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. ...
7k views

### Get Rectangle Count from Given List of Co-ordinates

Problem Description Write a program to find the maximum number of rectangles that can be formed both horizontal and vertical with the help of a given n number of coordinate(x,y) points. [x,y ...
39 views

### Mutable 2d Rect class

So I wrote a 2d rectangle class for use in a 2d pygame based game engine. It uses the vector class from this question, so if you want to test, you need that code too. I want to ask: Does this ...
348 views

### Calculating the surrounding objects in a two-dimensional coordinate system leaving out the corners

We have a dynamically created map with two dimensional coordinates. There's an object in this map on a random position and I need to validate the four adjacent fields. However, I need to leave out the ...
394 views

### Parser for STL stereolithography data files [closed]

I'm parsing STL files to load the coordinates. My code is: ...
5k views

### Bresenham's line algorithm implementation

May there be any performance and/or code standard improvements on the following LineOfSight code? ...
102 views

### Find 4 points which form a square with the biggest area

I have set of points on the coordinate plane. I need to find the 4 points which form a square with the biggest area. I'm new in JavaScript so I'd like to get any suggestions about code style, ...
61 views

### Achieving a rotated Vector magnitude

I am trying to convert this velocity into another 2 dimensional vector at some specified angle: ...
84 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 ...
120 views

### Splitting the coordinates of the world into equal blocks

It's a function to split the coordinates to some small blocks. For example, some country has a coordinates of north-east and south-west, two diagonals. If I set the interval to 0.05, it will returns ...
11k views

### Find an intersection point of 2 line segments

I want to find an intersection point of two line segments, if one exists. Each line segment is represented by two endpoints. Each endpoint is represented as an ordered pair of numbers. There are no ...
524 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 ...
82 views

### Convertible templated math vector

I've made a templated math vector struct with a templated type and templated dimension count. I want my vectors to be convertible so I can easily make, for example, a ...
7k views

### 2D Vector class

As part of a game engine I am creating, I am in the process of writing a bunch of math classes (vector2/3/4, matrix2/3/4, and quaternions to start with). Vec2 ...
323 views

### Plotting discontinous function

I've made a simple web plot with D3 JS version 4. I've drawn a discontinuous function: $$f(x)=\frac{1}{x(x-2)}$$ which has 2 vertical asymptotes and 1 horizontal asymptote. I add a legend with LateX:...
115 views

### Vectorizing a polar coordinate conversion loop in a fingerprint-matching process

I am working on a fingerprint matching technique and it takes a lot of computation time to obtain the result. I am trying to implement the matching process given in A Minutia Matching Algorithm in ...
115 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 ...
90 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): ...
157 views

### Idiomatic quadtree implementation in Rust

I am learning Rust, coming from a Java background, and I was hoping to get some critique on my simple QuadTree implementation in Rust. This is as a learning exercise for me. Are there tips on how to ...
45 views

### Error handling for an Erlang 2D point class

I am working on a math library for an online game. I want to prevent as many errors as possible and I want to catch all errors as early as possible to simplify debugging in the long run. However, I ...
411 views

### 2016 Advent of Code Day 1, Part 1 and Part 2

I've been reading the Rust versions of this, and just because I'm kinda tired, I thought I'd just throw together something in C. Here's my 15 minute effort to solve the 2016 Advent of Code Day 1, ...
3k views

### QuadTree C++ Implementation

I recently created a QuadTree implementation in C++. It varies slightly from most implementations. Instead of storing elements it only organizes elements. This allows programmers to insert elements ...
90 views

### Wavefront 3D Obj parser/viewer

For learning Rust I decided to make a 3D .obj viewer. I wrote a simplified OBJ parser without materials that only supports triangles. Considering I'm completely new to Rust and don't really know ...
78 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 ...