Skip to content

Instantly share code, notes, and snippets.

@pranavkantgaur
pranavkantgaur / testFacetGeometry.cpp
Created January 4, 2016 08:58
Testing are_facets_same_geometry function
#include <CGAL/Linear_cell_complex.h>
using namespace std;
using namespace CGAL;
typedef Exact_predicates_inexact_constructions_kernel K;
typedef Linear_cell_complex_traits<3, K> Traits;
typedef Linear_cell_complex<3, 3, Traits> LCC;
typedef Point_3<K> Point;
@pranavkantgaur
pranavkantgaur / lccWithFacetAttributes.cpp
Last active January 12, 2016 11:15
Creates LCC having LCC::Dart_handle type attributes associated with 2-cells.
#include <CGAL/Linear_cell_complex.h>
#include <CGAL/Linear_cell_complex_constructors.h>
using namespace std;
using namespace CGAL;
typedef Exact_predicates_inexact_constructions_kernel K;
typedef Linear_cell_complex_traits<3, K> Traits;
typedef Linear_cell_complex<3, 3, Traits> LCC;
@pranavkantgaur
pranavkantgaur / tetgen.h
Created April 3, 2016 13:52
Tetgen header file
///////////////////////////////////////////////////////////////////////////////
// //
// TetGen //
// //
// A Quality Tetrahedral Mesh Generator and A 3D Delaunay Triangulator //
// //
// Version 1.5 //
// May 31, 2014 //
// //
// Copyright (C) 2002--2014 //
@pranavkantgaur
pranavkantgaur / tetgen.cxx
Created April 3, 2016 13:53
Tetgen source file
This file has been truncated, but you can view the full file.
///////////////////////////////////////////////////////////////////////////////
// //
// TetGen //
// //
// A Quality Tetrahedral Mesh Generator and A 3D Delaunay Triangulator //
// //
// Version 1.5 //
// May 31, 2014 //
// //
// Copyright (C) 2002--2014 //
@pranavkantgaur
pranavkantgaur / predicates.c
Created April 3, 2016 13:54
Schewchuck robust predicates
/*****************************************************************************/
/* */
/* Routines for Arbitrary Precision Floating-point Arithmetic */
/* and Fast Robust Geometric Predicates */
/* (predicates.c) */
/* */
/* May 18, 1996 */
/* */
/* Placed in the public domain by */
/* Jonathan Richard Shewchuk */
@pranavkantgaur
pranavkantgaur / tetgenMeshSurface.cpp
Created December 26, 2016 10:34
Tetgen algorithm for surface meshing input PLC
void tetgenmesh::meshsurface()
{
arraypool *ptlist, *conlist;
point *idx2verlist;
point tstart, tend, *pnewpt, *cons;
tetgenio::facet *f;
tetgenio::polygon *p;
int end1, end2;
int shmark, i, j;
@pranavkantgaur
pranavkantgaur / nvcontrol-warp-blend-with-file-configuration-import-ximage.c
Last active February 27, 2019 11:44
nvcontrol-warp-blend.c with customizations
/*
* Copyright (c) 2013 NVIDIA Corporation
*
* 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:
*
@pranavkantgaur
pranavkantgaur / random_cart_pole_agent.py
Last active December 21, 2018 04:13
Random agent for Cart Pole environment
import os
import logging
import tempfile
import numpy as np
import gym
#from gym.wrappers.monitoring import Monitor
class RandomAgent(object):
def __init__ (self, action_space):
@pranavkantgaur
pranavkantgaur / discounted_future_return.py
Created December 21, 2018 04:15
Calculating discounted future return for agent
''' Gets list of furture rewards, associates discount factor with future rewards '''
def discounted_future_return(rewards, gamma=0.98):
discounted_returns = [0 for _ in rewards]
discounted_returns[-1] = rewards[-1]
for t in range(len(rewards) - 2. -1, -1):
discounted_returns[t] = rewards[t] + gamma * discounted_returns[t+1]
return discounted_returns
@pranavkantgaur
pranavkantgaur / epsilon_greedy_rl_agent.py
Created December 21, 2018 04:16
RL agent employing epsilon greedy action strategy
# coding: utf-8
import os
import logging
import tempfile
import numpy as np
import gym
#from gym.wrappers.monitoring import Monitor
class myEphsilonGreedyAgent(object):