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.Collections.Generic; | |
using UnityEngine; | |
public class BezierCurve : MonoBehaviour | |
{ | |
// Casteljau's algorithm based on the implementation in: "3D Math Primer for Graphics and Game Development" | |
public static Vector3 Curve(List<Vector3> points, float t) | |
{ | |
Vector3[] allPoints = points.ToArray(); | |
int n = allPoints.Length; |
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.IO; | |
using UnityEditor; | |
using UnityEngine; | |
/* | |
* This creative work (which includes code) is under exclusive copyright by default. | |
* Unless specified otherwise by Tahar Meijs, nobody else may use, copy, distribute, | |
* or modify this work without being at risk of take-downs, shake-downs, or litigation. | |
* | |
* Testing code does not mean you will are allowed to keep on using this codebase for |
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 UnityEditor; | |
using UnityEngine; | |
/* | |
* This creative work (which includes code) is under exclusive copyright by default. | |
* Unless specified otherwise by Tahar Meijs, nobody else may use, copy, distribute, | |
* or modify this work without being at risk of take-downs, shake-downs, or litigation. | |
* | |
* Testing code does not mean you will are allowed to keep on using this codebase for | |
* your own personal / commercial gain. However, it is always encouraged to use this |
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
public static float Noise3D(float x, float y, float z, float frequency, float amplitude, float persistence, int octave, int seed) | |
{ | |
float noise = 0.0f; | |
for (int i = 0; i < octave; ++i) | |
{ | |
// Get all permutations of noise for each individual axis | |
float noiseXY = Mathf.PerlinNoise(x * frequency + seed, y * frequency + seed) * amplitude; | |
float noiseXZ = Mathf.PerlinNoise(x * frequency + seed, z * frequency + seed) * amplitude; | |
float noiseYZ = Mathf.PerlinNoise(y * frequency + seed, z * frequency + seed) * amplitude; |