- Some tests

This commit is contained in:
Patrice Vignola 2015-08-12 03:46:06 -04:00
parent 0308d02e84
commit ce824658dd
6 changed files with 109 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c5b66487a8909dc42a46e73c0b340df0
timeCreated: 1439311712
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

55
Assets/Tests/Sphere.cs Normal file
View File

@ -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);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d0907c1567bad554c8b995de3459e517
timeCreated: 1439361613
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 646dd6566f9e1374caa3af8ad37c43d3
timeCreated: 1439361747
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant: