Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on: [pull_request]

name: CI

jobs:
build_and_test:
name: Rust project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features

- uses: actions-rs/cargo@v1
with:
command: test
21 changes: 20 additions & 1 deletion src/geometry/basics/Plane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,26 @@ impl PartialEq for Plane {

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn is_valid()
{
// Invalids
assert!(!Plane::UNSET.is_valid());
assert!(!Plane::new(Point3d::INFINITY, Vector3d::INFINITY, Vector3d::INFINITY).is_valid());

// Valids
assert!(Plane::WORLDXY.is_valid());
assert!(Plane::WORLDYZ.is_valid());
assert!(Plane::WORLDZX.is_valid());
}


#[test]
fn cross_product()
{
let z = Plane::cross_product(Vector3d::XAXIS, Vector3d::YAXIS);
assert_eq!(z, Vector3d::ZAXIS);
}

}
2 changes: 1 addition & 1 deletion src/geometry/basics/Point3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::ops;
use crate::IsValid::IsValid;

/// A Point in three-dimensional space
#[derive(Copy, Clone)]
#[derive(Copy, Clone, Debug)]
pub struct Point3d
{
/// The X coordinate
Expand Down
6 changes: 1 addition & 5 deletions src/geometry/basics/Vector3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::ops;
use crate::IsValid::IsValid;

/// A Point in three-dimensional space
#[derive(Copy, Clone, Debug)]
pub struct Vector3d
{
/// The X coordinate
Expand Down Expand Up @@ -145,11 +146,6 @@ impl IsValid for Vector3d {
}
}

impl Clone for Vector3d {
fn clone(&self) -> Vector3d {
Vector3d::new(self.x, self.y, self.z)
}
}

impl PartialEq for Vector3d {
fn eq(&self, other: &Self) -> bool {
Expand Down