This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MIT License | |
// Copyright (c) 2024 Nathan V. Morrical | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <iostream> | |
#include <cuda_runtime.h> | |
#include <math.h> | |
#include <cstdio> | |
#include <cstdlib> | |
#ifndef __CUDACC__ | |
using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// angle relative to the x axis. | |
inline float pseudoangle(float2 p1, float2 p2) { | |
float dx, dy, t; | |
dx = p2.x - p1.x; | |
dy = p2.y - p1.y; | |
if ((dx == 0.0) && (dy == 0.0)) { | |
return -1; // indicating error | |
} | |
else { | |
t = dy / (fabs(dx) + fabs(dy)); |