Skip to main content
17 votes

Heavily limited premature compiler translates text into excecutable python code

I see a number of things that may help you improve your program. Since the existing review covered a lot of good points, this review will cover the parts not already mentioned. Use the correct form ...
Edward's user avatar
  • 66.5k
15 votes
Accepted

Heavily limited premature compiler translates text into excecutable python code

Allocations can fail Don't use buffer until we know it's not null. (And no need to multiply by sizeof (char), since that's ...
Toby Speight's user avatar
  • 77.1k
13 votes
Accepted

C# vector library

You are inconsistent with your use of the this. 'suffix'. Nobody can agree on this, but you should try to be consistent without projects. I would remove the return ...
VisualMelon's user avatar
  • 7,431
11 votes
Accepted

C++ math vector template

A few issues: Functions defined in the class in the header are inline by default, so there's no need to use the keyword everywhere. Use ...
user673679's user avatar
  • 11.8k
11 votes
Accepted

Algorithm that spans orthogonal vectors: Python

You should probably be using Numpy, although I don't know enough about your situation to comment any further. Assuming that you need to retain "pure Python", the following improvements can be made: ...
Reinderien's user avatar
  • 62.5k
10 votes
Accepted

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

This code is extremely hard to read and much longer than it needs to be. Use documented naming conventions for C#. Make small methods that do one thing well. ...
Eric Lippert's user avatar
  • 14.9k
10 votes

Algorithm that spans orthogonal vectors: Python

This is only a minor observation on top of what @Reinderien already wrote about your code. Writing function documentation like you did with ...
AlexV's user avatar
  • 7,260
9 votes
Accepted

Classes representing 2D points and pixels

A fine example how modern C# can make your life so much easier! But first things first: Errors and maybe errors Your GetHashCode() is realy weak! Just take two example points (1|1) and (0|32) and ...
Matthias's user avatar
  • 106
8 votes

Convert geodetic coordinates to geocentric (cartesian)

I can't explain the discrepancy with the online conversion tool without seeing the source code for the latter. 1. Review The comment for the ellipsoid parameters should give the units for the semi-...
Gareth Rees's user avatar
  • 49.6k
8 votes

Heavily limited premature compiler translates text into excecutable python code

Another point that hasn't been fleshed out by other reviewers is the generated python code. list is a built-in function in python - by calling your list ...
Shadow's user avatar
  • 271
8 votes
Accepted

Parser for STL stereolithography data files

Well, it's not much of a mystery. Your code is simple and pretty. Their code is ugly because it performs exactly what it needs to do, and no more: ...
200_success's user avatar
7 votes
Accepted

Validating user-provided control points for a Bézier curve

There are things that can be improved: You could return the points instead of asigning the global variabel p You could split the function in two functions: ...
Jan Kuiken's user avatar
  • 1,473
7 votes
Accepted

Ordering 2D Border Points

You are making the test !Indexs.Contains(Index). Since Indexs is a List<int> you have ...
Olivier Jacot-Descombes's user avatar
6 votes

Simple Octree implementation

I'm looking only at the BoundingBox class. There are a lot of interesting cleanups you can apply to it: Ditch the constructors ...
glampert's user avatar
  • 17.1k
6 votes

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

Function signature It appears you're only reading from directions, so pass that as a pointer to const. while loop You ...
Toby Speight's user avatar
  • 77.1k
6 votes

Calculations to position a text box next to another object

This is a definite candidate for using rect / point structures, but I don't know what the rest of your code-base looks like, so just talking about the algorithm alone, one approach would be: ...
Errorsatz's user avatar
  • 1,354
6 votes

Parser for STL stereolithography data files

Note that we don't have a fully-compilable program, or the example data. But you do! So you can actually measure what's taking up the time using a profiler. However, I would guess that the following ...
user673679's user avatar
  • 11.8k
5 votes
Accepted

Transforming a list of two-dimensional coordinates into a flat list of relative changes

for i in xrange(1, len(coords)) is a red flag, since it is preferred in python to iterate directly over the elements rather than the indices. If you trully need the ...
301_Moved_Permanently's user avatar
5 votes
Accepted

3-axis coordinate system for a Chinese Checkers board

Only scratching the surface of struct Vector A struct should be immutable if possible. You have public setters ...
Heslacher's user avatar
  • 50.4k
5 votes

Templated Point class of any dimension

Overall, this seems to be a small but useful template. However, there are a few things that I think might be improved. Sorting requires more than swap While the ...
Edward's user avatar
  • 66.5k
5 votes

Haversine Formula in Clojure

Naming and interface Please avoid mixing English (calculate-distance) with Portuguese (raio). The code should be in English; ...
200_success's user avatar
5 votes
Accepted

Splitting the coordinates of the world into equal blocks

Here are three ways your code could be made more pythonic (which I consider to be more readable): Use python keyword expansion: Python allows the expansion of a dict object when calling a function. ...
Stephen Rauch's user avatar
5 votes

Shifting the origin of a large list of coordinates

The only thing I can see that will speed stuff up is this part: ...
Loki Astari's user avatar
  • 95.3k
5 votes

WGS84-coordinate encoded as Integers

you can avoid stuffing everything in a one-liner: ...
ratchet freak's user avatar
5 votes

Convert geodetic coordinates to geocentric (cartesian)

Precision in numeric calculus is usually handled by the decimal module. Compare: ...
301_Moved_Permanently's user avatar
5 votes

Gram-Schmidt process in Java for computing independent bases in linear spaces

The way the problem is decomposed doesn't feel right. In particular, there are too many interfaces, and Additive, Divisible, <...
vnp's user avatar
  • 56.5k
5 votes

Ordering 2D Border Points

DRY Principle As a small addendum on Olivier Jacot-Descombes' answer, I would like to add you should go for DRY code. answer snippet: "You have duplicated some cases. You have 12 instead of 8. ...
dfhwze's user avatar
  • 13.9k
5 votes

Algorithm that spans orthogonal vectors: Python

Besides what @Reinderein and @AlexV already mentioned, you could have added the following to your code to deliver a complete runnable example: at the top: ...
Jan Kuiken's user avatar
  • 1,473
5 votes

Algorithm that spans orthogonal vectors: Python

It would be more Pythonic to use zip() in your cross_product(v1, v2) dot_product(v1, v2) ...
AJNeufeld's user avatar
  • 33.7k
5 votes

C# vector library

Ok, I think I found something noteworthy not yet mentioned by VisualMelon. You are already using MathF to perform some operations for you, why not redirect some ...
dfhwze's user avatar
  • 13.9k

Only top scored, non community-wiki answers of a minimum length are eligible