From ce824658dd1393cd252ea27f180571a8d5432315 Mon Sep 17 00:00:00 2001 From: Patrice Vignola Date: Wed, 12 Aug 2015 03:46:06 -0400 Subject: [PATCH] - Some tests --- Assets/Tests/Beam/Person.prefab | 13 +++++++ Assets/Tests/Beam/Person.prefab.meta | 8 ++++ Assets/Tests/Sphere.cs | 55 ++++++++++++++++++++++++++++ Assets/Tests/Sphere.cs.meta | 12 ++++++ Assets/Tests/Sphere.prefab | 13 +++++++ Assets/Tests/Sphere.prefab.meta | 8 ++++ 6 files changed, 109 insertions(+) create mode 100644 Assets/Tests/Beam/Person.prefab create mode 100644 Assets/Tests/Beam/Person.prefab.meta create mode 100644 Assets/Tests/Sphere.cs create mode 100644 Assets/Tests/Sphere.cs.meta create mode 100644 Assets/Tests/Sphere.prefab create mode 100644 Assets/Tests/Sphere.prefab.meta diff --git a/Assets/Tests/Beam/Person.prefab b/Assets/Tests/Beam/Person.prefab new file mode 100644 index 0000000..a459af2 --- /dev/null +++ b/Assets/Tests/Beam/Person.prefab @@ -0,0 +1,13 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 0} + m_IsPrefabParent: 1 diff --git a/Assets/Tests/Beam/Person.prefab.meta b/Assets/Tests/Beam/Person.prefab.meta new file mode 100644 index 0000000..4b4ddc9 --- /dev/null +++ b/Assets/Tests/Beam/Person.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c5b66487a8909dc42a46e73c0b340df0 +timeCreated: 1439311712 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Tests/Sphere.cs b/Assets/Tests/Sphere.cs new file mode 100644 index 0000000..50b4a4c --- /dev/null +++ b/Assets/Tests/Sphere.cs @@ -0,0 +1,55 @@ +using UnityEngine; +using System.Collections; + +public class Sphere : MonoBehaviour +{ + public GameObject SpherePrototype; + public int PointsAmount = 50; + public float SphereRadius = 1f; + + void Awake() + { + // First test (Orion Elenzil) + /* + for (int i = 0; i < PointsAmount; i++) + { + float theta = (360f / PointsAmount) * i; + float phi = (Mathf.PI / 2 / PointsAmount) * i; + + float x = Mathf.Cos(Mathf.Sqrt(phi)) * Mathf.Cos(theta); + float y = Mathf.Cos(Mathf.Sqrt(phi)) * Mathf.Sin(theta); + float z = (UnityEngine.Random.value < 0.5f ? -1 : 1) * Mathf.Sin(Mathf.Sqrt(phi)); + Debug.Log(UnityEngine.Random.value); + Instantiate(SpherePrototype, new Vector3(x, y, z), Quaternion.identity); + }*/ + + // Second test (default unit sphere random distribution) + /* + for (int i = 0; i < PointsAmount; i++) + { + float u = UnityEngine.Random.Range(-1f, 1f); + float a = UnityEngine.Random.Range(0f, 2 * Mathf.PI); + + float x = Mathf.Sqrt(1 - u * u) * Mathf.Cos(a); + float y = Mathf.Sqrt(1 - u * u) * Mathf.Sin(a); + float z = u; + + Instantiate(SpherePrototype, new Vector3(x, y, z), Quaternion.identity); + }*/ + + // Third test (unit sphere semi-uniform distribution) + for (int i = 0; i < PointsAmount; i++) + { + float u = (SphereRadius * 2 / PointsAmount) * i - SphereRadius; + float a = UnityEngine.Random.Range(0f, 2 * Mathf.PI); // ((2 * Mathf.PI) / PointsAmount) * i; + + Debug.Log(a); + + float x = Mathf.Sqrt(SphereRadius * SphereRadius - u * u) * Mathf.Cos(a); + float y = Mathf.Sqrt(SphereRadius * SphereRadius - u * u) * Mathf.Sin(a); + float z = u; + + Instantiate(SpherePrototype, new Vector3(x, y, z), Quaternion.identity); + } + } +} diff --git a/Assets/Tests/Sphere.cs.meta b/Assets/Tests/Sphere.cs.meta new file mode 100644 index 0000000..884b92c --- /dev/null +++ b/Assets/Tests/Sphere.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d0907c1567bad554c8b995de3459e517 +timeCreated: 1439361613 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Tests/Sphere.prefab b/Assets/Tests/Sphere.prefab new file mode 100644 index 0000000..a459af2 --- /dev/null +++ b/Assets/Tests/Sphere.prefab @@ -0,0 +1,13 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 0} + m_IsPrefabParent: 1 diff --git a/Assets/Tests/Sphere.prefab.meta b/Assets/Tests/Sphere.prefab.meta new file mode 100644 index 0000000..8f2ef77 --- /dev/null +++ b/Assets/Tests/Sphere.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 646dd6566f9e1374caa3af8ad37c43d3 +timeCreated: 1439361747 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: