Getting a random point between two concentric circles in Unity3D

Getting a random point between two concentric circles in Unity3D /// <summary> /// Returns a random point in the space between two concentric circles. /// </summary> /// <param name=”minRadius”></param> /// <param name=”maxRadius”></param> /// <returns></returns> Vector3 GetRandomPointBetweenTwoCircles(float minRadius, float maxRadius) { //Get a point on a unit circle (radius = 1) by normalizing a random point […]

Getting all files of a specific type, in a specified folder using Boost. (returned in alphabetical order)

Getting all files of a specific type, in a specified folder using Boost. (returned in alphabetical order) //Accepts a path to a directory //a file extension //and a list //Puts all files matching that extension in the directory into the given list. //Sorts and returns the results void GetFilesOfTypeInDirectory(const boost::filesystem::path &directoryPath, const string &fileExtension, std::vector<boost::filesystem::path> […]

Getting all files in a specified folder using Boost.

Getting all files in a specified folder using Boost. Also check out how to get files of a specific type, and sorted results here! #include <boost/filesystem.hpp> #include <boost/range/iterator_range.hpp> //returns a list of all the files in a given folder. std::vector<boost::filesystem::directory_entry> GetAllFilesInFolder(boost::filesystem::path folderPath) { try { if (exists(folderPath)) // does p actually exist? { std::vector<boost::filesystem::directory_entry> files; […]

Find a random point between two Vector3 points.

Find a random point between two Vector3 points.   GetRandomVector3Between.cs /// <summary> /// Returns a random vector3 between min and max. (Inclusive) /// </summary> /// <returns>The <see cref=”UnityEngine.Vector3″/>.</returns> /// <param name=”min”>Minimum.</param> /// <param name=”max”>Max.</param> /// https://gist.github.com/Ashwinning/269f79bef5b1d6ee1f83 public Vector3 GetRandomVector3Between (Vector3 min, Vector3 max) { return min + Random.Range (0, 1) * (max – min); } /// […]