Crates.io | TerraForge |
lib.rs | TerraForge |
version | 0.1.0 |
source | src |
created_at | 2024-06-20 03:52:52.848052 |
updated_at | 2024-06-20 03:52:52.848052 |
description | Lightspeed terrain generation at scale in rust |
homepage | |
repository | |
max_upload_size | |
id | 1277543 |
size | 65,677 |
Welcome to TerraForge, a Rust-based terrain engine designed for high-performance and scalable terrain generation and manipulation. TerraForge leverages advanced algorithms and parallel processing to generate and triangulate vast terrains efficiently.
TerraForge is built to handle large-scale terrain generation using a Fibonacci sphere algorithm for point distribution and Delaunay triangulation for mesh generation. It is optimized for performance with multi-threaded processing, making it suitable for real-time applications and large datasets.
To use TerraForge, you need to have Rust installed. You can add TerraForge to your project by including it in your Cargo.toml
file:
[dependencies]
spade = "1.9.2" # Add the spade library for Delaunay triangulation
terraforge = { git = "https://github.com/yourusername/terraforge.git" } # Replace with your repo URL
TerraForge provides a function to perform Delaunay triangulation on a set of 3D points. The triangulation function projects the points onto a 2D plane for processing.
use terraforge::perform_triangulation;
fn main() {
let points = vec![
(0.0, 0.0, 0.0),
(1.0, 0.0, 0.0),
(0.0, 1.0, 0.0),
(1.0, 1.0, 0.0),
];
match perform_triangulation(points) {
Ok(triangulation) => println!("Triangulation successful!"),
Err(e) => println!("Error during triangulation: {:?}", e),
}
}
TerraForge includes a function to generate points on a sphere using the Fibonacci lattice method. This is useful for creating evenly distributed points over a spherical surface, ideal for terrain generation on planetary scales.
use terraforge::generate_fibonacci_sphere;
fn main() {
let num_samples = 1000;
let min_latitude = -90.0;
let max_latitude = 90.0;
let min_longitude = -180.0;
let max_longitude = 180.0;
let seed = 0.5;
match generate_fibonacci_sphere(num_samples, min_latitude, max_latitude, min_longitude, max_longitude, seed) {
Ok(points) => {
println!("Generated points:");
for point in points {
println!("{:?}", point);
}
},
Err(e) => println!("Error generating points: {:?}", e),
}
}
We welcome contributions to TerraForge! Whether it's reporting bugs, improving documentation, or contributing code, your help is appreciated.
Please ensure your code adheres to the existing style and passes all tests.
TerraForge is licensed under the MIT License. See the LICENSE file for more details.
Thank you for using TerraForge! If you have any questions or feedback, feel free to open an issue on our GitHub repository.