-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deterministic base function. Fix freeze mode. Fix missing events/…
…collisions. (#258) Adds some ComplexField functions for determinism. Follows #226 - Fixes #242 - Fixes #250
- Loading branch information
Showing
13 changed files
with
190 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
use godot::prelude::*; | ||
use rapier::na::ComplexField; | ||
#[derive(GodotClass)] | ||
#[class(base=Object, init)] | ||
/// Contains Rapier Deterministic Math functions. | ||
pub struct RapierMath { | ||
base: Base<Object>, | ||
} | ||
#[godot_api] | ||
impl RapierMath { | ||
#[func] | ||
/// Deterministically compute acos. | ||
fn acos(x: real) -> real { | ||
ComplexField::acos(x) | ||
} | ||
|
||
#[func] | ||
/// Deterministically compute acosh. | ||
fn acosh(x: real) -> real { | ||
ComplexField::acosh(x) | ||
} | ||
|
||
#[func] | ||
/// Deterministically compute asin. | ||
fn asin(x: real) -> real { | ||
ComplexField::asin(x) | ||
} | ||
|
||
#[func] | ||
/// Deterministically compute asinh. | ||
fn asinh(x: real) -> real { | ||
ComplexField::asinh(x) | ||
} | ||
|
||
#[func] | ||
/// Deterministically compute atan. | ||
fn atan(x: real) -> real { | ||
ComplexField::atan(x) | ||
} | ||
|
||
#[func] | ||
/// Deterministically compute atanh. | ||
fn atanh(x: real) -> real { | ||
ComplexField::atanh(x) | ||
} | ||
|
||
#[func] | ||
/// Deterministically compute cos. | ||
fn cos(x: real) -> real { | ||
ComplexField::cos(x) | ||
} | ||
|
||
#[func] | ||
/// Deterministically compute cosh. | ||
fn cosh(x: real) -> real { | ||
ComplexField::cosh(x) | ||
} | ||
|
||
#[func] | ||
/// Deterministically compute log. | ||
fn log(x: real) -> real { | ||
ComplexField::ln(x) | ||
} | ||
|
||
#[func] | ||
/// Deterministically compute sin. | ||
fn sin(x: real) -> real { | ||
ComplexField::sin(x) | ||
} | ||
|
||
#[func] | ||
/// Deterministically compute sinh. | ||
fn sinh(x: real) -> real { | ||
ComplexField::sinh(x) | ||
} | ||
|
||
#[func] | ||
/// Deterministically compute tan. | ||
fn tan(x: real) -> real { | ||
ComplexField::tan(x) | ||
} | ||
|
||
#[func] | ||
/// Deterministically compute tanh. | ||
fn tanh(x: real) -> real { | ||
ComplexField::tanh(x) | ||
} | ||
|
||
#[func] | ||
/// Deterministically compute sqrt. | ||
fn sqrt(x: real) -> real { | ||
if let Some(result) = ComplexField::try_sqrt(x) { | ||
return result; | ||
} | ||
real::NAN | ||
} | ||
} |
Oops, something went wrong.