Skip to content

Instantly share code, notes, and snippets.

#include "Vector.h"
Vector::Vector(double px, double py, double pz) : x(px), y(py), z(pz) {
}
double Vector::Dot(Vector v) {
return (this->x * v.x) + (this->y * v.y) + (this->z * v.z);
}
double Vector::Length(){
#pragma once
#include <math.h>
class Vector
{
const double x, y, z;
public:
Vector(double x, double y, double z);
double Dot(Vector);
double Length();
namespace FSharpTracer
open System
type Vector =
{ X : float
Y : float
Z : float }
member v.Dot(v1 : Vector) = (v.X * v1.X) + (v.Y * v1.Y) + (v.Z * v1.Z)
member v.Length() = sqrt (v.Dot v)
@neildanson
neildanson / Effects.fx
Created August 31, 2013 20:11
Example fx file that compiles and runs fine on Windows, iOS & Android.
float fTimer;
float fPixellateFactor = 1.0f;
sampler ColorMapSampler : register(s0);
float4 NormalShader(float2 Tex:TEXCOORD0) : COLOR
{
float4 color = tex2D(ColorMapSampler, Tex);
return color;
}
@neildanson
neildanson / ray.cs
Created November 6, 2012 22:12
Declaring types
class Ray
{
private readonly Vector3D position;
private readonly Vector3D direction;
public Ray(Vector3D position, Vector3D direction)
{
this.position = position;
this.direction = direction;
}
@neildanson
neildanson / structures.fs
Created November 6, 2012 22:06
Type declarations
type Ray(position : Vector3D, direction:Vector3D) =
member ray.Position = position
member ray.Direction = direction