This file contains 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
module Main where | |
import Vector | |
import Data.List ( intercalate | |
, sortBy | |
) | |
import Data.Ord | |
data Shape = Sphere {position :: Vector3, radius :: Scalar, color :: Vector3} | |
| ShapeList [Shape] |
This file contains 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
import java.util.ArrayList; | |
import java.util.List; | |
class Node { | |
private List<Node> adj; | |
private Color color; | |
private Node paren; | |
private int d; | |
private int f; |
This file contains 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
var rec = new HitRecord(); | |
if (world.Hit(ray, 0.001f, float.MaxValue, ref rec)) { | |
var scattered = new Ray(); | |
var attenuation = new Vector3(); | |
if (depth < 50 && rec.M.Scatter(ray, rec, ref attenuation, ref scattered)) { | |
return attenuation * Color(scattered, world, depth + 1); | |
} | |
return new Vector3(0); | |
} | |
var unitDirection = Vector3.Normalize(ray.Direction); |
This file contains 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
float shiftIndicator = telemetry.Indicator.Value; | |
shiftIndicator = shiftIndicator.Remap(0, 1, 0, IndicatorHalfWidth); | |
byte indicator = 0; | |
for (var i = 0; i < IndicatorHalfWidth * 2; i++) { | |
indicator = (byte)(indicator << 1); | |
if ((i < shiftIndicator.RoundToInt()) || (i >= IndicatorHalfWidth * 2 - shiftIndicator.RoundToInt())) { | |
indicator |= 1; | |
} | |
} |
This file contains 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
namespace MCVE { | |
using System; | |
using System.Reflection; | |
using JsonNet.PrivateSettersContractResolvers; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Serialization; | |
internal struct RootObject { |
This file contains 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
Vector3 PointOnLine(float distance, IList<Vector3> list) { | |
var D = new float[list.Count]; | |
int i = 0; | |
D [i++] = 0; | |
for (; i < list.Count; i++) { | |
D [i] = D [i - 1] + Vector3.Distance (list [i - 1], list [i]); | |
} | |
var min = 0; | |
var max = D.Length - 1; |
This file contains 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
using System; | |
namespace Engine | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Transform trans = new Transform(new Vector3(1, 2, 3), new Vector3(2, 3, 4), new Vector3(3, 4, 5)); | |
} |