Skip to main content

All Questions

Filter by
Sorted by
Tagged with
2 votes
1 answer
99 views

Find intersection of rectangle with itself rotated

Given \$w, h, \alpha\$ for a rectangle centered at origin with width \$w\$, height \$h\$ and itself rotated by \$\alpha\$ around origin clockwise, I wrote a code to find the intersection area. ...
RE60K's user avatar
  • 1,476
2 votes
1 answer
349 views

Graham Scan Algorithm in Haskell

I have just begun learning functional programming and Haskell. This is my attempt to implement a solution to Graham Scan Algorithm in Haskell. Note that I am not even sure if this is indeed Graham ...
Bear Bile Farming is Torture's user avatar
4 votes
2 answers
118 views

Determine whether path A→B→C on a plane constitutes a left or right turn

I have recently started learning functional programming and Haskell. I have encountered this problem: Consider three two-dimensional points a, b, and c. If we look at the angle formed by the line ...
Bear Bile Farming is Torture's user avatar
12 votes
2 answers
742 views

Compute the perimeter of a polygon

This is taken from HackerRank, which I hope is okay. I've been playing around with Haskell and I haven't really been able to find anything that really goes beyond toy examples in terms of how to ...
Daniel McLaury's user avatar
5 votes
1 answer
2k views

Calculating a circle with bezier curves

I am new to Haskell, and have been reading Learn You a Haskell for Great Good!. I've rewritten a problem that I recently solved in JavaScript in Haskell to practice what I have been reading. A ...
Dave Thomas's user avatar
7 votes
1 answer
460 views

Graham scan implementation in Haskell

It looks like this is a really classical question, but I'd like to ask it one more time as all those solutions look quite long and complicated for me (maybe because I am dumb :) ) So this is a ...
daniil's user avatar
  • 163
4 votes
2 answers
298 views

Implementation of Graham Scan algorithm in Haskell

Here is an implementation of Graham Scan algorithm for computing the convex hull of a finite set of points: ...
qed's user avatar
  • 1,439
4 votes
1 answer
406 views

Ray→plane and ray→quad intersection

This checks the intersection between a Ray and a Plane and between a Ray and a ...
MaiaVictor's user avatar
  • 1,101
6 votes
1 answer
148 views

'Tis the season for gift-wrapping

When reviewing a Graham scan convex hull algorithm implementation, I wrote the following function in an answer: ...
200_success's user avatar
7 votes
1 answer
521 views

2D Convex hull exercise

I'm reading Real World Haskell, and this is my first try with the language. This is the result of the exercises of chapter 3: Consider three two-dimensional points a, b, and c. If we look at the ...
mookid's user avatar
  • 201
8 votes
2 answers
2k views

Graham Scan convex hull algorithm

I'm beginning to learn Haskell. I've implemented the Graham Scan algorithm for detection of convex hull following the Real World Haskell book. I'm looking for general advice regarding the style and ...
Michael Pankov's user avatar
10 votes
2 answers
396 views

Artifact collision in plane module

Here's something I tried putting together as I'm learning. Critiques on anything are welcome. There's also a logic bug in the Plane module I can't identify. The long and the short are that it takes ...
Jimmy Hoffa's user avatar
  • 1,565
41 votes
1 answer
2k views

Finding minimum scalar product using ST Monad

Inspired by a Stack Overflow question, I decided to practice my Haskell by taking a crack at the Google Code Jam's Minimum Scalar Product problem: Given two vectors \$\mathbf{v_1}=(x_1,x_2,\ldots,...
rampion's user avatar
  • 563