Installation
Cargo
First you need to install the crate by adding this entry to your Cargo.toml
dependencies list:
bevy_mod_scripting = { version = "0.9.0", features = ["lua54"]}
Choose the language features you wish enabled and add them to the features block.
Bevy Plugin
The next step is to add the BMS plugin to your application, on top of any other extras you want included in your app:
app.add_plugins((
LuaScriptingPlugin::default(),
ScriptFunctionsPlugin
));
The above is how you'd setup BMS for Lua, if you want to use another language, simply use a corresponding plugin from the integration crate.
Language Features
Each language supported by BMS can be switched-on via feature flag as below:
Language | Feature Flag |
---|---|
Lua51 | lua51 |
Lua52 | lua54 |
Lua53 | lua53 |
Lua54 | lua54 |
Luajit | luajit |
Luajit52 | luajit52 |
Luau | luau |
Rhai | rhai |
Rune | rune |
Extra Features
In order to fit as many use cases as possible, BMS allows you to disable a lot of its functionality.
By default all of the useful features are enabled, but you may disable them if you wish if you are only needing BMS for script lifecycle management, and want to populate the bindings yourself.
Feature | Description |
---|---|
core_functions | If enabled, will enable all core functions, i.e. bevy integrations which let you interact with Bevy via reflection |
bevy_bindings | If enabled, populates the function registry with additiona automatically generated bevy bindings. This includes functions on glam and bevy::ecs types. These are useful but will slow down compilation considerably. |
mlua_async | Enables mlua/async |
mlua_serialize | Enables mlua/serialize |
mlua_macros | Enables mlua/macros |
unsafe_lua_modules | Allows loading unsafe modules via require in lua |
Managing Scripts
Scripts live in the standard bevy assets
directory. Loading a script means:
- Parsing the script body
- Creating or updating the resources which store script state
- Assigning a name/id to the script so it can be referred to by the rest of the application.
Loading
BMS listens to ScriptAsset
events and reacts accordingly. In order to load a script, all you need to do is request a handle to it via the asset server and store it somewhere.
Below is an example system which loads a script called assets/my_script.lua
and stores the handle in a local system parameter:
fn load_script(server: Res<AssetServer>, mut handle: Local<Handle<ScriptAsset>>) {
let handle_ = server.load::<ScriptAsset>("my_script.lua");
*handle = handle_;
}
In practice you will likely store this handle in a resource or component, when your load all the scripts necessary for your application.
Unloading
Scripts are automatically unloaded when the asset is dropped. This means that if you have a handle to a script and it goes out of scope, the script will be unloaded.
This will delete references to the script and remove any internal handles to the asset. You will also need to clean up any handles to the asset you hold in your application in order for the asset to be unloaded.
Hot-loading scripts
To enable hot-loading of assets, you need to enable the necessary bevy features as normal see the bevy cheatbook for instructions.
Assuming that hot-reloading is enabled for your app, any changes to script assets will automatically be picked up and the scripts re-loaded.
Manually (re)loading scripts
In order to manually re-load or load a script you can issue the CreateOrUpdateScript
command:
CreateOrUpdateScript::<LuaScriptingPlugin>::new("my_script.lua".into(), "print(\"hello world from new script body\")".into(), asset_handle)
replace LuaScriptingPlugin
with the scripting plugin you are using.
Manually Deleting scripts
In order to delete a previously loaded script, you will need to issue a DeleteScript
command like so:
DeleteScript::<LuaScriptingPlugin>::new("my_script.lua".into())
replace LuaScriptingPlugin
with the scripting plugin you are using.
Loading/Unloading timeframe
Scripts asset events are processed within the same frame they are issued. This means the moment an asset is loaded, it should be loaded and ready to use in the Update
schedule. Similarly, the moment an asset is deleted, it should be unloaded and no longer usable in the Update
schedule.
Attaching Scripts
Once you have scripts discovered and loaded, you'll want to run them.
At the moment BMS supports two methods of making scripts runnable:
- Attaching them to entities via
ScriptComponent
's - Adding static scripts
And then sending script event's which trigger callbacks on the scripts.
Attaching scripts to entities
In order to attach a script and make it runnable simply add a ScriptComponent
to an entity
commands.entity(my_entity).insert(ScriptComponent::new(vec!["my_script.lua", "my_other_script.lua"]));
When this script is run the entity
global will represent the entity the script is attached to. This allows you to interact with the entity in your script easilly.
Making static scripts runnable
Some scripts do not require attaching to an entity. You can run these scripts by loading them first as you would with any other script, then either adding them at app level via add_static_script
or by issuing a AddStaticScript
command like so:
commands.queue(AddStaticScript::new("my_static_script.lua"));
The script will then be run as any other script but without being attached to any entity. and as such the entity
global will always represent an invalid entity.
Note: Internally these scripts are attached to a dummy entity and as such you can think of them as being attached to an entity with an id of 0
.
Running Scripts
Scripts can run logic either when loaded or when triggered by an event. For example the script:
print("hello from load time")
function on_event(arg1)
print("hello from event time")
print(arg1)
end
Will print "hello from load time" when the script is loaded, and "hello from event time" when the script receives an event targeting the on_event
callback with a receiver list including this script or entity.
In order to trigger on_event
you need to first define a label, then send an event containing the label:
#[derive(Reflect)]
pub struct MyReflectType;
// define the label, you can define as many as you like here
callback_labels!(OnEvent => "on_event");
// trigger the event
fn send_event(mut writer: EventWriter<ScriptCallbackEvent>, mut allocator: ResMut<AppReflectAllocator>) {
let allocator = allocator.write();
let my_reflect_payload = ReflectReference::new_allocated(MyReflectType, &mut allocator);
writer.send(ScriptCallbackEvent::new_for_all(
OnEvent,
vec![my_reflect_payload.into()],
));
}
Note the second argument is the payload we are sending with the event, in this case we are sending an arbitrary reflect type MyReflectType
. This can be any type you like, as long as it implements Reflect
.
Other variants of the ScriptValue
enum are available for sending different types of data, such as ScriptValue::Integer
for primtive, types.
Event Handlers
In order for the events you send to actually be picked up, you need to inject special systems into your application. These systems will listen for the events and trigger the appropriate callbacks on the scripts:
app.add_systems(Update, event_handler::<OnEvent, LuaScriptingPlugin>);
Note the system is parameterized by the label we defined earlier, and the scripting plugin we are using. You can add as many of these systems as you like.
The event handler will catch all events with the label OnEvent
and trigger the on_event
callback on all targeted scripts which have that callback defined.
In order to handle events in the same frame and not accidentally have events "spill over" into the next frame, you should make sure to order any systems which produce these events before the event handler systems.
Controlling Script Bindings
In this book we refer to anything accessible by a script, which allows it to communicate with your Rust code a binding
(which in previous versions was more generically referred to as a script API).
The "binding" here being used as in: binding script
code to rust
code.
Namespaces
Namespaces are a way to group functions together, and are used to prevent naming conflicts. You can have multiple namespaces, and each namespace can have multiple functions.
Language implementations will also look for specific functions registered on your type first before looking at the generic ReflectReference
namespace.
Dynamic Functions
Everything callable by scripts must first be registered in the dynamic function registry. Notably we do not make use of the normal bevy function registry to improve performance and usability. This means you cannot call just any function.
In order for a function to be callable by a script it must adhere to a few requirements:
- Each argument must implement
FromScript
. - Each return type must implement
IntoScript
. - Each argument must also implement
GetTypeDependencies
- Each return type must also implement
GetTypeDependencies
The into/from requirements allow us to convert these types to ScriptValue
's, and each supported scripting language can then marshall these into the script.
Note these types are implemented for primitives, but if you want to interact with one of your Reflect
implementing types, you will need to use one of Ref<T>
, Mut<T>
or Val<T>
wrappers in place of &T
, &mut T
and T
respectively.
These wrappers enable us to safely interact with bevy, and claim any necessary mutex'es on Resources
, Components
or Allocations
.
The GetTypeDependencies
, trait is simply a local trait alias for GetTypeRegistration
with less strict type requirements. It allows us to register all the types necessary for the function calls, so that you don't have to register anything manually. If your type implements GetTypeRegistration
you should not face any issues on this front.
Registering Script Functions
Registering functions can be done via the NamespaceBuilder
like below:
NamespaceBuilder::<ReflectReference>::new(&mut world)
.register(
"hello_world",
|s: String| {
println!(s)
},
);
NamespaceBuilder::<GlobalNamespace>::new_unregistered(&mut world)
.register(
"hello_world2",
|s: String| {
println!(s)
},
);
This will allow you to call this function within lua like so:
some_type:hello_world("hi from method!");
hello_world2("hi from global!");
Note the new_unregistered
call instead of new
, this is because GlobalNamespace
is not a Reflect
type, and the new
call also automatically registers the type in the reflection registry.
Context Arguments
Each script function call always receives an additional context argument: FunctionCallContext
.
You can opt-in to receive this argument in your own function definitions by adding it as the first argument.
The context contains requests from the caller to your function, such as "I am calling you from a 1-indexed array system, please convert the index first", This argument is only relevant if you're targeting multiple languages.
It also allows you to retrieve the world via FunctionCallContext::world()
.
You can use this as follows:
NamespaceBuilder::<ReflectReference>::new(&mut world)
.register(
"hello_world",
|ctx: FunctionCallContext, s: String| {
let world = ctx.world()?;
let should_use_0_indexing = ctx.convert_to_0_indexed;
println!(should_use_0_indexing);
println!(s)
Ok(())
},
);
Generic Arguments
Sometimes you might want to be generic over the type of argument you're accepting, you can do so by accepting ScriptValue
arguments like so:
NamespaceBuilder::<ReflectReference>::new(&mut world)
.register(
"is_integer",
|s: ScriptValue| {
match s {
ScriptValue::Integer(i) => true,
_ => false
}
},
);
You can treat return values similarly.
Fallible functions
Your script functions can return errors either by:
- Returning
Result<T: IntoScript, InteropError>
- Returning
ScriptValue
and manually creating theScriptValue::Error(into_interop_erorr.into())
variant.
Reserved Functions
There are a few reserved functions that you can override by registering them on a specific type:
Function Name | Description | Overridable? | Has Default Implementation? |
---|---|---|---|
get | a getter function, used for indexing into a type | ✅ | ✅ |
set | a setter function, used for setting a value on a type | ✅ | ✅ |
sub | a subtraction function, used for subtracting two values | ✅ | ❌ |
add | an addition function, used for adding two values | ✅ | ❌ |
mul | a multiplication function, used for multiplying two values | ✅ | ❌ |
div | a division function, used for dividing two values | ✅ | ❌ |
rem | a remainder function, used for getting the remainder of two values | ✅ | ❌ |
neg | a negation function, used for negating a value | ✅ | ❌ |
pow | a power function, used for raising a value to a power | ✅ | ❌ |
eq | an equality function, used for checking if two values are equal | ✅ | ❌ |
lt | a less than function, used for checking if a value is less than another | ✅ | ❌ |
iter | an iterator function, used for iterating over a value | ❌ | ✅ |
display_ref | a display function, used for displaying a reference to a value | ❌ | ✅ |
display_value | a display function, used for displaying a mutable reference to a value | ❌ | ✅ |
In this context overridable
indicates whether language implementations will look for a specific function on your type before looking at the generic ReflectReference
namespace. You can still remove the existing registration for these functions on the ReflectReference
namespace if you want to replace them with your own implementation.
Modifying Script Contexts
You should be able to achieve what you need by registering script functions in most cases. However sometimes you might want to override the way contexts are loaded, or how the runtime is initialized.
This is possible using Context Initializers
and Context Pre Handling Initializers
as well as Runtime Initializers
.
It is however always reccomened to use the dynamic script function registry whenever possible, as it is more flexible and easier to use. It also allows you to introspect available functions easier.
Context Initializers
For example, let's say you want to set a dynamic amount of globals in your script, depending on some setting in your app.
You could do this by customizing the scripting plugin:
let plugin = LuaScriptingPlugin::default().add_context_initializer(|script_id: &str, context: &mut Lua| {
let globals = context.globals();
for i in 0..10 {
globals.set(i, i);
}
Ok(())
});
app.add_plugins(plugin)
The above will run every time the script is loaded or re-loaded and before it handles any callbacks.
Context Pre Handling Initializers
If you want to customize your context before every time it's about to handle events (and when it's loaded + reloaded), you can use Context Pre Handling Initializers
:
let plugin = LuaScriptingPlugin::default().add_context_pre_handling_initializer(|script_id: &str, entity: Entity, context: &mut Lua| {
let globals = context.globals();
globals.set("script_name", script_id.to_owned());
Ok(())
});
Runtime Initializers
Some scripting languages, have the concept of a runtime
. This is a global object which is shared between all contexts. You can customize this object using Runtime Initializers
:
let plugin = SomeScriptingPlugin::default().add_runtime_initializer(|runtime: &mut Runtime| {
runtime.set_max_stack_size(1000);
Ok(())
});
In the case of Lua, the runtime type is ()
i.e. This is because mlua
does not have a separate runtime concept.
Accessing the World in Initializers
You can access the world in these initializers by using the thread local: ThreadWorldContainer
:
let plugin = LuaScriptingPlugin::default();
plugin.add_context_initializer(|script_id: &str, context: &mut Lua| {
let world = ThreadWorldContainer.try_get_world().unwrap();
world.with_resource::<MyResource>(|res| println!("My resource: {:?}", res));
Ok(())
});
Shared Contexts
By default BMS will create an individual script context, or sandbox, for each script that is run. This means that each script will have its own set of global variables and functions that are isolated from other scripts. However, sometimes this might not be desirable, if you aren't worried about scripts interfering with each other, or if you want to easilly share data between scripts. In these cases, you can use shared contexts.
Enabling Shared Contexts
You can enable shared contexts by configuring the relevant scripting plugin like so:
let mut plugin = LuaScriptingPlugin::default().enable_context_sharing();
app.add_plugins(plugin);
Context Loading Settings
All context loading settings are stored in a separate resource per scripting plugin namely: ContextLoadingSettings<Plugin>
.
The settings are as follows:
loader
- the load and unload strategy for contexts. Each scripting plugin will have a load and unload function which is hooked up through hereassigner
- the strategy for assigning/unassigning contexts to scripts. This is used to determine how to assign a context to a script when it is run, and what to do with the context when the script is finished.context_initializers
- stores all context initializers for the plugincontext_pre_handling_initializers
- stores all context pre-handling initializers for the plugin
More advanced applications might want to customize these settings to suit their needs.
Script ID mapping
Every script is currently identified by a unique ID.
ID's are derived from the script asset path for scripts loaded via the asset system.
By default this is an identity mapping, but you can override this by modifying the AssetPathToScriptIdMapper
inside the ScriptAssetSettings
resource before loading the script.
Scripting Reference
This part of the book covers the user-facing API of the scripting languages supported by BMS. This will be where you will want to forward your script users to get started with scripting in BMS.
If you are a modder, welcome! 👋, apologies for the rust-centricity of this guide, we are working on it!
Globals
Scripts will have access to a few global variables in most callbacks:
world
: a static reference to the world, with all sorts of functions availableentity
: the entity the script is attached to, not available on load/unload callbacksscript_id
: the ID of the current script
Core Bindings
The core bindings are manually written utilities for interacting with the Bevy
world and everything contained within it. These bindings are used to create and manipulate entities, components, resources, and systems.
Every language BMS supports will support these.
World
The World
is the entry point for interacting with Bevy
. It is provided to scripts under either the world
or World
static variable.
get_type_by_name
Returns either a ScriptComponentRegistration
or ScriptResourceRegistration
depending on the type of the type requested. If the type is neither returns a ScriptTypeRegistration
.
Arguments:
Argument | Type | Description |
---|---|---|
type_name | String | The name of the type to get, this can be either the short type name, i.e. my_type or the long name i.e. my_crate::my_module::my_type |
Returns:
Return | Description |
---|---|
Option<ScriptTypeRegistration OR scriptComponentRegistration OR scriptResourceRegistration> | The registration for the type if it exists, otherwise None |
MyType = world.get_type_by_name("MyType")
if MyType == nil then
print("MyType not found")
end
get_component
Arguments:
Argument | Type | Description |
---|---|---|
entity | Entity | The entity to get the component from |
registration | ScriptTypeRegistration | The type registration as returned by get_type_by_name of the component |
Returns:
Return | Description |
---|---|
Option<ReflectReference> | The reference to the component if it exists, otherwise None |
local component = world.get_component(entity, MyType)
if component ~= nil then
print("found component:" .. component)
end
has_component
Arguments:
Argument | Type | Description |
---|---|---|
entity | Entity | The entity to check the component for |
registration | ScriptTypeRegistration | The type registration as returned by get_type_by_name of the component |
Returns:
Return | Description |
---|---|
bool | true if the entity has the component, otherwise false |
if world.has_component(entity, MyType) then
print("Entity has MyType")
end
remove_component
Arguments:
Argument | Type | Description |
---|---|---|
entity | Entity | The entity to remove the component from |
registration | ScriptTypeRegistration | The type registration as returned by get_type_by_name of the component |
world.remove_component(entity, MyType)
get_resource
Arguments:
Argument | Type | Description |
---|---|---|
registration | ScriptTypeRegistration | The type registration as returned by get_type_by_name of the resource |
Returns:
Return | Description |
---|---|
Option<ReflectReference> | The resource if it exists, otherwise None |
local resource = world.get_resource(MyType)
if resource ~= nil then
print("found resource:" .. resource)
end
has_resource
Arguments:
Argument | Type | Description |
---|---|---|
registration | ScriptTypeRegistration | The type registration as returned by get_type_by_name of the resource |
Returns:
Return | Description |
---|---|
bool | true if the resource exists, otherwise false |
local hasResource = world.has_resource(MyType)
remove_resource
Arguments:
Argument | Type | Description |
---|---|---|
registration | ScriptTypeRegistration | The type registration as returned by get_type_by_name of the resource |
world.remove_resource(MyType)
add_default_component
Arguments:
Argument | Type | Description |
---|---|---|
entity | Entity | The entity to add the component to |
registration | ScriptTypeRegistration | The type registration as returned by get_type_by_name of the component |
world.add_default_component(entity, MyType)
insert_component
Inserts or applies the given value to the component of the entity. If the component does not exist it will be added.
Arguments:
Argument | Type | Description |
---|---|---|
entity | Entity | The entity to add the component to |
registration | ScriptTypeRegistration | The type registration as returned by get_type_by_name of the component |
component | ReflectReference | A reference to an existing component value to be inserted |
local existingComponent = world.get_component(otherEntity, MyType)
world.insert_component(entity, MyType, existingComponent)
spawn
Returns:
Return | Description |
---|---|
Entity | The spawned entity |
local entity = world.spawn()
insert_children
Arguments:
Argument | Type | Description |
---|---|---|
entity | Entity | The parent entity |
index | usize | The index to insert the children at |
children | Vec<Entity> | The children entities to insert |
world.insert_children(parent, 1, {child1, child2})
push_children
Arguments:
Argument | Type | Description |
---|---|---|
entity | Entity | The parent entity |
children | Vec<Entity> | The children entities to push |
world.push_children(parent, {child1, child2})
get_children
Arguments:
Argument | Type | Description |
---|---|---|
entity | Entity | The parent entity |
Returns:
Return | Description |
---|---|
Vec<Entity> | The children entities |
local children = world.get_children(parent)
for _, child in pairs(children) do
print("child: " .. child)
end
get_parent
Arguments:
Argument | Type | Description |
---|---|---|
entity | Entity | The child entity |
Returns:
Return | Description |
---|---|
Option<Entity> | The parent entity if it exists, otherwise None |
local parent = world.get_parent(child)
if parent ~= nil then
print("parent: " .. parent)
end
despawn
Arguments:
Argument | Type | Description |
---|---|---|
entity | Entity | The entity to despawn |
world.despawn(entity)
despawn_descendants
Arguments:
Argument | Type | Description |
---|---|---|
entity | Entity | The entity to despawn descendants of |
world.despawn_descendants(entity)
despawn_recursive
Arguments:
Argument | Type | Description |
---|---|---|
entity | Entity | The entity to despawn recursively |
world.despawn_recursive(entity)
has_entity
Arguments:
Argument | Type | Description |
---|---|---|
entity | Entity | The entity to check |
Returns:
Return | Description |
---|---|
bool | true if the entity exists, otherwise false |
local exists = world.has_entity(entity)
if exists then
print("entity exists")
end
query
Returns:
Return | Description |
---|---|
ScriptQueryBuilder | The query builder |
local queryBuilder = world.query()
exit
Send the exit signal to the application, will gracefully shutdown the application.
world.exit()
ReflectReference
ReflectReferences are simply references to data living either in:
- A component
- A resource
- The allocator
Reflect references contain a standard interface which operates over the reflection layer exposed by Bevy
and also provides a way to call various dynamic functions registered on the underlying pointed to data.
display_ref
Arguments:
Argument | Type | Description |
---|---|---|
s | ReflectReference | The reference to display |
Returns:
Return | Description |
---|---|
String | The reference in string format |
print(ref:display_ref())
print(ref)
display_value
Arguments:
Argument | Type | Description |
---|---|---|
s | ReflectReference | The reference to display |
Returns:
Return | Description |
---|---|
String | The value in string format |
print(ref:display_value())
get
The index function, allows you to index into the reflect reference.
Arguments:
Argument | Type | Description |
---|---|---|
key | ScriptValue | The key to get the value for |
Returns:
Return | Description |
---|---|
ScriptValue | The value |
local value = ref:get(key)
-- same as
local value = ref.key
local value = ref[key]
local value = ref["key"]
-- for tuple structs
local valye = ref._1
set
Arguments:
Argument | Type | Description |
---|---|---|
key | ScriptValue | The key to set the value for |
value | ScriptValue | The value to set |
Returns:
Return | Description |
---|---|
ScriptValue | The result |
ref:set(key, value)
-- same as
ref.key = value
ref[key] = value
ref["key"] = value
-- for tuple structs
ref._1 = value
push
Generic push method, if the underlying type supports it, will push the value into the end of the reference.
Arguments:
Argument | Type | Description |
---|---|---|
value | ScriptValue | The value to push |
ref:push(value)
pop
Generic pop method, if the underlying type supports it, will pop the value from the end of the reference.
Arguments:
Argument | Type | Description |
---|---|---|
s | ReflectReference | The reference to pop from |
Returns:
Return | Description |
---|---|
ScriptValue | The popped value |
local value = ref:pop()
insert
Generic insert method, if the underlying type supports it, will insert the value at the key.
Arguments:
Argument | Type | Description |
---|---|---|
key | ScriptValue | The key to insert the value for |
value | ScriptValue | The value to insert |
ref:insert(key, value)
clear
Generic clear method, if the underlying type supports it, will clear the referenced container type.
Arguments:
Argument | Type | Description |
---|---|---|
s | ReflectReference | The reference to clear |
ref:clear()
len
Generic length method, if the underlying type supports it, will return the length of the referenced container or length relevant to the type itself (number of fields etc.).
Arguments:
Argument | Type | Description |
---|---|---|
s | ReflectReference | The reference to get the length of |
Returns:
Return | Description |
---|---|
usize | The length |
length = ref:len()
remove
Generic remove method, if the underlying type supports it, will remove the value at the key.
Arguments:
Argument | Type | Description |
---|---|---|
key | ScriptValue | The key to remove the value for |
Returns:
Return | Description |
---|---|
ScriptValue | The removed value |
local value = ref:remove(key)
iter
The iterator function, returns a function which can be called to iterate over the reference.
Arguments:
Argument | Type | Description |
---|---|---|
s | ReflectReference | The reference to iterate over |
Returns:
Return | Description |
---|---|
ScriptFunctionMut | The iterator function |
local iter = ref:iter()
local val = iter()
while val do
print(val)
next = iter()
end
-- same as
for val in pairs(ref) do
print(val)
end
functions
Returns a list of functions that can be called on the reference.
Returns:
Return | Description |
---|---|
Vec<FunctionInfo> | The list of functions |
local functions = ref:functions()
for _, func in ipairs(functions) do
print(func.name)
end
ScriptTypeRegistration
A reference to a type registration, in general think of this as a handle to a type.
type_name
Arguments:
Argument | Type | Description |
---|---|---|
s | ScriptTypeRegistration | The type registration as returned by get_type_by_name |
Returns:
Return | Description |
---|---|
String | The type name |
local name = MyType:type_name()
short_name
Arguments:
Argument | Type | Description |
---|---|---|
s | ScriptTypeRegistration | The type registration as returned by get_type_by_name |
Returns:
Return | Description |
---|---|
String | The short name |
local name = MyType:short_name()
is_resource
Arguments:
Argument | Type | Description |
---|---|---|
s | ScriptTypeRegistration | The type registration as returned by get_type_by_name |
Returns:
Return | Description |
---|---|
bool | true if the type is a resource, otherwise false |
if MyType:is_resource() then
print("MyType is a resource")
end
is_component
Arguments:
Argument | Type | Description |
---|---|---|
s | ScriptTypeRegistration | The type registration as returned by get_type_by_name |
Returns:
Return | Description |
---|---|
bool | true if the type is a component, otherwise false |
if MyType:is_component() then
print("MyType is a component")
end
ScriptComponentRegistration
A reference to a component type's registration, in general think of this as a handle to a type.
type_name
Arguments:
Argument | Type | Description |
---|---|---|
s | ScriptComponentRegistration | The type registration as returned by get_type_by_name |
Returns:
Return | Description |
---|---|
String | The type name |
local name = MyType:type_name()
short_name
Arguments:
Argument | Type | Description |
---|---|---|
s | ScriptComponentRegistration | The type registration as returned by get_type_by_name |
Returns:
Return | Description |
---|---|
String | The short name |
local name = MyType:short_name()
ScriptResourceRegistration
A reference to a resource type's registration, in general think of this as a handle to a type.
type_name
Arguments:
Argument | Type | Description |
---|---|---|
s | ScriptResourceRegistration | The type registration as returned by get_type_by_name |
Returns:
Return | Description |
---|---|
String | The type name |
local name = MyType:type_name()
short_name
Arguments:
Argument | Type | Description |
---|---|---|
s | ScriptResourceRegistration | The type registration as returned by get_type_by_name |
Returns:
Return | Description |
---|---|
String | The short name |
local name = MyType:short_name()
ScriptQueryBuilder
The query builder is used to build queries for entities with specific components. Can be used to interact with arbitrary entities in the world.
component
Adds a component to the query, this will be accessible in the query results under the index corresponding to the index of this component in the query.
Arguments:
Argument | Type | Description |
---|---|---|
s | ScriptQueryBuilder | The query builder |
component | ScriptComponentRegistration | The component to query for |
Returns:
Return | Description |
---|---|
ScriptQueryBuilder | The updated query builder |
query:component(MyType):component(MyOtherType)
with
Arguments:
Argument | Type | Description |
---|---|---|
s | ScriptQueryBuilder | The query builder |
with | ScriptComponentRegistration | The component to include in the query |
Returns:
Return | Description |
---|---|
ScriptQueryBuilder | The updated query builder |
query:with(MyType):with(MyOtherType)
without
Arguments:
Argument | Type | Description |
---|---|---|
s | ScriptQueryBuilder | The query builder |
without | ScriptComponentRegistration | The component to exclude from the query |
Returns:
Return | Description |
---|---|
ScriptQueryBuilder | The updated query builder |
query:without(MyType):without(MyOtherType)
build
Arguments:
Argument | Type | Description |
---|---|---|
s | ScriptQueryBuilder | The query builder |
Returns:
Return | Description |
---|---|
Vec<ScriptQueryResult> | The query results |
local results = query:build()
for _, result in pairs(results) do
print(result)
end
ScriptQueryResult
The result of a query, built by the query builder.
entity
Arguments:
Argument | Type | Description |
---|---|---|
s | ScriptQueryResult | The query result |
Returns:
Return | Description |
---|---|
Entity | The entity |
local entity = result:entity()
components
Arguments:
Argument | Type | Description |
---|---|---|
s | ScriptQueryResult | The query result |
Returns:
Return | Description |
---|---|
Vec<ReflectReference> | The components |
for _, component in pairs(result:components()) do
print(component)
end
Core Callbacks
On top of callbacks which are registered by your application, BMS provides a set of core callbacks which are always available.
The two core callbacks are:
on_script_loaded
on_script_unloaded
on_script_loaded
This will be called right after a script has been loaded or reloaded. This is a good place to initialize your script. You should avoid placing a lot of logic into the global body of your script, and instead put it into this callback. Otherwise errors in the initialization will fail the loading of the script.
This callback will not have access to the entity
variable, as when the script is being loaded it's not attached to an entity yet.
print("you can also use this space, but it's not recommended")
function on_script_loaded()
print("Hello world")
end
on_script_unloaded
This will be called right before a script is unloaded. This is a good place to clean up any resources that your script has allocated. Note this is not called when a script is reloaded, only when it is being removed from the system.
This callback will not have access to the entity
variable, as when the script is being unloaded it might not be attached to an entity.
function on_script_unloaded()
print("Goodbye world")
end
Developing BMS
This section is for developers who want to contribute to the BMS project. It covers various topics necessary for understanding the project and contributing to it.
Contributing
Please see the code of conduct as well as the contributing guidelines first.
Setup
this crate contains a work in progress xtask
setup which in theory should allow you to setup everything you need for local development by running:
cargo xtask init
This command currently supports the following IDE's
If you'd like to add support for another IDE, please feel free to open a PR!
Adding New Languages to BMS
If you are interested in adding a new language to BMS, please read this section first. Adding a new language is a non-trivial task depending on the language you want to add. It also requires a lot of effort and time to maintain a new language, so unless the language you want to add is widely used and has a large community, it might not be worth the effort.
Evaluating Feasibility
In order for a language to work well with BMS it's necessary it supports the following features:
- Interoperability with Rust. If you can't call it from Rust easilly and there is no existing crate that can do it for you, it's a no-go.
- First class functions. Or at least the ability to call an arbitrary function with an arbitrary number of arguments from a script. Without this feature, you would need to separately generate code for the bevy bindings which is painful and goes against the grain of BMS.
First Classs Functions
They don't necessarily have to be first class from the script POV, but they need to be first class from the POV of the host language. This means that the host language needs to be able to call a function with an arbitrary number of arguments.
Examples
Let's say your language supports a Value
type which can be returned to the script. And it has a Value::Function
variant. The type on the Rust side would look something like this:
pub enum Value {
Function(Arc<Fn(&[Value]) -> Value>),
// other variants
}
This is fine, and can be integrated with BMS. Since an Fn function can be a closure capturing a DynamicScriptFunction
. If there is no support for FnMut
closures though, you might face issues in the implementation. Iterators in bevy_mod_scripting_functions
for example use DynamicScriptFunctionMut
which cannot work with Fn
closures.
Now let's imagine instead another language with a similar enum, supports this type instead:
#![allow(unused)] fn main() { pub enum Value { Function(Arc<dyn Function>), // other variants } pub trait Function { fn call(&self, args: Vec<Value>) -> Value; fn num_params() -> usize; } }
This implies that to call this function, you need to be able to know the amount of arguments it expects at COMPILE time. This is not compatibile with dynamic functions, and would require a lot of code generation to make work with BMS. Languages with no support for dynamic functions are not compatible with BMS.
Interoperability with Rust
Not all languages can easilly be called from Rust. Lua has a wonderful crate which works out the ffi and safety issues for us. But not all languages have this luxury. If you can't call it from Rust easilly and there is no existing crate that can do it for you, integrating with BMS might not be the best idea.
Necessary Features
In order for a language to be called "implemented" in BMS, it needs to support the following features:
- Every script function which is registered on a type's namespace must:
- Be callable on a
ReflectReference
representing object of that type in the script
local my_reference = ... my_reference:my_Registered_function()
- If it's static it must be callable from a global proxy object for that type, i.e.
MyType.my_static_function()
- Be callable on a
ReflectReferences
must support a set of basic features:- Access to fields via reflection i.e.:
local my_reference = ... my_reference.my_field = 5 print(my_reference.my_field)
- Basic operators and standard operations are overloaded with the appropriate standard dynamic function registered:
- Addition: dispatches to the
add
binary function on the type - Multiplication: dispatches to the
mul
binary function on the type - Division: dispatches to the
div
binary function on the type - Subtraction: dispatches to the
sub
binary function on the type - Modulo: dispatches to the
rem
binary function on the type - Negation: dispatches to the
neg
unary function on the type - Exponentiation: dispatches to the
pow
binary function on the type - Equality: dispatches to the
eq
binary function on the type - Less than: dispatches to the
lt
binary function on the type - Length: calls the
len
method onReflectReference
or on the table if the value is one. - Iteration: dispatches to the
iter
method onReflectReference
which returns an iterator function, this can be repeatedly called until it returnsScriptValue::Unit
to signal the end of the iteration. - Print: calls the
display_ref
method onReflectReference
or on the table if the value is one.
- Addition: dispatches to the
- Script handlers, loaders etc. must be implemented such that the
ThreadWorldContainer
is set for every interaction with script contexts, or anywhere else it might be needed.
Generated Docs
Contents
This is an automatically generated file, you'll find links to the contents below
Section | Contents |
---|---|
Types | Describes all available binding types |
Global Functions | Documents all the global functions present in the bindings |
Globals | Documents all global variables present in the bindings |
Globals
Globals
Functions
Functions
Function | Summary |
---|---|
construct(ctxt, registration, payload) | Attempts to construct the given type, given an arbitrary map of values. |
construct
Attempts to construct the given type, given an arbitrary map of values.
Arguments
- ctxt :
FunctionCallContext
- No Documentation 🚧 - registration :
ScriptTypeRegistration | ScriptComponentRegistration | ScriptResourceRegistration
- The type to construct. - payload :
HashMap<String, ScriptValue>
- The values to use to construct the type.
Returns
- reference :
ReflectReference
- The constructed type.
Types
Types
DynamicFunctionMut
Opaque Type. 🔒
Description
A dynamic mutable script function.
Functions
FunctionCallContext
Opaque Type. 🔒
Description
The caller context when calling a script function. Functions can choose to react to caller preferences such as converting 1-indexed numbers to 0-indexed numbers
Functions
ReflectReference
ReflectReference
Description
An accessor to a
dyn PartialReflect
struct, stores a base ID of the type and a reflection path safe to build but to reflect on the value inside you need to ensure aliasing rules are upheld
Functions
Function | Summary |
---|---|
clear(ctxt, s) | No Documentation 🚧 |
display_ref(ctxt, s) | No Documentation 🚧 |
display_value(ctxt, s) | No Documentation 🚧 |
functions(ctxt, s) | No Documentation 🚧 |
get(ctxt, self_, key) | No Documentation 🚧 |
insert(ctxt, s, k, v) | No Documentation 🚧 |
iter(ctxt, s) | No Documentation 🚧 |
len(ctxt, s) | No Documentation 🚧 |
pop(ctxt, s) | No Documentation 🚧 |
push(ctxt, s, v) | No Documentation 🚧 |
remove(ctxt, s, k) | No Documentation 🚧 |
set(ctxt, self_, key, value) | No Documentation 🚧 |
variant_name(ctxt, s) | No Documentation 🚧 |
clear
No Documentation 🚧
Arguments
- ctxt :
FunctionCallContext
- No Documentation 🚧 - s :
ReflectReference
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
display_ref
No Documentation 🚧
Arguments
- ctxt :
FunctionCallContext
- No Documentation 🚧 - s :
ReflectReference
- No Documentation 🚧
Returns
- arg0 :
String
- No Documentation 🚧
display_value
No Documentation 🚧
Arguments
- ctxt :
FunctionCallContext
- No Documentation 🚧 - s :
ReflectReference
- No Documentation 🚧
Returns
- arg0 :
String
- No Documentation 🚧
functions
No Documentation 🚧
Arguments
- ctxt :
FunctionCallContext
- No Documentation 🚧 - s :
ReflectReference
- No Documentation 🚧
Returns
- arg0 :
Vec<FunctionInfo>
- No Documentation 🚧
get
No Documentation 🚧
Arguments
- ctxt :
FunctionCallContext
- No Documentation 🚧 - self_ :
ReflectReference
- No Documentation 🚧 - key :
ScriptValue
- No Documentation 🚧
Returns
- arg0 :
ScriptValue
- No Documentation 🚧
insert
No Documentation 🚧
Arguments
- ctxt :
FunctionCallContext
- No Documentation 🚧 - s :
ReflectReference
- No Documentation 🚧 - k :
ScriptValue
- No Documentation 🚧 - v :
ScriptValue
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
iter
No Documentation 🚧
Arguments
- ctxt :
FunctionCallContext
- No Documentation 🚧 - s :
ReflectReference
- No Documentation 🚧
Returns
- arg0 :
DynamicFunctionMut
- No Documentation 🚧
len
No Documentation 🚧
Arguments
- ctxt :
FunctionCallContext
- No Documentation 🚧 - s :
ReflectReference
- No Documentation 🚧
Returns
- arg0 :
Optional<usize>
- No Documentation 🚧
pop
No Documentation 🚧
Arguments
- ctxt :
FunctionCallContext
- No Documentation 🚧 - s :
ReflectReference
- No Documentation 🚧
Returns
- arg0 :
ScriptValue
- No Documentation 🚧
push
No Documentation 🚧
Arguments
- ctxt :
FunctionCallContext
- No Documentation 🚧 - s :
ReflectReference
- No Documentation 🚧 - v :
ScriptValue
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
remove
No Documentation 🚧
Arguments
- ctxt :
FunctionCallContext
- No Documentation 🚧 - s :
ReflectReference
- No Documentation 🚧 - k :
ScriptValue
- No Documentation 🚧
Returns
- arg0 :
ScriptValue
- No Documentation 🚧
set
No Documentation 🚧
Arguments
- ctxt :
FunctionCallContext
- No Documentation 🚧 - self_ :
ScriptValue
- No Documentation 🚧 - key :
ScriptValue
- No Documentation 🚧 - value :
ScriptValue
- No Documentation 🚧
Returns
- arg0 :
ScriptValue
- No Documentation 🚧
variant_name
No Documentation 🚧
Arguments
- ctxt :
FunctionCallContext
- No Documentation 🚧 - s :
ReflectReference
- No Documentation 🚧
Returns
- arg0 :
Optional<String>
- No Documentation 🚧
String
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
Cow
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
Arc
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
Vec<Val>
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
Vec<Val>
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
Vec<Val>
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
Vec
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
Vec
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
AssetIndex
AssetIndex
- generation : u32
- index : u32
Description
A generational runtime-only identifier for a specific [
Asset
] stored in [Assets
]. This is optimized for efficient runtime usage and is not suitable for identifying assets across app runs.
Functions
Handle<()>
Strong
- alloc::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<()>
Description
A strong or weak handle to a specific [
Asset
]. If a [Handle
] is [Handle::Strong
], the [Asset
] will be kept alive until the [Handle
] is dropped. If a [Handle
] is [Handle::Weak
], it does not necessarily reference a live [Asset
], nor will it keep assets alive.[
Handle
] can be cloned. If a [Handle::Strong
] is cloned, the referenced [Asset
] will not be freed until all instances of the [Handle
] are dropped.[
Handle::Strong
] also provides access to useful [Asset
] metadata, such as the [AssetPath
] (if it exists).
Functions
Handle<TypeId(0xa4e767ed3a91f062bc69d47c9703c78d)>
Strong
- alloc::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_asset::assets::LoadedUntypedAsset>
Description
A strong or weak handle to a specific [
Asset
]. If a [Handle
] is [Handle::Strong
], the [Asset
] will be kept alive until the [Handle
] is dropped. If a [Handle
] is [Handle::Weak
], it does not necessarily reference a live [Asset
], nor will it keep assets alive.[
Handle
] can be cloned. If a [Handle::Strong
] is cloned, the referenced [Asset
] will not be freed until all instances of the [Handle
] are dropped.[
Handle::Strong
] also provides access to useful [Asset
] metadata, such as the [AssetPath
] (if it exists).
Functions
Handle<TypeId(0x4c1e3c7862aba54dfc7aa5e3d6e9108b)>
Strong
- alloc::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_asset::folder::LoadedFolder>
Description
A strong or weak handle to a specific [
Asset
]. If a [Handle
] is [Handle::Strong
], the [Asset
] will be kept alive until the [Handle
] is dropped. If a [Handle
] is [Handle::Weak
], it does not necessarily reference a live [Asset
], nor will it keep assets alive.[
Handle
] can be cloned. If a [Handle::Strong
] is cloned, the referenced [Asset
] will not be freed until all instances of the [Handle
] are dropped.[
Handle::Strong
] also provides access to useful [Asset
] metadata, such as the [AssetPath
] (if it exists).
Functions
AssetId<()>
Index
- index : bevy_asset::assets::AssetIndex
Uuid
- uuid : uuid::Uuid
Description
A unique runtime-only identifier for an [
Asset
]. This is cheap to [Copy
]/[Clone
] and is not directly tied to the lifetime of the Asset. This means it can point to an [Asset
] that no longer exists.For an identifier tied to the lifetime of an asset, see
Handle
.For an "untyped" / "generic-less" id, see [
UntypedAssetId
].
Functions
AssetId<TypeId(0xa4e767ed3a91f062bc69d47c9703c78d)>
Index
- index : bevy_asset::assets::AssetIndex
Uuid
- uuid : uuid::Uuid
Description
A unique runtime-only identifier for an [
Asset
]. This is cheap to [Copy
]/[Clone
] and is not directly tied to the lifetime of the Asset. This means it can point to an [Asset
] that no longer exists.For an identifier tied to the lifetime of an asset, see
Handle
.For an "untyped" / "generic-less" id, see [
UntypedAssetId
].
Functions
AssetId<TypeId(0x4c1e3c7862aba54dfc7aa5e3d6e9108b)>
Index
- index : bevy_asset::assets::AssetIndex
Uuid
- uuid : uuid::Uuid
Description
A unique runtime-only identifier for an [
Asset
]. This is cheap to [Copy
]/[Clone
] and is not directly tied to the lifetime of the Asset. This means it can point to an [Asset
] that no longer exists.For an identifier tied to the lifetime of an asset, see
Handle
.For an "untyped" / "generic-less" id, see [
UntypedAssetId
].
Functions
AssetPath
Opaque Type. 🔒
Description
Represents a path to an asset in a "virtual filesystem".
Asset paths consist of three main parts:
- [
AssetPath::source
]: The name of theAssetSource
to load the asset from. This is optional. If one is not set the default source will be used (which is theassets
folder by default).- [
AssetPath::path
]: The "virtual filesystem path" pointing to an asset source file.- [
AssetPath::label
]: An optional "named sub asset". When assets are loaded, they are allowed to load "sub assets" of any type, which are identified by a named "label".Asset paths are generally constructed (and visualized) as strings:
# use bevy_asset::{Asset, AssetServer, Handle}; # use bevy_reflect::TypePath; # # #[derive(Asset, TypePath, Default)] # struct Mesh; # # #[derive(Asset, TypePath, Default)] # struct Scene; # # let asset_server: AssetServer = panic!(); // This loads the `my_scene.scn` base asset from the default asset source. let scene: Handle<Scene> = asset_server.load("my_scene.scn"); // This loads the `PlayerMesh` labeled asset from the `my_scene.scn` base asset in the default asset source. let mesh: Handle<Mesh> = asset_server.load("my_scene.scn#PlayerMesh"); // This loads the `my_scene.scn` base asset from a custom 'remote' asset source. let scene: Handle<Scene> = asset_server.load("remote://my_scene.scn");
[
AssetPath
] implements [From
] for&'static str
,&'static Path
, and&'a String
, which allows us to optimize the static cases. This means that the common case ofasset_server.load("my_scene.scn")
when it creates and clones internal ownedAssetPaths
. This also means that you should use [AssetPath::parse
] in cases where&str
is the explicit type.
Functions
Name
Name
- hash : u64
- name : alloc::borrow::Cow
Description
Component used to identify an entity. Stores a hash for faster comparisons.
The hash is eagerly re-computed upon each update to the name.
[
Name
] should not be treated as a globally unique identifier for entities, as multiple entities can have the same name. [Entity
] should be used instead as the default unique identifier.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
Name
- No Documentation 🚧
Returns
- arg0 :
Name
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Name
- No Documentation 🚧 - other :
Name
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
ComponentId
ComponentId
- usize
Description
A value which uniquely identifies the type of a [
Component
] or [Resource
] within a [World
].Each time a new
Component
type is registered within aWorld
using e.g. [World::register_component
] or [World::register_component_with_descriptor
] or a Resource with e.g. [World::init_resource
], a correspondingComponentId
is created to track it.While the distinction between
ComponentId
and [TypeId
] may seem superficial, breaking them into two separate but related concepts allows components to exist outside of Rust's type system. Each Rust type registered as aComponent
will have a correspondingComponentId
, but additionalComponentId
s may exist in aWorld
to track components which cannot be represented as Rust types for scripting or other advanced use-cases.A
ComponentId
is tightly coupled to its parentWorld
. Attempting to use aComponentId
from oneWorld
to access the metadata of aComponent
in a differentWorld
is undefined behavior and must not be attempted.Given a type
T
which implements [Component
], theComponentId
forT
can be retrieved from aWorld
using [World::component_id()
] or via [Components::component_id()
]. Access to theComponentId
for a [Resource
] is available via [Components::resource_id()
].
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
index(_self) | Returns the index of the current component. |
new(index) | Creates a new [`ComponentId`]. The `index` is a unique value associated with each type of component in a given world. Usually, this value is taken from a counter incremented for each type of component registered with the world. |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
ComponentId
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
ComponentId
- No Documentation 🚧
Returns
- arg0 :
ComponentId
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
ComponentId
- No Documentation 🚧 - other :
ComponentId
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
index
Returns the index of the current component.
Arguments
- _self :
ComponentId
- No Documentation 🚧
Returns
- arg0 :
usize
- No Documentation 🚧
new
Creates a new [
ComponentId
]. Theindex
is a unique value associated with each type of component in a given world. Usually, this value is taken from a counter incremented for each type of component registered with the world.
Arguments
- index :
usize
- No Documentation 🚧
Returns
- arg0 :
ComponentId
- No Documentation 🚧
ComponentTicks
ComponentTicks
- added : bevy_ecs::component::Tick
- changed : bevy_ecs::component::Tick
Description
Records when a component or resource was added and when it was last mutably dereferenced (or added).
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
is_added(_self, last_run, this_run) | Returns `true` if the component or resource was added after the system last ran (or the system is |
is_changed(_self, last_run, this_run) | Returns `true` if the component or resource was added or mutably dereferenced after the system last |
new(change_tick) | Creates a new instance with the same change tick for `added` and `changed`. |
set_changed(_self, change_tick) | Manually sets the change tick. This is normally done automatically via the [`DerefMut`](std::ops::DerefMut) implementation on [`Mut |
clone
No Documentation 🚧
Arguments
- _self :
ComponentTicks
- No Documentation 🚧
Returns
- arg0 :
ComponentTicks
- No Documentation 🚧
is_added
Returns
true
if the component or resource was added after the system last ran (or the system is running for the first time).
Arguments
- _self :
ComponentTicks
- No Documentation 🚧 - last_run :
Tick
- No Documentation 🚧 - this_run :
Tick
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_changed
Returns
true
if the component or resource was added or mutably dereferenced after the system last ran (or the system is running for the first time).
Arguments
- _self :
ComponentTicks
- No Documentation 🚧 - last_run :
Tick
- No Documentation 🚧 - this_run :
Tick
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Creates a new instance with the same change tick for
added
andchanged
.
Arguments
- change_tick :
Tick
- No Documentation 🚧
Returns
- arg0 :
ComponentTicks
- No Documentation 🚧
set_changed
Manually sets the change tick. This is normally done automatically via the
DerefMut
implementation onMut<T>
,ResMut<T>
, etc. However, components and resources that make use of interior mutability might require manual updates.Example
# use bevy_ecs::{world::World, component::ComponentTicks}; let world: World = unimplemented!(); let component_ticks: ComponentTicks = unimplemented!(); component_ticks.set_changed(world.read_change_tick());
Arguments
- _self :
ComponentTicks
- No Documentation 🚧 - change_tick :
Tick
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
Tick
Tick
- tick : u32
Description
A value that tracks when a system ran relative to other systems. This is used to power change detection.
Note that a system that hasn't been run yet has a
Tick
of 0.
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
get(_self) | Gets the value of this change tick. |
is_newer_than(_self, last_run, this_run) | Returns `true` if this `Tick` occurred since the system's `last_run`. `this_run` is the current ti |
new(tick) | Creates a new [`Tick`] wrapping the given value. |
set(_self, tick) | Sets the value of this change tick. |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
Tick
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Tick
- No Documentation 🚧
Returns
- arg0 :
Tick
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Tick
- No Documentation 🚧 - other :
Tick
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
get
Gets the value of this change tick.
Arguments
- _self :
Tick
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
is_newer_than
Returns
true
if thisTick
occurred since the system'slast_run
.this_run
is the current tick of the system, used as a reference to help deal with wraparound.
Arguments
- _self :
Tick
- No Documentation 🚧 - last_run :
Tick
- No Documentation 🚧 - this_run :
Tick
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Creates a new [
Tick
] wrapping the given value.
Arguments
- tick :
u32
- No Documentation 🚧
Returns
- arg0 :
Tick
- No Documentation 🚧
set
Sets the value of this change tick.
Arguments
- _self :
Tick
- No Documentation 🚧 - tick :
u32
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
Entity
Opaque Type. 🔒
Description
Lightweight identifier of an entity.
The identifier is implemented using a generational index: a combination of an index and a generation. This allows fast insertion after data removal in an array while minimizing loss of spatial locality.
These identifiers are only valid on the
World
it's sourced from. Attempting to use anEntity
to fetch entity components or metadata from a different world will either fail or return unexpected results.Stability warning
For all intents and purposes,
Entity
should be treated as an opaque identifier. The internal bit representation is liable to change from release to release as are the behaviors or performance characteristics of any of its trait implementations (i.e.Ord
,Hash
, etc.). This means that changes inEntity
's representation, though made readable through various functions on the type, are not considered breaking changes under SemVer.In particular, directly serializing with
Serialize
andDeserialize
make zero guarantee of long term wire format compatibility. Changes in behavior will cause serializedEntity
values persisted to long term storage (i.e. disk, databases, etc.) will fail to deserialize upon being updated.Usage
This data type is returned by iterating a
Query
that hasEntity
as part of its query fetch type parameter (learn more). It can also be obtained by callingEntityCommands::id
orEntityWorldMut::id
.# use bevy_ecs::prelude::*; # #[derive(Component)] # struct SomeComponent; fn setup(mut commands: Commands) { // Calling `spawn` returns `EntityCommands`. let entity = commands.spawn(SomeComponent).id(); } fn exclusive_system(world: &mut World) { // Calling `spawn` returns `EntityWorldMut`. let entity = world.spawn(SomeComponent).id(); } # # bevy_ecs::system::assert_is_system(setup); # bevy_ecs::system::assert_is_system(exclusive_system);
It can be used to refer to a specific entity to apply
EntityCommands
, or to callQuery::get
(or similar methods) to access its components.# use bevy_ecs::prelude::*; # # #[derive(Component)] # struct Expired; # fn dispose_expired_food(mut commands: Commands, query: Query<Entity, With<Expired>>) { for food_entity in &query { commands.entity(food_entity).despawn(); } } # # bevy_ecs::system::assert_is_system(dispose_expired_food);
Functions
clone
No Documentation 🚧
Arguments
- _self :
Entity
- No Documentation 🚧
Returns
- arg0 :
Entity
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Entity
- No Documentation 🚧 - other :
Entity
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_bits
Reconstruct an
Entity
previously destructured with [Entity::to_bits
]. Only useful when applied to results fromto_bits
in the same instance of an application.Panics
This method will likely panic if given
u64
values that did not come from [Entity::to_bits
].
Arguments
- bits :
u64
- No Documentation 🚧
Returns
- arg0 :
Entity
- No Documentation 🚧
from_raw
Creates a new entity ID with the specified
index
and a generation of 1.Note
Spawning a specific
entity
value is rarely the right choice. Most apps should favorCommands::spawn
. This method should generally only be used for sharing entities across apps, and only when they have a scheme worked out to share an index space (which doesn't happen by default). In general, one should not try to synchronize the ECS by attempting to ensure thatEntity
lines up between instances, but instead insert a secondary identifier as a component.
Arguments
- index :
u32
- No Documentation 🚧
Returns
- arg0 :
Entity
- No Documentation 🚧
generation
Returns the generation of this Entity's index. The generation is incremented each time an entity with a given index is despawned. This serves as a "count" of the number of times a given index has been reused (index, generation) pairs uniquely identify a given Entity.
Arguments
- _self :
Entity
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
index
Return a transiently unique identifier. No two simultaneously-live entities share the same index, but dead entities' indices may collide with both live and dead entities. Useful for compactly representing entities within a specific snapshot of the world, such as when serializing.
Arguments
- _self :
Entity
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
to_bits
Convert to a form convenient for passing outside of rust. Only useful for identifying entities within the same instance of an application. Do not use for serialization between runs. No particular structure is guaranteed for the returned bits.
Arguments
- _self :
Entity
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
EntityHash
EntityHash
Description
A [
BuildHasher
] that results in a [EntityHasher
].
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
EntityHash
- No Documentation 🚧
Returns
- arg0 :
EntityHash
- No Documentation 🚧
Identifier
Opaque Type. 🔒
Description
A unified identifier for all entity and similar IDs.
Has the same size as a
u64
integer, but the layout is split between a 32-bit low segment, a 31-bit high segment, and the significant bit reserved as type flags to denote entity kinds.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
from_bits(value) | Convert a `u64` into an [`Identifier`]. # Panics This method will likely panic if given `u64` values that did not come from [`Identifier::to_bits`] |
low(_self) | Returns the value of the low segment of the [`Identifier`]. |
masked_high(_self) | Returns the masked value of the high segment of the [`Identifier`]. Does not include the flag bits. |
to_bits(_self) | Convert the [`Identifier`] into a `u64`. |
clone
No Documentation 🚧
Arguments
- _self :
Identifier
- No Documentation 🚧
Returns
- arg0 :
Identifier
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Identifier
- No Documentation 🚧 - other :
Identifier
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_bits
Convert a
u64
into an [Identifier
].Panics
This method will likely panic if given
u64
values that did not come from [Identifier::to_bits
].
Arguments
- value :
u64
- No Documentation 🚧
Returns
- arg0 :
Identifier
- No Documentation 🚧
low
Returns the value of the low segment of the [
Identifier
].
Arguments
- _self :
Identifier
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
masked_high
Returns the masked value of the high segment of the [
Identifier
]. Does not include the flag bits.
Arguments
- _self :
Identifier
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
to_bits
Convert the [
Identifier
] into au64
.
Arguments
- _self :
Identifier
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
RemovedComponentEntity
RemovedComponentEntity
- bevy_ecs::entity::Entity
Description
Wrapper around [
Entity
] for [RemovedComponents
]. Internally,RemovedComponents
uses these as anEvents<RemovedComponentEntity>
.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
RemovedComponentEntity
- No Documentation 🚧
Returns
- arg0 :
RemovedComponentEntity
- No Documentation 🚧
SystemIdMarker
SystemIdMarker
Description
Marker
Component
for identifying [SystemId
] [Entity
]s.
Functions
OnAdd
OnAdd
Description
Trigger emitted when a component is added to an entity. See [
crate::component::ComponentHooks::on_add
] for more information.
Functions
OnInsert
OnInsert
Description
Trigger emitted when a component is inserted onto an entity. See [
crate::component::ComponentHooks::on_insert
] for more information.
Functions
OnRemove
OnRemove
Description
Trigger emitted when a component is removed from an entity. See [
crate::component::ComponentHooks::on_remove
] for more information.
Functions
OnReplace
OnReplace
Description
Trigger emitted when a component is replaced on an entity. See [
crate::component::ComponentHooks::on_replace
] for more information.
Functions
Children
Children
- smallvec::SmallVec<[bevy_ecs::entity::Entity; 8]>
Description
Contains references to the child entities of this entity.
Each child must contain a
Parent
component that points back to this entity. This component rarely needs to be created manually, consider using higher level utilities likeBuildChildren::with_children
which are safer and easier to use.See
HierarchyQueryExt
for hierarchy related methods onQuery
.
Functions
Function | Summary |
---|---|
swap(_self, a_index, b_index) | Swaps the child at `a_index` with the child at `b_index`. |
swap
Swaps the child at
a_index
with the child atb_index
.
Arguments
- _self :
Children
- No Documentation 🚧 - a_index :
usize
- No Documentation 🚧 - b_index :
usize
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
Parent
Parent
- bevy_ecs::entity::Entity
Description
Holds a reference to the parent entity of this entity. This component should only be present on entities that actually have a parent entity.
Parent entity must have this entity stored in its
Children
component. It is hard to set up parent/child relationships manually, consider using higher level utilities likeBuildChildren::with_children
.See
HierarchyQueryExt
for hierarchy related methods onQuery
.
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
get(_self) | Gets the [`Entity`] ID of the parent. |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
Parent
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Parent
- No Documentation 🚧 - other :
Parent
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
get
Gets the [
Entity
] ID of the parent.
Arguments
- _self :
Parent
- No Documentation 🚧
Returns
- arg0 :
Entity
- No Documentation 🚧
HierarchyEvent
ChildAdded
- child : bevy_ecs::entity::Entity
- parent : bevy_ecs::entity::Entity
ChildRemoved
- child : bevy_ecs::entity::Entity
- parent : bevy_ecs::entity::Entity
ChildMoved
- child : bevy_ecs::entity::Entity
- previous_parent : bevy_ecs::entity::Entity
- new_parent : bevy_ecs::entity::Entity
Description
An
Event
that is fired whenever there is a change in the world's hierarchy.
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
HierarchyEvent
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
HierarchyEvent
- No Documentation 🚧
Returns
- arg0 :
HierarchyEvent
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
HierarchyEvent
- No Documentation 🚧 - other :
HierarchyEvent
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
ButtonState
Pressed
Released
Description
The current "press" state of an element
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
is_pressed(_self) | Is this button pressed? |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
ButtonState
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
ButtonState
- No Documentation 🚧
Returns
- arg0 :
ButtonState
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
ButtonState
- No Documentation 🚧 - other :
ButtonState
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_pressed
Is this button pressed?
Arguments
- _self :
ButtonState
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
Axis
Axis
- axis_data : bevy_utils::hashbrown::HashMap<bevy_input::gamepad::GamepadInput, f32, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>
Description
Stores the position data of the input devices of type
T
.The values are stored as
f32
s, using [Axis::set
]. Use [Axis::get
] to retrieve the value clamped between [Axis::MIN
] and [Axis::MAX
] inclusive, or unclamped using [Axis::get_unclamped
].
Functions
ButtonInput
ButtonInput
- pressed : bevy_utils::hashbrown::HashSet<bevy_input::gamepad::GamepadButton, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>
- just_pressed : bevy_utils::hashbrown::HashSet<bevy_input::gamepad::GamepadButton, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>
- just_released : bevy_utils::hashbrown::HashSet<bevy_input::gamepad::GamepadButton, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>
Description
A "press-able" input of type
T
.Usage
This type can be used as a resource to keep the current state of an input, by reacting to events from the input. For a given input value:
- [
ButtonInput::pressed
] will returntrue
between a press and a release event.- [
ButtonInput::just_pressed
] will returntrue
for one frame after a press event.- [
ButtonInput::just_released
] will returntrue
for one frame after a release event.Multiple systems
In case multiple systems are checking for [
ButtonInput::just_pressed
] or [ButtonInput::just_released
] but only one should react, for example when modifying a [Resource
], you should consider clearing the input state, either by:
- Using [
ButtonInput::clear_just_pressed
] or [ButtonInput::clear_just_released
] instead.- Calling [
ButtonInput::clear
] or [ButtonInput::reset
] immediately after the state change.Performance
For all operations, the following conventions are used:
- n is the number of stored inputs.
- m is the number of input arguments passed to the method.
- *-suffix denotes an amortized cost.
- ~-suffix denotes an expected cost.
See Rust's std::collections doc on performance for more details on the conventions used here.
[ ButtonInput
] operationsComputational complexity [ ButtonInput::any_just_pressed
]O(m)~ [ ButtonInput::any_just_released
]O(m)~ [ ButtonInput::any_pressed
]O(m)~ [ ButtonInput::get_just_pressed
]O(n) [ ButtonInput::get_just_released
]O(n) [ ButtonInput::get_pressed
]O(n) [ ButtonInput::just_pressed
]O(1)~ [ ButtonInput::just_released
]O(1)~ [ ButtonInput::pressed
]O(1)~ [ ButtonInput::press
]O(1)~* [ ButtonInput::release
]O(1)~* [ ButtonInput::release_all
]O(n)~* [ ButtonInput::clear_just_pressed
]O(1)~ [ ButtonInput::clear_just_released
]O(1)~ [ ButtonInput::reset_all
]O(n) [ ButtonInput::clear
]O(n) Window focus
ButtonInput<KeyCode>
is tied to window focus. For example, if the user holds a button while the window loses focus, [ButtonInput::just_released
] will be triggered. Similarly if the window regains focus, [ButtonInput::just_pressed
] will be triggered.
ButtonInput<GamepadButton>
is independent of window focus.Examples
Reading and checking against the current set of pressed buttons:
# use bevy_app::{App, NoopPluginGroup as DefaultPlugins, Update}; # use bevy_ecs::{prelude::{IntoSystemConfigs, Res, Resource, resource_changed}, schedule::Condition}; # use bevy_input::{ButtonInput, prelude::{KeyCode, MouseButton}}; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems( Update, print_mouse.run_if(resource_changed::<ButtonInput<MouseButton>>), ) .add_systems( Update, print_keyboard.run_if(resource_changed::<ButtonInput<KeyCode>>), ) .run(); } fn print_mouse(mouse: Res<ButtonInput<MouseButton>>) { println!("Mouse: {:?}", mouse.get_pressed().collect::<Vec<_>>()); } fn print_keyboard(keyboard: Res<ButtonInput<KeyCode>>) { if keyboard.any_pressed([KeyCode::ControlLeft, KeyCode::ControlRight]) && keyboard.any_pressed([KeyCode::AltLeft, KeyCode::AltRight]) && keyboard.any_pressed([KeyCode::ShiftLeft, KeyCode::ShiftRight]) && keyboard.any_pressed([KeyCode::SuperLeft, KeyCode::SuperRight]) && keyboard.pressed(KeyCode::KeyL) { println!("On Windows this opens LinkedIn."); } else { println!("keyboard: {:?}", keyboard.get_pressed().collect::<Vec<_>>()); } }
Note
When adding this resource for a new input type, you should:
- Call the [
ButtonInput::press
] method for each press event.- Call the [
ButtonInput::release
] method for each release event.- Call the [
ButtonInput::clear
] method at each frame start, before processing events.Note: Calling
clear
from aResMut
will trigger change detection. It may be preferable to useDetectChangesMut::bypass_change_detection
to avoid causing the resource to always be marked as changed.
Functions
AxisSettings
AxisSettings
- livezone_upperbound : f32
- deadzone_upperbound : f32
- deadzone_lowerbound : f32
- livezone_lowerbound : f32
- threshold : f32
Description
Settings for a [
GamepadAxis
].It is used inside the [
GamepadSettings
] to define the sensitivity range and threshold for an axis. Values that are higher thanlivezone_upperbound
will be rounded up to 1.0. Values that are lower thanlivezone_lowerbound
will be rounded down to -1.0. Values that are in-betweendeadzone_lowerbound
anddeadzone_upperbound
will be rounded to 0.0. Otherwise, values will not be rounded.The valid range is
[-1.0, 1.0]
.
Functions
clamp
Clamps the
raw_value
according to theAxisSettings
.
Arguments
- _self :
AxisSettings
- No Documentation 🚧 - new_value :
f32
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
AxisSettings
- No Documentation 🚧
Returns
- arg0 :
AxisSettings
- No Documentation 🚧
deadzone_lowerbound
Get the value above which inputs will be rounded up to 0.0.
Arguments
- _self :
AxisSettings
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
deadzone_upperbound
Get the value below which positive inputs will be rounded down to 0.0.
Arguments
- _self :
AxisSettings
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
AxisSettings
- No Documentation 🚧 - other :
AxisSettings
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
filter
Filters the
new_value
based on theold_value
, according to the [AxisSettings
]. Returns the clampednew_value
if the change exceeds the settings threshold, andNone
otherwise.
Arguments
- _self :
AxisSettings
- No Documentation 🚧 - new_value :
f32
- No Documentation 🚧 - old_value :
Optional<f32>
- No Documentation 🚧
Returns
- arg0 :
Optional<f32>
- No Documentation 🚧
livezone_lowerbound
Get the value below which negative inputs will be rounded down to -1.0.
Arguments
- _self :
AxisSettings
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
livezone_upperbound
Get the value above which inputs will be rounded up to 1.0.
Arguments
- _self :
AxisSettings
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
set_deadzone_lowerbound
Try to set the value above which inputs will be rounded up to 0.0. If the value passed is less than -1.0 or less than
livezone_lowerbound
, the value will not be changed. Returns the new value ofdeadzone_lowerbound
.
Arguments
- _self :
AxisSettings
- No Documentation 🚧 - value :
f32
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
set_deadzone_upperbound
Try to set the value below which positive inputs will be rounded down to 0.0. If the value passed is negative or greater than
livezone_upperbound
, the value will not be changed. Returns the new value ofdeadzone_upperbound
.
Arguments
- _self :
AxisSettings
- No Documentation 🚧 - value :
f32
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
set_livezone_lowerbound
Try to set the value below which negative inputs will be rounded down to -1.0. If the value passed is positive or greater than
deadzone_lowerbound
, the value will not be changed. Returns the new value oflivezone_lowerbound
.
Arguments
- _self :
AxisSettings
- No Documentation 🚧 - value :
f32
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
set_livezone_upperbound
Try to set the value above which inputs will be rounded up to 1.0. If the value passed is negative or less than
deadzone_upperbound
, the value will not be changed. Returns the new value oflivezone_upperbound
.
Arguments
- _self :
AxisSettings
- No Documentation 🚧 - value :
f32
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
set_threshold
Try to set the minimum value by which input must change before the changes will be applied. If the value passed is not within [0.0..=2.0], the value will not be changed. Returns the new value of threshold.
Arguments
- _self :
AxisSettings
- No Documentation 🚧 - value :
f32
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
threshold
Get the minimum value by which input must change before the change is registered.
Arguments
- _self :
AxisSettings
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
ButtonAxisSettings
ButtonAxisSettings
- high : f32
- low : f32
- threshold : f32
Description
Settings for a [
GamepadButton
].It is used inside the [
GamepadSettings
] to define the sensitivity range and threshold for a button axis.Logic
- Values that are higher than or equal to
high
will be rounded to 1.0.- Values that are lower than or equal to
low
will be rounded to 0.0.- Otherwise, values will not be rounded.
The valid range is from 0.0 to 1.0, inclusive.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
filter(_self, new_value, old_value) | Filters the `new_value` based on the `old_value`, according to the [`ButtonAxisSettings`]. Returns the clamped `new_value`, according to the [`ButtonAxisSettings`] |
clone
No Documentation 🚧
Arguments
- _self :
ButtonAxisSettings
- No Documentation 🚧
Returns
- arg0 :
ButtonAxisSettings
- No Documentation 🚧
filter
Filters the
new_value
based on theold_value
, according to the [ButtonAxisSettings
]. Returns the clampednew_value
, according to the [ButtonAxisSettings
], if the change exceeds the settings threshold, andNone
otherwise.
Arguments
- _self :
ButtonAxisSettings
- No Documentation 🚧 - new_value :
f32
- No Documentation 🚧 - old_value :
Optional<f32>
- No Documentation 🚧
Returns
- arg0 :
Optional<f32>
- No Documentation 🚧
ButtonSettings
ButtonSettings
- press_threshold : f32
- release_threshold : f32
Description
Manages settings for gamepad buttons.
It is used inside [
GamepadSettings
] to define the threshold for a [GamepadButton
] to be considered pressed or released. A button is considered pressed if thepress_threshold
value is surpassed and released if therelease_threshold
value is undercut.Allowed values:
0.0 <= ``release_threshold`` <= ``press_threshold`` <= 1.0
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
is_pressed(_self, value) | Returns `true` if the button is pressed. A button is considered pressed if the `value` passed is g |
is_released(_self, value) | Returns `true` if the button is released. A button is considered released if the `value` passed is |
press_threshold(_self) | Get the button input threshold above which the button is considered pressed. |
release_threshold(_self) | Get the button input threshold below which the button is considered released. |
set_press_threshold(_self, value) | Try to set the button input threshold above which the button is considered pressed. If the value p |
set_release_threshold(_self, value) | Try to set the button input threshold below which the button is considered released. If the value |
clone
No Documentation 🚧
Arguments
- _self :
ButtonSettings
- No Documentation 🚧
Returns
- arg0 :
ButtonSettings
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
ButtonSettings
- No Documentation 🚧 - other :
ButtonSettings
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_pressed
Returns
true
if the button is pressed. A button is considered pressed if thevalue
passed is greater than or equal to the press threshold.
Arguments
- _self :
ButtonSettings
- No Documentation 🚧 - value :
f32
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_released
Returns
true
if the button is released. A button is considered released if thevalue
passed is lower than or equal to the release threshold.
Arguments
- _self :
ButtonSettings
- No Documentation 🚧 - value :
f32
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
press_threshold
Get the button input threshold above which the button is considered pressed.
Arguments
- _self :
ButtonSettings
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
release_threshold
Get the button input threshold below which the button is considered released.
Arguments
- _self :
ButtonSettings
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
set_press_threshold
Try to set the button input threshold above which the button is considered pressed. If the value passed is outside the range [release threshold..=1.0], the value will not be changed. Returns the new value of the press threshold.
Arguments
- _self :
ButtonSettings
- No Documentation 🚧 - value :
f32
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
set_release_threshold
Try to set the button input threshold below which the button is considered released. If the value passed is outside the range [0.0..=press threshold], the value will not be changed. Returns the new value of the release threshold.
Arguments
- _self :
ButtonSettings
- No Documentation 🚧 - value :
f32
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
Gamepad
Gamepad
- vendor_id : core::option::Option
- product_id : core::option::Option
- digital : bevy_input::button_input::ButtonInput<bevy_input::gamepad::GamepadButton>
- analog : bevy_input::axis::Axis<bevy_input::gamepad::GamepadInput>
Description
Stores a connected gamepad's metadata such as the name and its [
GamepadButton
] and [GamepadAxis
].An entity with this component is spawned automatically after [
GamepadConnectionEvent
] and updated by [gamepad_event_processing_system
].See also [
GamepadSettings
] for configuration.Examples
# use bevy_input::gamepad::{Gamepad, GamepadAxis, GamepadButton}; # use bevy_ecs::system::Query; # use bevy_core::Name; # fn gamepad_usage_system(gamepads: Query<(&Name, &Gamepad)>) { for (name, gamepad) in &gamepads { println!("{name}"); if gamepad.just_pressed(GamepadButton::North) { println!("{} just pressed North", name) } if let Some(left_stick_x) = gamepad.get(GamepadAxis::LeftStickX) { println!("left stick X: {}", left_stick_x) } } }
Functions
Function | Summary |
---|---|
dpad(_self) | Returns the directional pad as a [`Vec2`] |
just_pressed(_self, button_type) | Returns `true` if the [`GamepadButton`] has been pressed during the current frame. Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`] |
just_released(_self, button_type) | Returns `true` if the [`GamepadButton`] has been released during the current frame. Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`] |
left_stick(_self) | Returns the left stick as a [`Vec2`] |
pressed(_self, button_type) | Returns `true` if the [`GamepadButton`] has been pressed. |
product_id(_self) | Returns the USB product ID as assigned by the [vendor], if available. [vendor]: Self::vendor_id |
right_stick(_self) | Returns the right stick as a [`Vec2`] |
vendor_id(_self) | Returns the USB vendor ID as assigned by the USB-IF, if available. |
dpad
Returns the directional pad as a [
Vec2
]
Arguments
- _self :
Gamepad
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
just_pressed
Returns
true
if the [GamepadButton
] has been pressed during the current frame. Note: This function does not imply information regarding the current state of [ButtonInput::pressed
] or [ButtonInput::just_released
].
Arguments
- _self :
Gamepad
- No Documentation 🚧 - button_type :
GamepadButton
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
just_released
Returns
true
if the [GamepadButton
] has been released during the current frame. Note: This function does not imply information regarding the current state of [ButtonInput::pressed
] or [ButtonInput::just_pressed
].
Arguments
- _self :
Gamepad
- No Documentation 🚧 - button_type :
GamepadButton
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
left_stick
Returns the left stick as a [
Vec2
]
Arguments
- _self :
Gamepad
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
pressed
Returns
true
if the [GamepadButton
] has been pressed.
Arguments
- _self :
Gamepad
- No Documentation 🚧 - button_type :
GamepadButton
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
product_id
Returns the USB product ID as assigned by the [vendor], if available. [vendor]: Self::vendor_id
Arguments
- _self :
Gamepad
- No Documentation 🚧
Returns
- arg0 :
Optional<u16>
- No Documentation 🚧
right_stick
Returns the right stick as a [
Vec2
]
Arguments
- _self :
Gamepad
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
vendor_id
Returns the USB vendor ID as assigned by the USB-IF, if available.
Arguments
- _self :
Gamepad
- No Documentation 🚧
Returns
- arg0 :
Optional<u16>
- No Documentation 🚧
GamepadAxis
LeftStickX
LeftStickY
LeftZ
RightStickX
RightStickY
RightZ
Other
- u8
Description
Represents gamepad input types that are mapped in the range [-1.0, 1.0]
Usage
This is used to determine which axis has changed its value when receiving a gamepad axis event. It is also used in the [
Gamepad
] component.
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
GamepadAxis
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
GamepadAxis
- No Documentation 🚧
Returns
- arg0 :
GamepadAxis
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
GamepadAxis
- No Documentation 🚧 - other :
GamepadAxis
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
GamepadAxisChangedEvent
GamepadAxisChangedEvent
- entity : bevy_ecs::entity::Entity
- axis : bevy_input::gamepad::GamepadAxis
- value : f32
Description
[
GamepadAxis
] event triggered by an analog state change
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
new(entity, axis, value) | Creates a new [`GamepadAxisChangedEvent`] |
clone
No Documentation 🚧
Arguments
- _self :
GamepadAxisChangedEvent
- No Documentation 🚧
Returns
- arg0 :
GamepadAxisChangedEvent
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
GamepadAxisChangedEvent
- No Documentation 🚧 - other :
GamepadAxisChangedEvent
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Creates a new [
GamepadAxisChangedEvent
]
Arguments
- entity :
Entity
- No Documentation 🚧 - axis :
GamepadAxis
- No Documentation 🚧 - value :
f32
- No Documentation 🚧
Returns
- arg0 :
GamepadAxisChangedEvent
- No Documentation 🚧
GamepadButton
South
East
North
West
C
Z
LeftTrigger
LeftTrigger2
RightTrigger
RightTrigger2
Select
Start
Mode
LeftThumb
RightThumb
DPadUp
DPadDown
DPadLeft
DPadRight
Other
- u8
Description
Represents gamepad input types that are mapped in the range [0.0, 1.0].
Usage
This is used to determine which button has changed its value when receiving gamepad button events It is also used in the [
Gamepad
] component.
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
GamepadButton
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
GamepadButton
- No Documentation 🚧
Returns
- arg0 :
GamepadButton
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
GamepadButton
- No Documentation 🚧 - other :
GamepadButton
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
GamepadButtonChangedEvent
GamepadButtonChangedEvent
- entity : bevy_ecs::entity::Entity
- button : bevy_input::gamepad::GamepadButton
- state : bevy_input::ButtonState
- value : f32
Description
[
GamepadButton
] event triggered by an analog state change
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
new(entity, button, state, value) | Creates a new [`GamepadButtonChangedEvent`] |
clone
No Documentation 🚧
Arguments
- _self :
GamepadButtonChangedEvent
- No Documentation 🚧
Returns
- arg0 :
GamepadButtonChangedEvent
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
GamepadButtonChangedEvent
- No Documentation 🚧 - other :
GamepadButtonChangedEvent
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Creates a new [
GamepadButtonChangedEvent
]
Arguments
- entity :
Entity
- No Documentation 🚧 - button :
GamepadButton
- No Documentation 🚧 - state :
ButtonState
- No Documentation 🚧 - value :
f32
- No Documentation 🚧
Returns
- arg0 :
GamepadButtonChangedEvent
- No Documentation 🚧
GamepadButtonStateChangedEvent
GamepadButtonStateChangedEvent
- entity : bevy_ecs::entity::Entity
- button : bevy_input::gamepad::GamepadButton
- state : bevy_input::ButtonState
Description
[
GamepadButton
] event triggered by a digital state change
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
new(entity, button, state) | Creates a new [`GamepadButtonStateChangedEvent`] |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
GamepadButtonStateChangedEvent
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
GamepadButtonStateChangedEvent
- No Documentation 🚧
Returns
- arg0 :
GamepadButtonStateChangedEvent
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
GamepadButtonStateChangedEvent
- No Documentation 🚧 - other :
GamepadButtonStateChangedEvent
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Creates a new [
GamepadButtonStateChangedEvent
]
Arguments
- entity :
Entity
- No Documentation 🚧 - button :
GamepadButton
- No Documentation 🚧 - state :
ButtonState
- No Documentation 🚧
Returns
- arg0 :
GamepadButtonStateChangedEvent
- No Documentation 🚧
GamepadConnection
Connected
- name : String
- vendor_id : core::option::Option
- product_id : core::option::Option
Disconnected
Description
The connection status of a gamepad.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
GamepadConnection
- No Documentation 🚧
Returns
- arg0 :
GamepadConnection
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
GamepadConnection
- No Documentation 🚧 - other :
GamepadConnection
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
GamepadConnectionEvent
GamepadConnectionEvent
- gamepad : bevy_ecs::entity::Entity
- connection : bevy_input::gamepad::GamepadConnection
Description
A Gamepad connection event. Created when a connection to a gamepad is established and when a gamepad is disconnected.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
connected(_self) | Is the gamepad connected? |
disconnected(_self) | Is the gamepad disconnected? |
eq(_self, other) | No Documentation 🚧 |
new(gamepad, connection) | Creates a [`GamepadConnectionEvent`]. |
clone
No Documentation 🚧
Arguments
- _self :
GamepadConnectionEvent
- No Documentation 🚧
Returns
- arg0 :
GamepadConnectionEvent
- No Documentation 🚧
connected
Is the gamepad connected?
Arguments
- _self :
GamepadConnectionEvent
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
disconnected
Is the gamepad disconnected?
Arguments
- _self :
GamepadConnectionEvent
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
GamepadConnectionEvent
- No Documentation 🚧 - other :
GamepadConnectionEvent
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Creates a [
GamepadConnectionEvent
].
Arguments
- gamepad :
Entity
- No Documentation 🚧 - connection :
GamepadConnection
- No Documentation 🚧
Returns
- arg0 :
GamepadConnectionEvent
- No Documentation 🚧
GamepadEvent
Connection
- bevy_input::gamepad::GamepadConnectionEvent
Button
- bevy_input::gamepad::GamepadButtonChangedEvent
Axis
- bevy_input::gamepad::GamepadAxisChangedEvent
Description
A gamepad event.
This event type is used over the [
GamepadConnectionEvent
], [GamepadButtonChangedEvent
] and [GamepadAxisChangedEvent
] when the in-frame relative ordering of events is important.This event is produced by
bevy_input
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
GamepadEvent
- No Documentation 🚧
Returns
- arg0 :
GamepadEvent
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
GamepadEvent
- No Documentation 🚧 - other :
GamepadEvent
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
GamepadInput
Axis
- bevy_input::gamepad::GamepadAxis
Button
- bevy_input::gamepad::GamepadButton
Description
Encapsulation over [
GamepadAxis
] and [GamepadButton
]
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
GamepadInput
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
GamepadInput
- No Documentation 🚧
Returns
- arg0 :
GamepadInput
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
GamepadInput
- No Documentation 🚧 - other :
GamepadInput
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
GamepadRumbleIntensity
GamepadRumbleIntensity
- strong_motor : f32
- weak_motor : f32
Description
The intensity at which a gamepad's force-feedback motors may rumble.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
strong_motor(intensity) | Creates a new rumble intensity with strong motor intensity set to the given value. Clamped within |
weak_motor(intensity) | Creates a new rumble intensity with weak motor intensity set to the given value. Clamped within th |
clone
No Documentation 🚧
Arguments
- _self :
GamepadRumbleIntensity
- No Documentation 🚧
Returns
- arg0 :
GamepadRumbleIntensity
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
GamepadRumbleIntensity
- No Documentation 🚧 - other :
GamepadRumbleIntensity
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
strong_motor
Creates a new rumble intensity with strong motor intensity set to the given value. Clamped within the
0.0
to1.0
range.
Arguments
- intensity :
f32
- No Documentation 🚧
Returns
- arg0 :
GamepadRumbleIntensity
- No Documentation 🚧
weak_motor
Creates a new rumble intensity with weak motor intensity set to the given value. Clamped within the
0.0
to1.0
range.
Arguments
- intensity :
f32
- No Documentation 🚧
Returns
- arg0 :
GamepadRumbleIntensity
- No Documentation 🚧
GamepadRumbleRequest
Add
- duration : bevy_utils::Duration
- intensity : bevy_input::gamepad::GamepadRumbleIntensity
- gamepad : bevy_ecs::entity::Entity
Stop
- gamepad : bevy_ecs::entity::Entity
Description
An event that controls force-feedback rumbling of a [
Gamepad
]entity
.Notes
Does nothing if the gamepad or platform does not support rumble.
Example
# use bevy_input::gamepad::{Gamepad, GamepadRumbleRequest, GamepadRumbleIntensity}; # use bevy_ecs::prelude::{EventWriter, Res, Query, Entity, With}; # use bevy_utils::Duration; fn rumble_gamepad_system( mut rumble_requests: EventWriter<GamepadRumbleRequest>, gamepads: Query<Entity, With<Gamepad>>, ) { for entity in gamepads.iter() { rumble_requests.send(GamepadRumbleRequest::Add { gamepad: entity, intensity: GamepadRumbleIntensity::MAX, duration: Duration::from_secs_f32(0.5), }); } }
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
gamepad(_self) | Get the [`Entity`] associated with this request. |
clone
No Documentation 🚧
Arguments
- _self :
GamepadRumbleRequest
- No Documentation 🚧
Returns
- arg0 :
GamepadRumbleRequest
- No Documentation 🚧
gamepad
Get the [
Entity
] associated with this request.
Arguments
- _self :
GamepadRumbleRequest
- No Documentation 🚧
Returns
- arg0 :
Entity
- No Documentation 🚧
GamepadSettings
GamepadSettings
- default_button_settings : bevy_input::gamepad::ButtonSettings
- default_axis_settings : bevy_input::gamepad::AxisSettings
- default_button_axis_settings : bevy_input::gamepad::ButtonAxisSettings
- button_settings : bevy_utils::hashbrown::HashMap<bevy_input::gamepad::GamepadButton, bevy_input::gamepad::ButtonSettings, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>
- axis_settings : bevy_utils::hashbrown::HashMap<bevy_input::gamepad::GamepadAxis, bevy_input::gamepad::AxisSettings, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>
- button_axis_settings : bevy_utils::hashbrown::HashMap<bevy_input::gamepad::GamepadButton, bevy_input::gamepad::ButtonAxisSettings, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>
Description
Gamepad settings component.
Usage
It is used to create a
bevy
component that stores the settings of [GamepadButton
] and [GamepadAxis
] in [Gamepad
]. If no user defined [ButtonSettings
], [AxisSettings
], or [ButtonAxisSettings
] are defined, the default settings of each are used as a fallback accordingly.Note
The [
GamepadSettings
] are used to determine when raw gamepad events should register. Events that don't meet the change thresholds defined in [GamepadSettings
] will not register. To modify these settings, mutate the corresponding component.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
GamepadSettings
- No Documentation 🚧
Returns
- arg0 :
GamepadSettings
- No Documentation 🚧
RawGamepadAxisChangedEvent
RawGamepadAxisChangedEvent
- gamepad : bevy_ecs::entity::Entity
- axis : bevy_input::gamepad::GamepadAxis
- value : f32
Description
[
GamepadAxis
] changed event unfiltered by [GamepadSettings
]
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
new(gamepad, axis_type, value) | Creates a [`RawGamepadAxisChangedEvent`]. |
clone
No Documentation 🚧
Arguments
- _self :
RawGamepadAxisChangedEvent
- No Documentation 🚧
Returns
- arg0 :
RawGamepadAxisChangedEvent
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
RawGamepadAxisChangedEvent
- No Documentation 🚧 - other :
RawGamepadAxisChangedEvent
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Creates a [
RawGamepadAxisChangedEvent
].
Arguments
- gamepad :
Entity
- No Documentation 🚧 - axis_type :
GamepadAxis
- No Documentation 🚧 - value :
f32
- No Documentation 🚧
Returns
- arg0 :
RawGamepadAxisChangedEvent
- No Documentation 🚧
RawGamepadButtonChangedEvent
RawGamepadButtonChangedEvent
- gamepad : bevy_ecs::entity::Entity
- button : bevy_input::gamepad::GamepadButton
- value : f32
Description
[
GamepadButton
] changed event unfiltered by [GamepadSettings
]
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
new(gamepad, button_type, value) | Creates a [`RawGamepadButtonChangedEvent`]. |
clone
No Documentation 🚧
Arguments
- _self :
RawGamepadButtonChangedEvent
- No Documentation 🚧
Returns
- arg0 :
RawGamepadButtonChangedEvent
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
RawGamepadButtonChangedEvent
- No Documentation 🚧 - other :
RawGamepadButtonChangedEvent
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Creates a [
RawGamepadButtonChangedEvent
].
Arguments
- gamepad :
Entity
- No Documentation 🚧 - button_type :
GamepadButton
- No Documentation 🚧 - value :
f32
- No Documentation 🚧
Returns
- arg0 :
RawGamepadButtonChangedEvent
- No Documentation 🚧
RawGamepadEvent
Connection
- bevy_input::gamepad::GamepadConnectionEvent
Button
- bevy_input::gamepad::RawGamepadButtonChangedEvent
Axis
- bevy_input::gamepad::RawGamepadAxisChangedEvent
Description
A raw gamepad event.
This event type is used over the [
GamepadConnectionEvent
], [RawGamepadButtonChangedEvent
] and [RawGamepadAxisChangedEvent
] when the in-frame relative ordering of events is important.This event type is used by
bevy_input
to feed its components.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
RawGamepadEvent
- No Documentation 🚧
Returns
- arg0 :
RawGamepadEvent
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
RawGamepadEvent
- No Documentation 🚧 - other :
RawGamepadEvent
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
DoubleTapGesture
DoubleTapGesture
Description
Double tap gesture.
Platform-specific
- Only available on
macOS
andiOS
.- On
iOS
, must be enabled first
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
DoubleTapGesture
- No Documentation 🚧
Returns
- arg0 :
DoubleTapGesture
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
DoubleTapGesture
- No Documentation 🚧 - other :
DoubleTapGesture
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
PanGesture
PanGesture
- glam::Vec2
Description
Pan gesture.
Platform-specific
- On
iOS
, must be enabled first
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
PanGesture
- No Documentation 🚧
Returns
- arg0 :
PanGesture
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
PanGesture
- No Documentation 🚧 - other :
PanGesture
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
PinchGesture
PinchGesture
- f32
Description
Two-finger pinch gesture, often used for magnifications.
Positive delta values indicate magnification (zooming in) and negative delta values indicate shrinking (zooming out).
Platform-specific
- Only available on
macOS
andiOS
.- On
iOS
, must be enabled first
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
PinchGesture
- No Documentation 🚧
Returns
- arg0 :
PinchGesture
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
PinchGesture
- No Documentation 🚧 - other :
PinchGesture
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
RotationGesture
RotationGesture
- f32
Description
Two-finger rotation gesture.
Positive delta values indicate rotation counterclockwise and negative delta values indicate rotation clockwise.
Platform-specific
- Only available on
macOS
andiOS
.- On
iOS
, must be enabled first
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
RotationGesture
- No Documentation 🚧
Returns
- arg0 :
RotationGesture
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
RotationGesture
- No Documentation 🚧 - other :
RotationGesture
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
Key
Character
- smol_str::SmolStr
Unidentified
- bevy_input::keyboard::NativeKey
Dead
- core::option::Option
Alt
AltGraph
CapsLock
Control
Fn
FnLock
NumLock
ScrollLock
Shift
Symbol
SymbolLock
Meta
Hyper
Super
Enter
Tab
Space
ArrowDown
ArrowLeft
ArrowRight
ArrowUp
End
Home
PageDown
PageUp
Backspace
Clear
Copy
CrSel
Cut
Delete
EraseEof
ExSel
Insert
Paste
Redo
Undo
Accept
Again
Attn
Cancel
ContextMenu
Escape
Execute
Find
Help
Pause
Play
Props
Select
ZoomIn
ZoomOut
BrightnessDown
BrightnessUp
Eject
LogOff
Power
PowerOff
PrintScreen
Hibernate
Standby
WakeUp
AllCandidates
Alphanumeric
CodeInput
Compose
Convert
FinalMode
GroupFirst
GroupLast
GroupNext
GroupPrevious
ModeChange
NextCandidate
NonConvert
PreviousCandidate
Process
SingleCandidate
HangulMode
HanjaMode
JunjaMode
Eisu
Hankaku
Hiragana
HiraganaKatakana
KanaMode
KanjiMode
Katakana
Romaji
Zenkaku
ZenkakuHankaku
Soft1
Soft2
Soft3
Soft4
ChannelDown
ChannelUp
Close
MailForward
MailReply
MailSend
MediaClose
MediaFastForward
MediaPause
MediaPlay
MediaPlayPause
MediaRecord
MediaRewind
MediaStop
MediaTrackNext
MediaTrackPrevious
New
Open
Save
SpellCheck
Key11
Key12
AudioBalanceLeft
AudioBalanceRight
AudioBassBoostDown
AudioBassBoostToggle
AudioBassBoostUp
AudioFaderFront
AudioFaderRear
AudioSurroundModeNext
AudioTrebleDown
AudioTrebleUp
AudioVolumeDown
AudioVolumeUp
AudioVolumeMute
MicrophoneToggle
MicrophoneVolumeDown
MicrophoneVolumeUp
MicrophoneVolumeMute
SpeechCorrectionList
SpeechInputToggle
LaunchApplication1
LaunchApplication2
LaunchCalendar
LaunchContacts
LaunchMail
LaunchMediaPlayer
LaunchMusicPlayer
LaunchPhone
LaunchScreenSaver
LaunchSpreadsheet
LaunchWebBrowser
LaunchWebCam
LaunchWordProcessor
BrowserBack
BrowserFavorites
BrowserForward
BrowserHome
BrowserRefresh
BrowserSearch
BrowserStop
AppSwitch
Call
Camera
CameraFocus
EndCall
GoBack
GoHome
HeadsetHook
LastNumberRedial
Notification
MannerMode
VoiceDial
TV
TV3DMode
TVAntennaCable
TVAudioDescription
TVAudioDescriptionMixDown
TVAudioDescriptionMixUp
TVContentsMenu
TVDataService
TVInput
TVInputComponent1
TVInputComponent2
TVInputComposite1
TVInputComposite2
TVInputHDMI1
TVInputHDMI2
TVInputHDMI3
TVInputHDMI4
TVInputVGA1
TVMediaContext
TVNetwork
TVNumberEntry
TVPower
TVRadioService
TVSatellite
TVSatelliteBS
TVSatelliteCS
TVSatelliteToggle
TVTerrestrialAnalog
TVTerrestrialDigital
TVTimer
AVRInput
AVRPower
ColorF0Red
ColorF1Green
ColorF2Yellow
ColorF3Blue
ColorF4Grey
ColorF5Brown
ClosedCaptionToggle
Dimmer
DisplaySwap
DVR
Exit
FavoriteClear0
FavoriteClear1
FavoriteClear2
FavoriteClear3
FavoriteRecall0
FavoriteRecall1
FavoriteRecall2
FavoriteRecall3
FavoriteStore0
FavoriteStore1
FavoriteStore2
FavoriteStore3
Guide
GuideNextDay
GuidePreviousDay
Info
InstantReplay
Link
ListProgram
LiveContent
Lock
MediaApps
MediaAudioTrack
MediaLast
MediaSkipBackward
MediaSkipForward
MediaStepBackward
MediaStepForward
MediaTopMenu
NavigateIn
NavigateNext
NavigateOut
NavigatePrevious
NextFavoriteChannel
NextUserProfile
OnDemand
Pairing
PinPDown
PinPMove
PinPToggle
PinPUp
PlaySpeedDown
PlaySpeedReset
PlaySpeedUp
RandomToggle
RcLowBattery
RecordSpeedNext
RfBypass
ScanChannelsToggle
ScreenModeNext
Settings
SplitScreenToggle
STBInput
STBPower
Subtitle
Teletext
VideoModeNext
Wink
ZoomToggle
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
F13
F14
F15
F16
F17
F18
F19
F20
F21
F22
F23
F24
F25
F26
F27
F28
F29
F30
F31
F32
F33
F34
F35
Description
The logical key code of a [
KeyboardInput
].Technical
Its values map 1 to 1 to winit's Key.
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
Key
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Key
- No Documentation 🚧
Returns
- arg0 :
Key
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Key
- No Documentation 🚧 - other :
Key
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
KeyCode
Unidentified
- bevy_input::keyboard::NativeKeyCode
Backquote
Backslash
BracketLeft
BracketRight
Comma
Digit0
Digit1
Digit2
Digit3
Digit4
Digit5
Digit6
Digit7
Digit8
Digit9
Equal
IntlBackslash
IntlRo
IntlYen
KeyA
KeyB
KeyC
KeyD
KeyE
KeyF
KeyG
KeyH
KeyI
KeyJ
KeyK
KeyL
KeyM
KeyN
KeyO
KeyP
KeyQ
KeyR
KeyS
KeyT
KeyU
KeyV
KeyW
KeyX
KeyY
KeyZ
Minus
Period
Quote
Semicolon
Slash
AltLeft
AltRight
Backspace
CapsLock
ContextMenu
ControlLeft
ControlRight
Enter
SuperLeft
SuperRight
ShiftLeft
ShiftRight
Space
Tab
Convert
KanaMode
Lang1
Lang2
Lang3
Lang4
Lang5
NonConvert
Delete
End
Help
Home
Insert
PageDown
PageUp
ArrowDown
ArrowLeft
ArrowRight
ArrowUp
NumLock
Numpad0
Numpad1
Numpad2
Numpad3
Numpad4
Numpad5
Numpad6
Numpad7
Numpad8
Numpad9
NumpadAdd
NumpadBackspace
NumpadClear
NumpadClearEntry
NumpadComma
NumpadDecimal
NumpadDivide
NumpadEnter
NumpadEqual
NumpadHash
NumpadMemoryAdd
NumpadMemoryClear
NumpadMemoryRecall
NumpadMemoryStore
NumpadMemorySubtract
NumpadMultiply
NumpadParenLeft
NumpadParenRight
NumpadStar
NumpadSubtract
Escape
Fn
FnLock
PrintScreen
ScrollLock
Pause
BrowserBack
BrowserFavorites
BrowserForward
BrowserHome
BrowserRefresh
BrowserSearch
BrowserStop
Eject
LaunchApp1
LaunchApp2
LaunchMail
MediaPlayPause
MediaSelect
MediaStop
MediaTrackNext
MediaTrackPrevious
Power
Sleep
AudioVolumeDown
AudioVolumeMute
AudioVolumeUp
WakeUp
Meta
Hyper
Turbo
Abort
Resume
Suspend
Again
Copy
Cut
Find
Open
Paste
Props
Select
Undo
Hiragana
Katakana
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
F13
F14
F15
F16
F17
F18
F19
F20
F21
F22
F23
F24
F25
F26
F27
F28
F29
F30
F31
F32
F33
F34
F35
Description
The key code of a [
KeyboardInput
].Usage
It is used as the generic
T
value of an [ButtonInput
] to create aRes<ButtonInput<KeyCode>>
.Code representing the location of a physical key This mostly conforms to the UI Events Specification's
KeyboardEvent.code
with a few exceptions:
- The keys that the specification calls
MetaLeft
andMetaRight
are namedSuperLeft
andSuperRight
here.- The key that the specification calls "Super" is reported as
Unidentified
here.Updating
The resource is updated inside of the [
keyboard_input_system
].
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
KeyCode
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
KeyCode
- No Documentation 🚧
Returns
- arg0 :
KeyCode
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
KeyCode
- No Documentation 🚧 - other :
KeyCode
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
KeyboardFocusLost
KeyboardFocusLost
Description
Gets generated from
bevy_winit::winit_runner
Used for clearing all cached states to avoid having 'stuck' key presses when, for example, switching between windows with 'Alt-Tab' or using any other OS specific key combination that leads to Bevy window losing focus and not receiving any input events
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
KeyboardFocusLost
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
KeyboardFocusLost
- No Documentation 🚧
Returns
- arg0 :
KeyboardFocusLost
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
KeyboardFocusLost
- No Documentation 🚧 - other :
KeyboardFocusLost
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
KeyboardInput
KeyboardInput
- key_code : bevy_input::keyboard::KeyCode
- logical_key : bevy_input::keyboard::Key
- state : bevy_input::ButtonState
- repeat : bool
- window : bevy_ecs::entity::Entity
Description
A keyboard input event.
This event is the translated version of the
WindowEvent::KeyboardInput
from thewinit
crate. It is available to the end user and can be used for game logic.Usage
The event is consumed inside of the [
keyboard_input_system
] to update theButtonInput<KeyCode>
resource.
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
KeyboardInput
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
KeyboardInput
- No Documentation 🚧
Returns
- arg0 :
KeyboardInput
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
KeyboardInput
- No Documentation 🚧 - other :
KeyboardInput
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
NativeKey
Unidentified
Android
- u32
MacOS
- u16
Windows
- u16
Xkb
- u32
Web
- smol_str::SmolStr
Description
Contains the platform-native logical key identifier, known as keysym.
Exactly what that means differs from platform to platform, but the values are to some degree tied to the currently active keyboard layout. The same key on the same keyboard may also report different values on different platforms, which is one of the reasons this is a per-platform enum.
This enum is primarily used to store raw keysym when Winit doesn't map a given native logical key identifier to a meaningful [
Key
] variant. This lets you use [Key
], and let the user define keybinds which work in the presence of identifiers we haven't mapped for you yet.
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
NativeKey
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
NativeKey
- No Documentation 🚧
Returns
- arg0 :
NativeKey
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
NativeKey
- No Documentation 🚧 - other :
NativeKey
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
NativeKeyCode
Unidentified
Android
- u32
MacOS
- u16
Windows
- u16
Xkb
- u32
Description
Contains the platform-native physical key identifier
The exact values vary from platform to platform (which is part of why this is a per-platform enum), but the values are primarily tied to the key's physical location on the keyboard.
This enum is primarily used to store raw keycodes when Winit doesn't map a given native physical key identifier to a meaningful [
KeyCode
] variant. In the presence of identifiers we haven't mapped for you yet, this lets you use [KeyCode
] to:
- Correctly match key press and release events.
- On non-web platforms, support assigning keybinds to virtually any key through a UI.
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
NativeKeyCode
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
NativeKeyCode
- No Documentation 🚧
Returns
- arg0 :
NativeKeyCode
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
NativeKeyCode
- No Documentation 🚧 - other :
NativeKeyCode
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
AccumulatedMouseMotion
AccumulatedMouseMotion
- delta : glam::Vec2
Description
Tracks how much the mouse has moved every frame.
This resource is reset to zero every frame.
This resource sums the total [
MouseMotion
] events received this frame.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
AccumulatedMouseMotion
- No Documentation 🚧
Returns
- arg0 :
AccumulatedMouseMotion
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
AccumulatedMouseMotion
- No Documentation 🚧 - other :
AccumulatedMouseMotion
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
AccumulatedMouseScroll
AccumulatedMouseScroll
- unit : bevy_input::mouse::MouseScrollUnit
- delta : glam::Vec2
Description
Tracks how much the mouse has scrolled every frame.
This resource is reset to zero every frame.
This resource sums the total [
MouseWheel
] events received this frame.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
AccumulatedMouseScroll
- No Documentation 🚧
Returns
- arg0 :
AccumulatedMouseScroll
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
AccumulatedMouseScroll
- No Documentation 🚧 - other :
AccumulatedMouseScroll
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
MouseButton
Left
Right
Middle
Back
Forward
Other
- u16
Description
A button on a mouse device.
Usage
It is used as the generic
T
value of an [ButtonInput
] to create abevy
resource.Updating
The resource is updated inside of the [
mouse_button_input_system
].
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
MouseButton
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
MouseButton
- No Documentation 🚧
Returns
- arg0 :
MouseButton
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
MouseButton
- No Documentation 🚧 - other :
MouseButton
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
MouseButtonInput
MouseButtonInput
- button : bevy_input::mouse::MouseButton
- state : bevy_input::ButtonState
- window : bevy_ecs::entity::Entity
Description
A mouse button input event.
This event is the translated version of the
WindowEvent::MouseInput
from thewinit
crate.Usage
The event is read inside of the [
mouse_button_input_system
] to update the [ButtonInput<MouseButton>
] resource.
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
MouseButtonInput
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
MouseButtonInput
- No Documentation 🚧
Returns
- arg0 :
MouseButtonInput
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
MouseButtonInput
- No Documentation 🚧 - other :
MouseButtonInput
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
MouseMotion
MouseMotion
- delta : glam::Vec2
Description
An event reporting the change in physical position of a pointing device.
This represents raw, unfiltered physical motion. It is the translated version of
DeviceEvent::MouseMotion
from thewinit
crate.All pointing devices connected to a single machine at the same time can emit the event independently. However, the event data does not make it possible to distinguish which device it is referring to.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
MouseMotion
- No Documentation 🚧
Returns
- arg0 :
MouseMotion
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
MouseMotion
- No Documentation 🚧 - other :
MouseMotion
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
MouseScrollUnit
Line
Pixel
Description
The scroll unit.
Describes how a value of a [
MouseWheel
] event has to be interpreted.The value of the event can either be interpreted as the amount of lines or the amount of pixels to scroll.
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
MouseScrollUnit
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
MouseScrollUnit
- No Documentation 🚧
Returns
- arg0 :
MouseScrollUnit
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
MouseScrollUnit
- No Documentation 🚧 - other :
MouseScrollUnit
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
MouseWheel
MouseWheel
- unit : bevy_input::mouse::MouseScrollUnit
- x : f32
- y : f32
- window : bevy_ecs::entity::Entity
Description
A mouse wheel event.
This event is the translated version of the
WindowEvent::MouseWheel
from thewinit
crate.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
MouseWheel
- No Documentation 🚧
Returns
- arg0 :
MouseWheel
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
MouseWheel
- No Documentation 🚧 - other :
MouseWheel
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
ForceTouch
Calibrated
- force : f64
- max_possible_force : f64
- altitude_angle : core::option::Option
Normalized
- f64
Description
A force description of a [
Touch
] input.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
ForceTouch
- No Documentation 🚧
Returns
- arg0 :
ForceTouch
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
ForceTouch
- No Documentation 🚧 - other :
ForceTouch
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
TouchInput
TouchInput
- phase : bevy_input::touch::TouchPhase
- position : glam::Vec2
- window : bevy_ecs::entity::Entity
- force : core::option::Option<bevy_input::touch::ForceTouch>
- id : u64
Description
A touch input event.
Logic
Every time the user touches the screen, a new [
TouchPhase::Started
] event with an unique identifier for the finger is generated. When the finger is lifted, the [TouchPhase::Ended
] event is generated with the same finger id.After a [
TouchPhase::Started
] event has been emitted, there may be zero or more [TouchPhase::Moved
] events when the finger is moved or the touch pressure changes.The finger id may be reused by the system after an [
TouchPhase::Ended
] event. The user should assume that a new [TouchPhase::Started
] event received with the same id has nothing to do with the old finger and is a new finger.A [
TouchPhase::Canceled
] event is emitted when the system has canceled tracking this touch, such as when the window loses focus, or on iOS if the user moves the device against their face.Note
This event is the translated version of the
WindowEvent::Touch
from thewinit
crate. It is available to the end user and can be used for game logic.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
TouchInput
- No Documentation 🚧
Returns
- arg0 :
TouchInput
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
TouchInput
- No Documentation 🚧 - other :
TouchInput
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
TouchPhase
Started
Moved
Ended
Canceled
Description
A phase of a [
TouchInput
].Usage
It is used to describe the phase of the touch input that is currently active. This includes a phase that indicates that a touch input has started or ended, or that a finger has moved. There is also a canceled phase that indicates that the system canceled the tracking of the finger.
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
TouchPhase
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
TouchPhase
- No Documentation 🚧
Returns
- arg0 :
TouchPhase
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
TouchPhase
- No Documentation 🚧 - other :
TouchPhase
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
Affine3
Affine3
- matrix3 : glam::Mat3
- translation : glam::Vec3
Description
Reduced-size version of
glam::Affine3A
for use when storage has significant performance impact. Convert toglam::Affine3A
to do non-trivial calculations.
Functions
AspectRatio
AspectRatio
- f32
Description
An
AspectRatio
is the ratio of width to height.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
inverse(_self) | Returns the inverse of this aspect ratio (height/width). |
is_landscape(_self) | Returns true if the aspect ratio represents a landscape orientation. |
is_portrait(_self) | Returns true if the aspect ratio represents a portrait orientation. |
is_square(_self) | Returns true if the aspect ratio is exactly square. |
ratio(_self) | Returns the aspect ratio as a f32 value. |
clone
No Documentation 🚧
Arguments
- _self :
AspectRatio
- No Documentation 🚧
Returns
- arg0 :
AspectRatio
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
AspectRatio
- No Documentation 🚧 - other :
AspectRatio
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
inverse
Returns the inverse of this aspect ratio (height/width).
Arguments
- _self :
AspectRatio
- No Documentation 🚧
Returns
- arg0 :
AspectRatio
- No Documentation 🚧
is_landscape
Returns true if the aspect ratio represents a landscape orientation.
Arguments
- _self :
AspectRatio
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_portrait
Returns true if the aspect ratio represents a portrait orientation.
Arguments
- _self :
AspectRatio
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_square
Returns true if the aspect ratio is exactly square.
Arguments
- _self :
AspectRatio
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
ratio
Returns the aspect ratio as a f32 value.
Arguments
- _self :
AspectRatio
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
Aabb2d
Aabb2d
- min : glam::Vec2
- max : glam::Vec2
Description
A 2D axis-aligned bounding box, or bounding rectangle
Functions
Function | Summary |
---|---|
bounding_circle(_self) | Computes the smallest [`BoundingCircle`] containing this [`Aabb2d`]. |
clone(_self) | No Documentation 🚧 |
closest_point(_self, point) | Finds the point on the AABB that is closest to the given `point`. If the point is outside the AABB |
new(center, half_size) | Constructs an AABB from its center and half-size. |
bounding_circle
Computes the smallest [
BoundingCircle
] containing this [Aabb2d
].
Arguments
- _self :
Aabb2d
- No Documentation 🚧
Returns
- arg0 :
BoundingCircle
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Aabb2d
- No Documentation 🚧
Returns
- arg0 :
Aabb2d
- No Documentation 🚧
closest_point
Finds the point on the AABB that is closest to the given
point
. If the point is outside the AABB, the returned point will be on the perimeter of the AABB. Otherwise, it will be inside the AABB and returned as is.
Arguments
- _self :
Aabb2d
- No Documentation 🚧 - point :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
new
Constructs an AABB from its center and half-size.
Arguments
- center :
Vec2
- No Documentation 🚧 - half_size :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Aabb2d
- No Documentation 🚧
BoundingCircle
BoundingCircle
- center : glam::Vec2
- circle : bevy_math::primitives::dim2::Circle
Description
A bounding circle
Functions
Function | Summary |
---|---|
aabb_2d(_self) | Computes the smallest [`Aabb2d`] containing this [`BoundingCircle`]. |
clone(_self) | No Documentation 🚧 |
closest_point(_self, point) | Finds the point on the bounding circle that is closest to the given `point`. If the point is outsi |
new(center, radius) | Constructs a bounding circle from its center and radius. |
radius(_self) | Get the radius of the bounding circle |
aabb_2d
Computes the smallest [
Aabb2d
] containing this [BoundingCircle
].
Arguments
- _self :
BoundingCircle
- No Documentation 🚧
Returns
- arg0 :
Aabb2d
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
BoundingCircle
- No Documentation 🚧
Returns
- arg0 :
BoundingCircle
- No Documentation 🚧
closest_point
Finds the point on the bounding circle that is closest to the given
point
. If the point is outside the circle, the returned point will be on the perimeter of the circle. Otherwise, it will be inside the circle and returned as is.
Arguments
- _self :
BoundingCircle
- No Documentation 🚧 - point :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
new
Constructs a bounding circle from its center and radius.
Arguments
- center :
Vec2
- No Documentation 🚧 - radius :
f32
- No Documentation 🚧
Returns
- arg0 :
BoundingCircle
- No Documentation 🚧
radius
Get the radius of the bounding circle
Arguments
- _self :
BoundingCircle
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
Aabb3d
Aabb3d
- min : glam::Vec3A
- max : glam::Vec3A
Description
A 3D axis-aligned bounding box
Functions
Function | Summary |
---|---|
bounding_sphere(_self) | Computes the smallest [`BoundingSphere`] containing this [`Aabb3d`]. |
clone(_self) | No Documentation 🚧 |
bounding_sphere
Computes the smallest [
BoundingSphere
] containing this [Aabb3d
].
Arguments
- _self :
Aabb3d
- No Documentation 🚧
Returns
- arg0 :
BoundingSphere
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Aabb3d
- No Documentation 🚧
Returns
- arg0 :
Aabb3d
- No Documentation 🚧
BoundingSphere
BoundingSphere
- center : glam::Vec3A
- sphere : bevy_math::primitives::dim3::Sphere
Description
A bounding sphere
Functions
Function | Summary |
---|---|
aabb_3d(_self) | Computes the smallest [`Aabb3d`] containing this [`BoundingSphere`]. |
clone(_self) | No Documentation 🚧 |
radius(_self) | Get the radius of the bounding sphere |
aabb_3d
Computes the smallest [
Aabb3d
] containing this [BoundingSphere
].
Arguments
- _self :
BoundingSphere
- No Documentation 🚧
Returns
- arg0 :
Aabb3d
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
BoundingSphere
- No Documentation 🚧
Returns
- arg0 :
BoundingSphere
- No Documentation 🚧
radius
Get the radius of the bounding sphere
Arguments
- _self :
BoundingSphere
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
AabbCast2d
AabbCast2d
- ray : bevy_math::bounding::raycast2d::RayCast2d
- aabb : bevy_math::bounding::bounded2d::Aabb2d
Description
An intersection test that casts an [
Aabb2d
] along a ray.
Functions
Function | Summary |
---|---|
aabb_collision_at(_self, aabb) | Get the distance at which the [`Aabb2d`]s collide, if at all. |
clone(_self) | No Documentation 🚧 |
from_ray(aabb, ray, max) | Construct an [`AabbCast2d`] from an [`Aabb2d`], [`Ray2d`], and max distance. |
new(aabb, origin, direction, max) | Construct an [`AabbCast2d`] from an [`Aabb2d`], origin, [`Dir2`], and max distance. |
aabb_collision_at
Get the distance at which the [
Aabb2d
]s collide, if at all.
Arguments
- _self :
AabbCast2d
- No Documentation 🚧 - aabb :
Aabb2d
- No Documentation 🚧
Returns
- arg0 :
Optional<f32>
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
AabbCast2d
- No Documentation 🚧
Returns
- arg0 :
AabbCast2d
- No Documentation 🚧
from_ray
Construct an [
AabbCast2d
] from an [Aabb2d
], [Ray2d
], and max distance.
Arguments
- aabb :
Aabb2d
- No Documentation 🚧 - ray :
Ray2d
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
AabbCast2d
- No Documentation 🚧
new
Construct an [
AabbCast2d
] from an [Aabb2d
], origin, [Dir2
], and max distance.
Arguments
- aabb :
Aabb2d
- No Documentation 🚧 - origin :
Vec2
- No Documentation 🚧 - direction :
Dir2
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
AabbCast2d
- No Documentation 🚧
BoundingCircleCast
BoundingCircleCast
- ray : bevy_math::bounding::raycast2d::RayCast2d
- circle : bevy_math::bounding::bounded2d::BoundingCircle
Description
An intersection test that casts a [
BoundingCircle
] along a ray.
Functions
Function | Summary |
---|---|
circle_collision_at(_self, circle) | Get the distance at which the [`BoundingCircle`]s collide, if at all. |
clone(_self) | No Documentation 🚧 |
from_ray(circle, ray, max) | Construct a [`BoundingCircleCast`] from a [`BoundingCircle`], [`Ray2d`], and max distance. |
new(circle, origin, direction, max) | Construct a [`BoundingCircleCast`] from a [`BoundingCircle`], origin, [`Dir2`], and max distance. |
circle_collision_at
Get the distance at which the [
BoundingCircle
]s collide, if at all.
Arguments
- _self :
BoundingCircleCast
- No Documentation 🚧 - circle :
BoundingCircle
- No Documentation 🚧
Returns
- arg0 :
Optional<f32>
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
BoundingCircleCast
- No Documentation 🚧
Returns
- arg0 :
BoundingCircleCast
- No Documentation 🚧
from_ray
Construct a [
BoundingCircleCast
] from a [BoundingCircle
], [Ray2d
], and max distance.
Arguments
- circle :
BoundingCircle
- No Documentation 🚧 - ray :
Ray2d
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
BoundingCircleCast
- No Documentation 🚧
new
Construct a [
BoundingCircleCast
] from a [BoundingCircle
], origin, [Dir2
], and max distance.
Arguments
- circle :
BoundingCircle
- No Documentation 🚧 - origin :
Vec2
- No Documentation 🚧 - direction :
Dir2
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
BoundingCircleCast
- No Documentation 🚧
RayCast2d
RayCast2d
- ray : bevy_math::ray::Ray2d
- max : f32
- direction_recip : glam::Vec2
Description
A raycast intersection test for 2D bounding volumes
Functions
Function | Summary |
---|---|
aabb_intersection_at(_self, aabb) | Get the distance of an intersection with an [`Aabb2d`], if any. |
circle_intersection_at(_self, circle) | Get the distance of an intersection with a [`BoundingCircle`], if any. |
clone(_self) | No Documentation 🚧 |
direction_recip(_self) | Get the cached multiplicative inverse of the direction of the ray. |
from_ray(ray, max) | Construct a [`RayCast2d`] from a [`Ray2d`] and max distance. |
new(origin, direction, max) | Construct a [`RayCast2d`] from an origin, [`Dir2`], and max distance. |
aabb_intersection_at
Get the distance of an intersection with an [
Aabb2d
], if any.
Arguments
- _self :
RayCast2d
- No Documentation 🚧 - aabb :
Aabb2d
- No Documentation 🚧
Returns
- arg0 :
Optional<f32>
- No Documentation 🚧
circle_intersection_at
Get the distance of an intersection with a [
BoundingCircle
], if any.
Arguments
- _self :
RayCast2d
- No Documentation 🚧 - circle :
BoundingCircle
- No Documentation 🚧
Returns
- arg0 :
Optional<f32>
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
RayCast2d
- No Documentation 🚧
Returns
- arg0 :
RayCast2d
- No Documentation 🚧
direction_recip
Get the cached multiplicative inverse of the direction of the ray.
Arguments
- _self :
RayCast2d
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
from_ray
Construct a [
RayCast2d
] from a [Ray2d
] and max distance.
Arguments
- ray :
Ray2d
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
RayCast2d
- No Documentation 🚧
new
Construct a [
RayCast2d
] from an origin, [Dir2
], and max distance.
Arguments
- origin :
Vec2
- No Documentation 🚧 - direction :
Dir2
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
RayCast2d
- No Documentation 🚧
AabbCast3d
AabbCast3d
- ray : bevy_math::bounding::raycast3d::RayCast3d
- aabb : bevy_math::bounding::bounded3d::Aabb3d
Description
An intersection test that casts an [
Aabb3d
] along a ray.
Functions
Function | Summary |
---|---|
aabb_collision_at(_self, aabb) | Get the distance at which the [`Aabb3d`]s collide, if at all. |
clone(_self) | No Documentation 🚧 |
from_ray(aabb, ray, max) | Construct an [`AabbCast3d`] from an [`Aabb3d`], [`Ray3d`], and max distance. |
aabb_collision_at
Get the distance at which the [
Aabb3d
]s collide, if at all.
Arguments
- _self :
AabbCast3d
- No Documentation 🚧 - aabb :
Aabb3d
- No Documentation 🚧
Returns
- arg0 :
Optional<f32>
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
AabbCast3d
- No Documentation 🚧
Returns
- arg0 :
AabbCast3d
- No Documentation 🚧
from_ray
Construct an [
AabbCast3d
] from an [Aabb3d
], [Ray3d
], and max distance.
Arguments
- aabb :
Aabb3d
- No Documentation 🚧 - ray :
Ray3d
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
AabbCast3d
- No Documentation 🚧
BoundingSphereCast
BoundingSphereCast
- ray : bevy_math::bounding::raycast3d::RayCast3d
- sphere : bevy_math::bounding::bounded3d::BoundingSphere
Description
An intersection test that casts a [
BoundingSphere
] along a ray.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
from_ray(sphere, ray, max) | Construct a [`BoundingSphereCast`] from a [`BoundingSphere`], [`Ray3d`], and max distance. |
sphere_collision_at(_self, sphere) | Get the distance at which the [`BoundingSphere`]s collide, if at all. |
clone
No Documentation 🚧
Arguments
- _self :
BoundingSphereCast
- No Documentation 🚧
Returns
- arg0 :
BoundingSphereCast
- No Documentation 🚧
from_ray
Construct a [
BoundingSphereCast
] from a [BoundingSphere
], [Ray3d
], and max distance.
Arguments
- sphere :
BoundingSphere
- No Documentation 🚧 - ray :
Ray3d
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
BoundingSphereCast
- No Documentation 🚧
sphere_collision_at
Get the distance at which the [
BoundingSphere
]s collide, if at all.
Arguments
- _self :
BoundingSphereCast
- No Documentation 🚧 - sphere :
BoundingSphere
- No Documentation 🚧
Returns
- arg0 :
Optional<f32>
- No Documentation 🚧
RayCast3d
RayCast3d
- origin : glam::Vec3A
- direction : bevy_math::direction::Dir3A
- max : f32
- direction_recip : glam::Vec3A
Description
A raycast intersection test for 3D bounding volumes
Functions
Function | Summary |
---|---|
aabb_intersection_at(_self, aabb) | Get the distance of an intersection with an [`Aabb3d`], if any. |
clone(_self) | No Documentation 🚧 |
direction_recip(_self) | Get the cached multiplicative inverse of the direction of the ray. |
from_ray(ray, max) | Construct a [`RayCast3d`] from a [`Ray3d`] and max distance. |
sphere_intersection_at(_self, sphere) | Get the distance of an intersection with a [`BoundingSphere`], if any. |
aabb_intersection_at
Get the distance of an intersection with an [
Aabb3d
], if any.
Arguments
- _self :
RayCast3d
- No Documentation 🚧 - aabb :
Aabb3d
- No Documentation 🚧
Returns
- arg0 :
Optional<f32>
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
RayCast3d
- No Documentation 🚧
Returns
- arg0 :
RayCast3d
- No Documentation 🚧
direction_recip
Get the cached multiplicative inverse of the direction of the ray.
Arguments
- _self :
RayCast3d
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
from_ray
Construct a [
RayCast3d
] from a [Ray3d
] and max distance.
Arguments
- ray :
Ray3d
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
RayCast3d
- No Documentation 🚧
sphere_intersection_at
Get the distance of an intersection with a [
BoundingSphere
], if any.
Arguments
- _self :
RayCast3d
- No Documentation 🚧 - sphere :
BoundingSphere
- No Documentation 🚧
Returns
- arg0 :
Optional<f32>
- No Documentation 🚧
CompassOctant
North
NorthEast
East
SouthEast
South
SouthWest
West
NorthWest
Description
A compass enum with 8 directions.
N (North) ▲ NW │ NE ╲ │ ╱ W (West) ┼─────► E (East) ╱ │ ╲ SW │ SE ▼ S (South)
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
CompassOctant
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
CompassOctant
- No Documentation 🚧
Returns
- arg0 :
CompassOctant
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
CompassOctant
- No Documentation 🚧 - other :
CompassOctant
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
CompassQuadrant
North
East
South
West
Description
A compass enum with 4 directions.
N (North) ▲ │ │ W (West) ┼─────► E (East) │ │ ▼ S (South)
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
CompassQuadrant
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
CompassQuadrant
- No Documentation 🚧
Returns
- arg0 :
CompassQuadrant
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
CompassQuadrant
- No Documentation 🚧 - other :
CompassQuadrant
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
EaseFunction
Linear
QuadraticIn
QuadraticOut
QuadraticInOut
CubicIn
CubicOut
CubicInOut
QuarticIn
QuarticOut
QuarticInOut
QuinticIn
QuinticOut
QuinticInOut
SineIn
SineOut
SineInOut
CircularIn
CircularOut
CircularInOut
ExponentialIn
ExponentialOut
ExponentialInOut
ElasticIn
ElasticOut
ElasticInOut
BackIn
BackOut
BackInOut
BounceIn
BounceOut
BounceInOut
Steps
- usize
Elastic
- f32
Description
Curve functions over the unit interval, commonly used for easing transitions.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
EaseFunction
- No Documentation 🚧
Returns
- arg0 :
EaseFunction
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
EaseFunction
- No Documentation 🚧 - other :
EaseFunction
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
Interval
Interval
- start : f32
- end : f32
Description
A nonempty closed interval, possibly unbounded in either direction.
In other words, the interval may stretch all the way to positive or negative infinity, but it will always have some nonempty interior.
Functions
Function | Summary |
---|---|
clamp(_self, value) | Clamp the given `value` to lie within this interval. |
clone(_self) | No Documentation 🚧 |
contains(_self, item) | Returns `true` if `item` is contained in this interval. |
contains_interval(_self, other) | Returns `true` if the other interval is contained in this interval. This is non-strict: each inter |
end(_self) | Get the end of this interval. |
eq(_self, other) | No Documentation 🚧 |
has_finite_end(_self) | Returns `true` if this interval has a finite end. |
has_finite_start(_self) | Returns `true` if this interval has a finite start. |
is_bounded(_self) | Returns `true` if this interval is bounded — that is, if both its start and end are finite. Equi |
length(_self) | Get the length of this interval. Note that the result may be infinite (`f32::INFINITY`). |
start(_self) | Get the start of this interval. |
clamp
Clamp the given
value
to lie within this interval.
Arguments
- _self :
Interval
- No Documentation 🚧 - value :
f32
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Interval
- No Documentation 🚧
Returns
- arg0 :
Interval
- No Documentation 🚧
contains
Returns
true
ifitem
is contained in this interval.
Arguments
- _self :
Interval
- No Documentation 🚧 - item :
f32
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
contains_interval
Returns
true
if the other interval is contained in this interval. This is non-strict: each interval will contain itself.
Arguments
- _self :
Interval
- No Documentation 🚧 - other :
Interval
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
end
Get the end of this interval.
Arguments
- _self :
Interval
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Interval
- No Documentation 🚧 - other :
Interval
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
has_finite_end
Returns
true
if this interval has a finite end.
Arguments
- _self :
Interval
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
has_finite_start
Returns
true
if this interval has a finite start.
Arguments
- _self :
Interval
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_bounded
Returns
true
if this interval is bounded — that is, if both its start and end are finite. Equivalently, an interval is bounded if its length is finite.
Arguments
- _self :
Interval
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
length
Get the length of this interval. Note that the result may be infinite (
f32::INFINITY
).
Arguments
- _self :
Interval
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
start
Get the start of this interval.
Arguments
- _self :
Interval
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
Dir2
Dir2
- glam::Vec2
Description
A normalized vector pointing in a direction in 2D space
Functions
as_vec2
Returns the inner [
Vec2
]
Arguments
- _self :
Dir2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Dir2
- No Documentation 🚧
Returns
- arg0 :
Dir2
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Dir2
- No Documentation 🚧 - other :
Dir2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
fast_renormalize
Returns
self
after an approximate normalization, assuming the value is already nearly normalized. Useful for preventing numerical error accumulation. See [Dir3::fast_renormalize
] for an example of when such error accumulation might occur.
Arguments
- _self :
Dir2
- No Documentation 🚧
Returns
- arg0 :
Dir2
- No Documentation 🚧
from_xy_unchecked
Create a direction from its
x
andy
components, assuming the resulting vector is normalized.Warning
The vector produced from
x
andy
must be normalized, i.e its length must be1.0
.
Arguments
- x :
f32
- No Documentation 🚧 - y :
f32
- No Documentation 🚧
Returns
- arg0 :
Dir2
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Dir2
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
Dir2
- No Documentation 🚧
Returns
- arg0 :
Dir2
- No Documentation 🚧
new_unchecked
Create a [
Dir2
] from a [Vec2
] that is already normalized.Warning
value
must be normalized, i.e its length must be1.0
.
Arguments
- value :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Dir2
- No Documentation 🚧
rotation_from
Get the rotation that rotates
other
to this direction.
Arguments
- _self :
Dir2
- No Documentation 🚧 - other :
Dir2
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
rotation_from_x
Get the rotation that rotates the X-axis to this direction.
Arguments
- _self :
Dir2
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
rotation_from_y
Get the rotation that rotates the Y-axis to this direction.
Arguments
- _self :
Dir2
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
rotation_to
Get the rotation that rotates this direction to
other
.
Arguments
- _self :
Dir2
- No Documentation 🚧 - other :
Dir2
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
rotation_to_x
Get the rotation that rotates this direction to the X-axis.
Arguments
- _self :
Dir2
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
rotation_to_y
Get the rotation that rotates this direction to the Y-axis.
Arguments
- _self :
Dir2
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
slerp
Performs a spherical linear interpolation between
self
andrhs
based on the values
. This corresponds to interpolating between the two directions at a constant angular velocity. Whens == 0.0
, the result will be equal toself
. Whens == 1.0
, the result will be equal torhs
.Example
# use bevy_math::Dir2; # use approx::{assert_relative_eq, RelativeEq}; # let dir1 = Dir2::X; let dir2 = Dir2::Y; let result1 = dir1.slerp(dir2, 1.0 / 3.0); assert_relative_eq!(result1, Dir2::from_xy(0.75_f32.sqrt(), 0.5).unwrap()); let result2 = dir1.slerp(dir2, 0.5); assert_relative_eq!(result2, Dir2::from_xy(0.5_f32.sqrt(), 0.5_f32.sqrt()).unwrap());
Arguments
- _self :
Dir2
- No Documentation 🚧 - rhs :
Dir2
- No Documentation 🚧 - s :
f32
- No Documentation 🚧
Returns
- arg0 :
Dir2
- No Documentation 🚧
Dir3
Dir3
- glam::Vec3
Description
A normalized vector pointing in a direction in 3D space
Functions
Function | Summary |
---|---|
as_vec3(_self) | Returns the inner [`Vec3`] |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
fast_renormalize(_self) | Returns `self` after an approximate normalization, assuming the value is already nearly normalized. |
from_xyz_unchecked(x, y, z) | Create a direction from its `x`, `y`, and `z` components, assuming the resulting vector is normaliz |
mul(_self, rhs) | No Documentation 🚧 |
neg(_self) | No Documentation 🚧 |
new_unchecked(value) | Create a [`Dir3`] from a [`Vec3`] that is already normalized. # Warning `value` must be normalize |
slerp(_self, rhs, s) | Performs a spherical linear interpolation between `self` and `rhs` based on the value `s`. This c |
as_vec3
Returns the inner [
Vec3
]
Arguments
- _self :
Dir3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Dir3
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Dir3
- No Documentation 🚧 - other :
Dir3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
fast_renormalize
Returns
self
after an approximate normalization, assuming the value is already nearly normalized. Useful for preventing numerical error accumulation.Example
The following seemingly benign code would start accumulating errors over time, leading to
dir
eventually not being normalized anymore.# use bevy_math::prelude::*; # let N: usize = 200; let mut dir = Dir3::X; let quaternion = Quat::from_euler(EulerRot::XYZ, 1.0, 2.0, 3.0); for i in 0..N { dir = quaternion * dir; }
Instead, do the following.
# use bevy_math::prelude::*; # let N: usize = 200; let mut dir = Dir3::X; let quaternion = Quat::from_euler(EulerRot::XYZ, 1.0, 2.0, 3.0); for i in 0..N { dir = quaternion * dir; dir = dir.fast_renormalize(); }
Arguments
- _self :
Dir3
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
from_xyz_unchecked
Create a direction from its
x
,y
, andz
components, assuming the resulting vector is normalized.Warning
The vector produced from
x
,y
, andz
must be normalized, i.e its length must be1.0
.
Arguments
- x :
f32
- No Documentation 🚧 - y :
f32
- No Documentation 🚧 - z :
f32
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Dir3
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
Dir3
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
new_unchecked
Create a [
Dir3
] from a [Vec3
] that is already normalized.Warning
value
must be normalized, i.e its length must be1.0
.
Arguments
- value :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
slerp
Performs a spherical linear interpolation between
self
andrhs
based on the values
. This corresponds to interpolating between the two directions at a constant angular velocity. Whens == 0.0
, the result will be equal toself
. Whens == 1.0
, the result will be equal torhs
.Example
# use bevy_math::Dir3; # use approx::{assert_relative_eq, RelativeEq}; # let dir1 = Dir3::X; let dir2 = Dir3::Y; let result1 = dir1.slerp(dir2, 1.0 / 3.0); assert_relative_eq!( result1, Dir3::from_xyz(0.75_f32.sqrt(), 0.5, 0.0).unwrap(), epsilon = 0.000001 ); let result2 = dir1.slerp(dir2, 0.5); assert_relative_eq!(result2, Dir3::from_xyz(0.5_f32.sqrt(), 0.5_f32.sqrt(), 0.0).unwrap());
Arguments
- _self :
Dir3
- No Documentation 🚧 - rhs :
Dir3
- No Documentation 🚧 - s :
f32
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
Dir3A
Dir3A
- glam::Vec3A
Description
A normalized SIMD vector pointing in a direction in 3D space.
This type stores a 16 byte aligned [
Vec3A
]. This may or may not be faster than [Dir3
]: make sure to benchmark!
Functions
Function | Summary |
---|---|
as_vec3a(_self) | Returns the inner [`Vec3A`] |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
fast_renormalize(_self) | Returns `self` after an approximate normalization, assuming the value is already nearly normalized. |
from_xyz_unchecked(x, y, z) | Create a direction from its `x`, `y`, and `z` components, assuming the resulting vector is normaliz |
mul(_self, rhs) | No Documentation 🚧 |
neg(_self) | No Documentation 🚧 |
new_unchecked(value) | Create a [`Dir3A`] from a [`Vec3A`] that is already normalized. # Warning `value` must be normali |
slerp(_self, rhs, s) | Performs a spherical linear interpolation between `self` and `rhs` based on the value `s`. This c |
as_vec3a
Returns the inner [
Vec3A
]
Arguments
- _self :
Dir3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Dir3A
- No Documentation 🚧
Returns
- arg0 :
Dir3A
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Dir3A
- No Documentation 🚧 - other :
Dir3A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
fast_renormalize
Returns
self
after an approximate normalization, assuming the value is already nearly normalized. Useful for preventing numerical error accumulation. See [Dir3::fast_renormalize
] for an example of when such error accumulation might occur.
Arguments
- _self :
Dir3A
- No Documentation 🚧
Returns
- arg0 :
Dir3A
- No Documentation 🚧
from_xyz_unchecked
Create a direction from its
x
,y
, andz
components, assuming the resulting vector is normalized.Warning
The vector produced from
x
,y
, andz
must be normalized, i.e its length must be1.0
.
Arguments
- x :
f32
- No Documentation 🚧 - y :
f32
- No Documentation 🚧 - z :
f32
- No Documentation 🚧
Returns
- arg0 :
Dir3A
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Dir3A
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
Dir3A
- No Documentation 🚧
Returns
- arg0 :
Dir3A
- No Documentation 🚧
new_unchecked
Create a [
Dir3A
] from a [Vec3A
] that is already normalized.Warning
value
must be normalized, i.e its length must be1.0
.
Arguments
- value :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Dir3A
- No Documentation 🚧
slerp
Performs a spherical linear interpolation between
self
andrhs
based on the values
. This corresponds to interpolating between the two directions at a constant angular velocity. Whens == 0.0
, the result will be equal toself
. Whens == 1.0
, the result will be equal torhs
.Example
# use bevy_math::Dir3A; # use approx::{assert_relative_eq, RelativeEq}; # let dir1 = Dir3A::X; let dir2 = Dir3A::Y; let result1 = dir1.slerp(dir2, 1.0 / 3.0); assert_relative_eq!( result1, Dir3A::from_xyz(0.75_f32.sqrt(), 0.5, 0.0).unwrap(), epsilon = 0.000001 ); let result2 = dir1.slerp(dir2, 0.5); assert_relative_eq!(result2, Dir3A::from_xyz(0.5_f32.sqrt(), 0.5_f32.sqrt(), 0.0).unwrap());
Arguments
- _self :
Dir3A
- No Documentation 🚧 - rhs :
Dir3A
- No Documentation 🚧 - s :
f32
- No Documentation 🚧
Returns
- arg0 :
Dir3A
- No Documentation 🚧
FloatOrd
FloatOrd
- f32
Description
A wrapper for floats that implements [
Ord
], [Eq
], and [Hash
] traits.This is a work around for the fact that the IEEE 754-2008 standard, implemented by Rust's [
f32
] type, doesn't define an ordering forNaN
, andNaN
is not considered equal to any otherNaN
.Wrapping a float with
FloatOrd
breaks conformance with the standard by sortingNaN
as less than all other numbers and equal to any otherNaN
.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
ge(_self, other) | No Documentation 🚧 |
gt(_self, other) | No Documentation 🚧 |
le(_self, other) | No Documentation 🚧 |
lt(_self, other) | No Documentation 🚧 |
neg(_self) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
FloatOrd
- No Documentation 🚧
Returns
- arg0 :
FloatOrd
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
FloatOrd
- No Documentation 🚧 - other :
FloatOrd
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
ge
No Documentation 🚧
Arguments
- _self :
FloatOrd
- No Documentation 🚧 - other :
FloatOrd
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
gt
No Documentation 🚧
Arguments
- _self :
FloatOrd
- No Documentation 🚧 - other :
FloatOrd
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
le
No Documentation 🚧
Arguments
- _self :
FloatOrd
- No Documentation 🚧 - other :
FloatOrd
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
lt
No Documentation 🚧
Arguments
- _self :
FloatOrd
- No Documentation 🚧 - other :
FloatOrd
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
FloatOrd
- No Documentation 🚧
Returns
- arg0 :
FloatOrd
- No Documentation 🚧
Isometry2d
Isometry2d
- rotation : bevy_math::rotation2d::Rot2
- translation : glam::Vec2
Description
An isometry in two dimensions, representing a rotation followed by a translation. This can often be useful for expressing relative positions and transformations from one position to another.
In particular, this type represents a distance-preserving transformation known as a rigid motion or a direct motion, and belongs to the special Euclidean group SE(2). This includes translation and rotation, but excludes reflection.
For the three-dimensional version, see [
Isometry3d
].Example
Isometries can be created from a given translation and rotation:
# use bevy_math::{Isometry2d, Rot2, Vec2}; # let iso = Isometry2d::new(Vec2::new(2.0, 1.0), Rot2::degrees(90.0));
Or from separate parts:
# use bevy_math::{Isometry2d, Rot2, Vec2}; # let iso1 = Isometry2d::from_translation(Vec2::new(2.0, 1.0)); let iso2 = Isometry2d::from_rotation(Rot2::degrees(90.0));
The isometries can be used to transform points:
# use approx::assert_abs_diff_eq; # use bevy_math::{Isometry2d, Rot2, Vec2}; # let iso = Isometry2d::new(Vec2::new(2.0, 1.0), Rot2::degrees(90.0)); let point = Vec2::new(4.0, 4.0); // These are equivalent let result = iso.transform_point(point); let result = iso * point; assert_eq!(result, Vec2::new(-2.0, 5.0));
Isometries can also be composed together:
# use bevy_math::{Isometry2d, Rot2, Vec2}; # # let iso = Isometry2d::new(Vec2::new(2.0, 1.0), Rot2::degrees(90.0)); # let iso1 = Isometry2d::from_translation(Vec2::new(2.0, 1.0)); # let iso2 = Isometry2d::from_rotation(Rot2::degrees(90.0)); # assert_eq!(iso1 * iso2, iso);
One common operation is to compute an isometry representing the relative positions of two objects for things like intersection tests. This can be done with an inverse transformation:
# use bevy_math::{Isometry2d, Rot2, Vec2}; # let circle_iso = Isometry2d::from_translation(Vec2::new(2.0, 1.0)); let rectangle_iso = Isometry2d::from_rotation(Rot2::degrees(90.0)); // Compute the relative position and orientation between the two shapes let relative_iso = circle_iso.inverse() * rectangle_iso; // Or alternatively, to skip an extra rotation operation: let relative_iso = circle_iso.inverse_mul(rectangle_iso);
Functions
clone
No Documentation 🚧
Arguments
- _self :
Isometry2d
- No Documentation 🚧
Returns
- arg0 :
Isometry2d
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Isometry2d
- No Documentation 🚧 - other :
Isometry2d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_rotation
Create a two-dimensional isometry from a rotation.
Arguments
- rotation :
Rot2
- No Documentation 🚧
Returns
- arg0 :
Isometry2d
- No Documentation 🚧
from_translation
Create a two-dimensional isometry from a translation.
Arguments
- translation :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Isometry2d
- No Documentation 🚧
from_xy
Create a two-dimensional isometry from a translation with the given
x
andy
components.
Arguments
- x :
f32
- No Documentation 🚧 - y :
f32
- No Documentation 🚧
Returns
- arg0 :
Isometry2d
- No Documentation 🚧
inverse
The inverse isometry that undoes this one.
Arguments
- _self :
Isometry2d
- No Documentation 🚧
Returns
- arg0 :
Isometry2d
- No Documentation 🚧
inverse_mul
Compute
iso1.inverse() * iso2
in a more efficient way for one-shot cases. If the same isometry is used multiple times, it is more efficient to instead compute the inverse once and use that for each transformation.
Arguments
- _self :
Isometry2d
- No Documentation 🚧 - rhs :
Isometry2d
- No Documentation 🚧
Returns
- arg0 :
Isometry2d
- No Documentation 🚧
inverse_transform_point
Transform a point by rotating and translating it using the inverse of this isometry. This is more efficient than
iso.inverse().transform_point(point)
for one-shot cases. If the same isometry is used multiple times, it is more efficient to instead compute the inverse once and use that for each transformation.
Arguments
- _self :
Isometry2d
- No Documentation 🚧 - point :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Isometry2d
- No Documentation 🚧 - rhs :
Isometry2d
- No Documentation 🚧
Returns
- arg0 :
Isometry2d
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
Isometry2d
- No Documentation 🚧 - arg1 :
Dir2
- No Documentation 🚧
Returns
- arg0 :
Dir2
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
Isometry2d
- No Documentation 🚧 - arg1 :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
new
Create a two-dimensional isometry from a rotation and a translation.
Arguments
- translation :
Vec2
- No Documentation 🚧 - rotation :
Rot2
- No Documentation 🚧
Returns
- arg0 :
Isometry2d
- No Documentation 🚧
transform_point
Transform a point by rotating and translating it using this isometry.
Arguments
- _self :
Isometry2d
- No Documentation 🚧 - point :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
Isometry3d
Isometry3d
- rotation : glam::Quat
- translation : glam::Vec3A
Description
An isometry in three dimensions, representing a rotation followed by a translation. This can often be useful for expressing relative positions and transformations from one position to another.
In particular, this type represents a distance-preserving transformation known as a rigid motion or a direct motion, and belongs to the special Euclidean group SE(3). This includes translation and rotation, but excludes reflection.
For the two-dimensional version, see [
Isometry2d
].Example
Isometries can be created from a given translation and rotation:
# use bevy_math::{Isometry3d, Quat, Vec3}; # use std::f32::consts::FRAC_PI_2; # let iso = Isometry3d::new(Vec3::new(2.0, 1.0, 3.0), Quat::from_rotation_z(FRAC_PI_2));
Or from separate parts:
# use bevy_math::{Isometry3d, Quat, Vec3}; # use std::f32::consts::FRAC_PI_2; # let iso1 = Isometry3d::from_translation(Vec3::new(2.0, 1.0, 3.0)); let iso2 = Isometry3d::from_rotation(Quat::from_rotation_z(FRAC_PI_2));
The isometries can be used to transform points:
# use approx::assert_relative_eq; # use bevy_math::{Isometry3d, Quat, Vec3}; # use std::f32::consts::FRAC_PI_2; # let iso = Isometry3d::new(Vec3::new(2.0, 1.0, 3.0), Quat::from_rotation_z(FRAC_PI_2)); let point = Vec3::new(4.0, 4.0, 4.0); // These are equivalent let result = iso.transform_point(point); let result = iso * point; assert_relative_eq!(result, Vec3::new(-2.0, 5.0, 7.0));
Isometries can also be composed together:
# use bevy_math::{Isometry3d, Quat, Vec3}; # use std::f32::consts::FRAC_PI_2; # # let iso = Isometry3d::new(Vec3::new(2.0, 1.0, 3.0), Quat::from_rotation_z(FRAC_PI_2)); # let iso1 = Isometry3d::from_translation(Vec3::new(2.0, 1.0, 3.0)); # let iso2 = Isometry3d::from_rotation(Quat::from_rotation_z(FRAC_PI_2)); # assert_eq!(iso1 * iso2, iso);
One common operation is to compute an isometry representing the relative positions of two objects for things like intersection tests. This can be done with an inverse transformation:
# use bevy_math::{Isometry3d, Quat, Vec3}; # use std::f32::consts::FRAC_PI_2; # let sphere_iso = Isometry3d::from_translation(Vec3::new(2.0, 1.0, 3.0)); let cuboid_iso = Isometry3d::from_rotation(Quat::from_rotation_z(FRAC_PI_2)); // Compute the relative position and orientation between the two shapes let relative_iso = sphere_iso.inverse() * cuboid_iso; // Or alternatively, to skip an extra rotation operation: let relative_iso = sphere_iso.inverse_mul(cuboid_iso);
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
from_rotation(rotation) | Create a three-dimensional isometry from a rotation. |
from_xyz(x, y, z) | Create a three-dimensional isometry from a translation with the given `x`, `y`, and `z` components. |
inverse(_self) | The inverse isometry that undoes this one. |
inverse_mul(_self, rhs) | Compute `iso1.inverse() * iso2` in a more efficient way for one-shot cases. If the same isometry is used multiple times, it is more efficient to instead compute the inverse once and use that for each transformation. |
mul(_self, rhs) | No Documentation 🚧 |
mul-1(arg0, arg1) | No Documentation 🚧 |
mul-2(arg0, arg1) | No Documentation 🚧 |
mul-3(arg0, arg1) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
Isometry3d
- No Documentation 🚧
Returns
- arg0 :
Isometry3d
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Isometry3d
- No Documentation 🚧 - other :
Isometry3d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_rotation
Create a three-dimensional isometry from a rotation.
Arguments
- rotation :
Quat
- No Documentation 🚧
Returns
- arg0 :
Isometry3d
- No Documentation 🚧
from_xyz
Create a three-dimensional isometry from a translation with the given
x
,y
, andz
components.
Arguments
- x :
f32
- No Documentation 🚧 - y :
f32
- No Documentation 🚧 - z :
f32
- No Documentation 🚧
Returns
- arg0 :
Isometry3d
- No Documentation 🚧
inverse
The inverse isometry that undoes this one.
Arguments
- _self :
Isometry3d
- No Documentation 🚧
Returns
- arg0 :
Isometry3d
- No Documentation 🚧
inverse_mul
Compute
iso1.inverse() * iso2
in a more efficient way for one-shot cases. If the same isometry is used multiple times, it is more efficient to instead compute the inverse once and use that for each transformation.
Arguments
- _self :
Isometry3d
- No Documentation 🚧 - rhs :
Isometry3d
- No Documentation 🚧
Returns
- arg0 :
Isometry3d
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Isometry3d
- No Documentation 🚧 - rhs :
Isometry3d
- No Documentation 🚧
Returns
- arg0 :
Isometry3d
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
Isometry3d
- No Documentation 🚧 - arg1 :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
Isometry3d
- No Documentation 🚧 - arg1 :
Dir3
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
mul-3
No Documentation 🚧
Arguments
- arg0 :
Isometry3d
- No Documentation 🚧 - arg1 :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
Annulus
Annulus
- inner_circle : bevy_math::primitives::dim2::Circle
- outer_circle : bevy_math::primitives::dim2::Circle
Description
A primitive shape formed by the region between two circles, also known as a ring.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
closest_point(_self, point) | Finds the point on the annulus that is closest to the given `point`: - If the point is outside of |
diameter(_self) | Get the diameter of the annulus |
eq(_self, other) | No Documentation 🚧 |
new(inner_radius, outer_radius) | Create a new [`Annulus`] from the radii of the inner and outer circle |
thickness(_self) | Get the thickness of the annulus |
clone
No Documentation 🚧
Arguments
- _self :
Annulus
- No Documentation 🚧
Returns
- arg0 :
Annulus
- No Documentation 🚧
closest_point
Finds the point on the annulus that is closest to the given
point
:
- If the point is outside of the annulus completely, the returned point will be on the outer perimeter.
- If the point is inside of the inner circle (hole) of the annulus, the returned point will be on the inner perimeter.
- Otherwise, the returned point is overlapping the annulus and returned as is.
Arguments
- _self :
Annulus
- No Documentation 🚧 - point :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
diameter
Get the diameter of the annulus
Arguments
- _self :
Annulus
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Annulus
- No Documentation 🚧 - other :
Annulus
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Create a new [
Annulus
] from the radii of the inner and outer circle
Arguments
- inner_radius :
f32
- No Documentation 🚧 - outer_radius :
f32
- No Documentation 🚧
Returns
- arg0 :
Annulus
- No Documentation 🚧
thickness
Get the thickness of the annulus
Arguments
- _self :
Annulus
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
Arc2d
Arc2d
- radius : f32
- half_angle : f32
Description
A primitive representing an arc between two points on a circle.
An arc has no area. If you want to include the portion of a circle's area swept out by the arc, use the pie-shaped [
CircularSector
]. If you want to include only the space inside the convex hull of the arc, use the bowl-shaped [CircularSegment
].The arc is drawn starting from [
Vec2::Y
], extending byhalf_angle
radians on either side. The center of the circle is the origin [Vec2::ZERO
]. Note that this means that the origin may not be within theArc2d
's convex hull.Warning: Arcs with negative angle or radius, or with angle greater than an entire circle, are not officially supported. It is recommended to normalize arcs to have an angle in [0, 2π].
Functions
angle
Get the angle of the arc
Arguments
- _self :
Arc2d
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
apothem
Get the length of the apothem of this arc, that is, the distance from the center of the circle to the midpoint of the chord, in the direction of the midpoint of the arc. Equivalently, the
radius
minus thesagitta
. Note that for amajor
arc, the apothem will be negative.
Arguments
- _self :
Arc2d
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
chord_length
Get the distance between the endpoints (the length of the chord)
Arguments
- _self :
Arc2d
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
chord_midpoint
Get the midpoint of the two endpoints (the midpoint of the chord)
Arguments
- _self :
Arc2d
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Arc2d
- No Documentation 🚧
Returns
- arg0 :
Arc2d
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Arc2d
- No Documentation 🚧 - other :
Arc2d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_degrees
Create a new [
Arc2d
] from aradius
and anangle
in degrees.
Arguments
- radius :
f32
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Arc2d
- No Documentation 🚧
from_radians
Create a new [
Arc2d
] from aradius
and anangle
in radians
Arguments
- radius :
f32
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Arc2d
- No Documentation 🚧
from_turns
Create a new [
Arc2d
] from aradius
and afraction
of a single turn. For instance,0.5
turns is a semicircle.
Arguments
- radius :
f32
- No Documentation 🚧 - fraction :
f32
- No Documentation 🚧
Returns
- arg0 :
Arc2d
- No Documentation 🚧
half_chord_length
Get half the distance between the endpoints (half the length of the chord)
Arguments
- _self :
Arc2d
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
is_major
Produces true if the arc is at least half a circle. Note: This is not the negation of
is_minor
: an exact semicircle is both major and minor.
Arguments
- _self :
Arc2d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_minor
Produces true if the arc is at most half a circle. Note: This is not the negation of
is_major
: an exact semicircle is both major and minor.
Arguments
- _self :
Arc2d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
left_endpoint
Get the left-hand end point of the arc
Arguments
- _self :
Arc2d
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
length
Get the length of the arc
Arguments
- _self :
Arc2d
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
midpoint
Get the midpoint of the arc
Arguments
- _self :
Arc2d
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
new
Create a new [
Arc2d
] from aradius
and ahalf_angle
Arguments
- radius :
f32
- No Documentation 🚧 - half_angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Arc2d
- No Documentation 🚧
right_endpoint
Get the right-hand end point of the arc
Arguments
- _self :
Arc2d
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
sagitta
Get the length of the sagitta of this arc, that is, the length of the line between the midpoints of the arc and its chord. Equivalently, the height of the triangle whose base is the chord and whose apex is the midpoint of the arc. The sagitta is also the sum of the
radius
and theapothem
.
Arguments
- _self :
Arc2d
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
Capsule2d
Capsule2d
- radius : f32
- half_length : f32
Description
A 2D capsule primitive, also known as a stadium or pill shape.
A two-dimensional capsule is defined as a neighborhood of points at a distance (radius) from a line
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
new(radius, length) | Create a new `Capsule2d` from a radius and length |
to_inner_rectangle(_self) | Get the part connecting the semicircular ends of the capsule as a [`Rectangle`] |
clone
No Documentation 🚧
Arguments
- _self :
Capsule2d
- No Documentation 🚧
Returns
- arg0 :
Capsule2d
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Capsule2d
- No Documentation 🚧 - other :
Capsule2d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Create a new
Capsule2d
from a radius and length
Arguments
- radius :
f32
- No Documentation 🚧 - length :
f32
- No Documentation 🚧
Returns
- arg0 :
Capsule2d
- No Documentation 🚧
to_inner_rectangle
Get the part connecting the semicircular ends of the capsule as a [
Rectangle
]
Arguments
- _self :
Capsule2d
- No Documentation 🚧
Returns
- arg0 :
Rectangle
- No Documentation 🚧
Circle
Circle
- radius : f32
Description
A circle primitive, representing the set of points some distance from the origin
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
closest_point(_self, point) | Finds the point on the circle that is closest to the given `point`. If the point is outside the ci |
diameter(_self) | Get the diameter of the circle |
eq(_self, other) | No Documentation 🚧 |
new(radius) | Create a new [`Circle`] from a `radius` |
clone
No Documentation 🚧
Arguments
- _self :
Circle
- No Documentation 🚧
Returns
- arg0 :
Circle
- No Documentation 🚧
closest_point
Finds the point on the circle that is closest to the given
point
. If the point is outside the circle, the returned point will be on the perimeter of the circle. Otherwise, it will be inside the circle and returned as is.
Arguments
- _self :
Circle
- No Documentation 🚧 - point :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
diameter
Get the diameter of the circle
Arguments
- _self :
Circle
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Circle
- No Documentation 🚧 - other :
Circle
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Create a new [
Circle
] from aradius
Arguments
- radius :
f32
- No Documentation 🚧
Returns
- arg0 :
Circle
- No Documentation 🚧
CircularSector
CircularSector
- arc : bevy_math::primitives::dim2::Arc2d
Description
A primitive representing a circular sector: a pie slice of a circle.
The segment is positioned so that it always includes [
Vec2::Y
] and is vertically symmetrical. To orient the sector differently, apply a rotation. The sector is drawn with the center of its circle at the origin [Vec2::ZERO
].Warning: Circular sectors with negative angle or radius, or with angle greater than an entire circle, are not officially supported. We recommend normalizing circular sectors to have an angle in [0, 2π].
Functions
angle
Get the angle of the sector
Arguments
- _self :
CircularSector
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
apothem
Get the length of the apothem of this sector See [
Arc2d::apothem
]
Arguments
- _self :
CircularSector
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
arc_length
Get the length of the arc defining the sector
Arguments
- _self :
CircularSector
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
chord_length
Get the length of the chord defined by the sector See [
Arc2d::chord_length
]
Arguments
- _self :
CircularSector
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
chord_midpoint
Get the midpoint of the chord defined by the sector See [
Arc2d::chord_midpoint
]
Arguments
- _self :
CircularSector
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
CircularSector
- No Documentation 🚧
Returns
- arg0 :
CircularSector
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
CircularSector
- No Documentation 🚧 - other :
CircularSector
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_degrees
Create a new [
CircularSector
] from aradius
and anangle
in degrees.
Arguments
- radius :
f32
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
CircularSector
- No Documentation 🚧
from_radians
Create a new [
CircularSector
] from aradius
and anangle
in radians.
Arguments
- radius :
f32
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
CircularSector
- No Documentation 🚧
from_turns
Create a new [
CircularSector
] from aradius
and a number ofturns
of a circle. For instance,0.5
turns is a semicircle.
Arguments
- radius :
f32
- No Documentation 🚧 - fraction :
f32
- No Documentation 🚧
Returns
- arg0 :
CircularSector
- No Documentation 🚧
half_angle
Get half the angle of the sector
Arguments
- _self :
CircularSector
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
half_chord_length
Get half the length of the chord defined by the sector See [
Arc2d::half_chord_length
]
Arguments
- _self :
CircularSector
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
new
Create a new [
CircularSector
] from aradius
and anangle
Arguments
- radius :
f32
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
CircularSector
- No Documentation 🚧
radius
Get the radius of the sector
Arguments
- _self :
CircularSector
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
sagitta
Get the length of the sagitta of this sector See [
Arc2d::sagitta
]
Arguments
- _self :
CircularSector
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
CircularSegment
CircularSegment
- arc : bevy_math::primitives::dim2::Arc2d
Description
A primitive representing a circular segment: the area enclosed by the arc of a circle and its chord (the line between its endpoints).
The segment is drawn starting from [
Vec2::Y
], extending equally on either side. To orient the segment differently, apply a rotation. The segment is drawn with the center of its circle at the origin [Vec2::ZERO
]. When positioning a segment, theapothem
function may be particularly useful.Warning: Circular segments with negative angle or radius, or with angle greater than an entire circle, are not officially supported. We recommend normalizing circular segments to have an angle in [0, 2π].
Functions
angle
Get the angle of the segment
Arguments
- _self :
CircularSegment
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
apothem
Get the length of the apothem of this segment, which is the signed distance between the segment and the center of its circle See [
Arc2d::apothem
]
Arguments
- _self :
CircularSegment
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
arc_length
Get the length of the arc defining the segment
Arguments
- _self :
CircularSegment
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
chord_length
Get the length of the segment's base, also known as its chord
Arguments
- _self :
CircularSegment
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
chord_midpoint
Get the midpoint of the segment's base, also known as its chord
Arguments
- _self :
CircularSegment
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
CircularSegment
- No Documentation 🚧
Returns
- arg0 :
CircularSegment
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
CircularSegment
- No Documentation 🚧 - other :
CircularSegment
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_degrees
Create a new [
CircularSegment
] from aradius
and anangle
in degrees.
Arguments
- radius :
f32
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
CircularSegment
- No Documentation 🚧
from_radians
Create a new [
CircularSegment
] from aradius
and anangle
in radians.
Arguments
- radius :
f32
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
CircularSegment
- No Documentation 🚧
from_turns
Create a new [
CircularSegment
] from aradius
and a number ofturns
of a circle. For instance,0.5
turns is a semicircle.
Arguments
- radius :
f32
- No Documentation 🚧 - fraction :
f32
- No Documentation 🚧
Returns
- arg0 :
CircularSegment
- No Documentation 🚧
half_angle
Get the half-angle of the segment
Arguments
- _self :
CircularSegment
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
half_chord_length
Get half the length of the segment's base, also known as its chord
Arguments
- _self :
CircularSegment
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
new
Create a new [
CircularSegment
] from aradius
, and anangle
Arguments
- radius :
f32
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
CircularSegment
- No Documentation 🚧
radius
Get the radius of the segment
Arguments
- _self :
CircularSegment
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
sagitta
Get the length of the sagitta of this segment, also known as its height See [
Arc2d::sagitta
]
Arguments
- _self :
CircularSegment
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
Ellipse
Ellipse
- half_size : glam::Vec2
Description
An ellipse primitive, which is like a circle, but the width and height can be different
Functions
clone
No Documentation 🚧
Arguments
- _self :
Ellipse
- No Documentation 🚧
Returns
- arg0 :
Ellipse
- No Documentation 🚧
eccentricity
Returns the eccentricity of the ellipse. It can be thought of as a measure of how "stretched" or elongated the ellipse is. The value should be in the range [0, 1), where 0 represents a circle, and 1 represents a parabola.
Arguments
- _self :
Ellipse
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Ellipse
- No Documentation 🚧 - other :
Ellipse
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
focal_length
Get the focal length of the ellipse. This corresponds to the distance between one of the foci and the center of the ellipse. The focal length of an ellipse is related to its eccentricity by
eccentricity = focal_length / semi_major
Arguments
- _self :
Ellipse
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
from_size
Create a new
Ellipse
from a given full size.size.x
is the diameter along the X axis, andsize.y
is the diameter along the Y axis.
Arguments
- size :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Ellipse
- No Documentation 🚧
new
Create a new
Ellipse
from half of its width and height. This corresponds to the two perpendicular radii defining the ellipse.
Arguments
- half_width :
f32
- No Documentation 🚧 - half_height :
f32
- No Documentation 🚧
Returns
- arg0 :
Ellipse
- No Documentation 🚧
semi_major
Returns the length of the semi-major axis. This corresponds to the longest radius of the ellipse.
Arguments
- _self :
Ellipse
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
semi_minor
Returns the length of the semi-minor axis. This corresponds to the shortest radius of the ellipse.
Arguments
- _self :
Ellipse
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
Line2d
Line2d
- direction : bevy_math::direction::Dir2
Description
An infinite line going through the origin along a direction in 2D space.
For a finite line: [
Segment2d
]
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
Line2d
- No Documentation 🚧
Returns
- arg0 :
Line2d
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Line2d
- No Documentation 🚧 - other :
Line2d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
Plane2d
Plane2d
- normal : bevy_math::direction::Dir2
Description
An unbounded plane in 2D space. It forms a separating surface through the origin, stretching infinitely far
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
new(normal) | Create a new `Plane2d` from a normal # Panics Panics if the given `normal` is zero (or very close |
clone
No Documentation 🚧
Arguments
- _self :
Plane2d
- No Documentation 🚧
Returns
- arg0 :
Plane2d
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Plane2d
- No Documentation 🚧 - other :
Plane2d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Create a new
Plane2d
from a normalPanics
Panics if the given
normal
is zero (or very close to zero), or non-finite.
Arguments
- normal :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Plane2d
- No Documentation 🚧
Rectangle
Rectangle
- half_size : glam::Vec2
Description
A rectangle primitive, which is like a square, except that the width and height can be different
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
closest_point(_self, point) | Finds the point on the rectangle that is closest to the given `point`. If the point is outside the |
eq(_self, other) | No Documentation 🚧 |
from_corners(point1, point2) | Create a new `Rectangle` from two corner points |
from_length(length) | Create a `Rectangle` from a single length. The resulting `Rectangle` will be the same size in ever |
from_size(size) | Create a new `Rectangle` from a given full size |
new(width, height) | Create a new `Rectangle` from a full width and height |
size(_self) | Get the size of the rectangle |
clone
No Documentation 🚧
Arguments
- _self :
Rectangle
- No Documentation 🚧
Returns
- arg0 :
Rectangle
- No Documentation 🚧
closest_point
Finds the point on the rectangle that is closest to the given
point
. If the point is outside the rectangle, the returned point will be on the perimeter of the rectangle. Otherwise, it will be inside the rectangle and returned as is.
Arguments
- _self :
Rectangle
- No Documentation 🚧 - point :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Rectangle
- No Documentation 🚧 - other :
Rectangle
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_corners
Create a new
Rectangle
from two corner points
Arguments
- point1 :
Vec2
- No Documentation 🚧 - point2 :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Rectangle
- No Documentation 🚧
from_length
Create a
Rectangle
from a single length. The resultingRectangle
will be the same size in every direction.
Arguments
- length :
f32
- No Documentation 🚧
Returns
- arg0 :
Rectangle
- No Documentation 🚧
from_size
Create a new
Rectangle
from a given full size
Arguments
- size :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Rectangle
- No Documentation 🚧
new
Create a new
Rectangle
from a full width and height
Arguments
- width :
f32
- No Documentation 🚧 - height :
f32
- No Documentation 🚧
Returns
- arg0 :
Rectangle
- No Documentation 🚧
size
Get the size of the rectangle
Arguments
- _self :
Rectangle
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
RegularPolygon
RegularPolygon
- circumcircle : bevy_math::primitives::dim2::Circle
- sides : u32
Description
A polygon centered on the origin where all vertices lie on a circle, equally far apart.
Functions
circumradius
Get the radius of the circumcircle on which all vertices of the regular polygon lie
Arguments
- _self :
RegularPolygon
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
RegularPolygon
- No Documentation 🚧
Returns
- arg0 :
RegularPolygon
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
RegularPolygon
- No Documentation 🚧 - other :
RegularPolygon
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
external_angle_degrees
Get the external angle of the regular polygon in degrees. This is the angle formed by two adjacent sides with points within the angle being in the exterior of the polygon
Arguments
- _self :
RegularPolygon
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
external_angle_radians
Get the external angle of the regular polygon in radians. This is the angle formed by two adjacent sides with points within the angle being in the exterior of the polygon
Arguments
- _self :
RegularPolygon
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
inradius
Get the inradius or apothem of the regular polygon. This is the radius of the largest circle that can be drawn within the polygon
Arguments
- _self :
RegularPolygon
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
internal_angle_degrees
Get the internal angle of the regular polygon in degrees. This is the angle formed by two adjacent sides with points within the angle being in the interior of the polygon
Arguments
- _self :
RegularPolygon
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
internal_angle_radians
Get the internal angle of the regular polygon in radians. This is the angle formed by two adjacent sides with points within the angle being in the interior of the polygon
Arguments
- _self :
RegularPolygon
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
new
Create a new
RegularPolygon
from the radius of the circumcircle and a number of sidesPanics
Panics if
circumradius
is negative
Arguments
- circumradius :
f32
- No Documentation 🚧 - sides :
u32
- No Documentation 🚧
Returns
- arg0 :
RegularPolygon
- No Documentation 🚧
side_length
Get the length of one side of the regular polygon
Arguments
- _self :
RegularPolygon
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
Rhombus
Rhombus
- half_diagonals : glam::Vec2
Description
A rhombus primitive, also known as a diamond shape. A four sided polygon, centered on the origin, where opposite sides are parallel but without requiring right angles.
Functions
Function | Summary |
---|---|
circumradius(_self) | Get the radius of the circumcircle on which all vertices of the rhombus lie |
clone(_self) | No Documentation 🚧 |
closest_point(_self, point) | Finds the point on the rhombus that is closest to the given `point`. If the point is outside the r |
eq(_self, other) | No Documentation 🚧 |
from_inradius(inradius) | Create a new `Rhombus` from a given inradius with all inner angles equal. |
from_side(side) | Create a new `Rhombus` from a side length with all inner angles equal. |
inradius(_self) | Get the radius of the largest circle that can be drawn within the rhombus |
new(horizontal_diagonal, vertical_diagonal) | Create a new `Rhombus` from a vertical and horizontal diagonal sizes. |
side(_self) | Get the length of each side of the rhombus |
circumradius
Get the radius of the circumcircle on which all vertices of the rhombus lie
Arguments
- _self :
Rhombus
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Rhombus
- No Documentation 🚧
Returns
- arg0 :
Rhombus
- No Documentation 🚧
closest_point
Finds the point on the rhombus that is closest to the given
point
. If the point is outside the rhombus, the returned point will be on the perimeter of the rhombus. Otherwise, it will be inside the rhombus and returned as is.
Arguments
- _self :
Rhombus
- No Documentation 🚧 - point :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Rhombus
- No Documentation 🚧 - other :
Rhombus
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_inradius
Create a new
Rhombus
from a given inradius with all inner angles equal.
Arguments
- inradius :
f32
- No Documentation 🚧
Returns
- arg0 :
Rhombus
- No Documentation 🚧
from_side
Create a new
Rhombus
from a side length with all inner angles equal.
Arguments
- side :
f32
- No Documentation 🚧
Returns
- arg0 :
Rhombus
- No Documentation 🚧
inradius
Get the radius of the largest circle that can be drawn within the rhombus
Arguments
- _self :
Rhombus
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
new
Create a new
Rhombus
from a vertical and horizontal diagonal sizes.
Arguments
- horizontal_diagonal :
f32
- No Documentation 🚧 - vertical_diagonal :
f32
- No Documentation 🚧
Returns
- arg0 :
Rhombus
- No Documentation 🚧
side
Get the length of each side of the rhombus
Arguments
- _self :
Rhombus
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
Segment2d
Segment2d
- direction : bevy_math::direction::Dir2
- half_length : f32
Description
A segment of a line going through the origin along a direction in 2D space.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
new(direction, length) | Create a new `Segment2d` from a direction and full length of the segment |
point1(_self) | Get the position of the first point on the line segment |
point2(_self) | Get the position of the second point on the line segment |
clone
No Documentation 🚧
Arguments
- _self :
Segment2d
- No Documentation 🚧
Returns
- arg0 :
Segment2d
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Segment2d
- No Documentation 🚧 - other :
Segment2d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Create a new
Segment2d
from a direction and full length of the segment
Arguments
- direction :
Dir2
- No Documentation 🚧 - length :
f32
- No Documentation 🚧
Returns
- arg0 :
Segment2d
- No Documentation 🚧
point1
Get the position of the first point on the line segment
Arguments
- _self :
Segment2d
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
point2
Get the position of the second point on the line segment
Arguments
- _self :
Segment2d
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
Triangle2d
Triangle2d
- vertices : [glam::Vec2; 3]
Description
A triangle in 2D space
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
is_acute(_self) | Checks if the triangle is acute, meaning all angles are less than 90 degrees |
is_degenerate(_self) | Checks if the triangle is degenerate, meaning it has zero area. A triangle is degenerate if the cr |
is_obtuse(_self) | Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees |
new(a, b, c) | Create a new `Triangle2d` from points `a`, `b`, and `c` |
reverse(_self) | Reverse the [`WindingOrder`] of the triangle by swapping the first and last vertices. |
reversed(_self) | This triangle but reversed. |
clone
No Documentation 🚧
Arguments
- _self :
Triangle2d
- No Documentation 🚧
Returns
- arg0 :
Triangle2d
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Triangle2d
- No Documentation 🚧 - other :
Triangle2d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_acute
Checks if the triangle is acute, meaning all angles are less than 90 degrees
Arguments
- _self :
Triangle2d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_degenerate
Checks if the triangle is degenerate, meaning it has zero area. A triangle is degenerate if the cross product of the vectors
ab
andac
has a length less than10e-7
. This indicates that the three vertices are collinear or nearly collinear.
Arguments
- _self :
Triangle2d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_obtuse
Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees
Arguments
- _self :
Triangle2d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Create a new
Triangle2d
from pointsa
,b
, andc
Arguments
- a :
Vec2
- No Documentation 🚧 - b :
Vec2
- No Documentation 🚧 - c :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Triangle2d
- No Documentation 🚧
reverse
Reverse the [
WindingOrder
] of the triangle by swapping the first and last vertices.
Arguments
- _self :
Triangle2d
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
reversed
This triangle but reversed.
Arguments
- _self :
Triangle2d
- No Documentation 🚧
Returns
- arg0 :
Triangle2d
- No Documentation 🚧
Capsule3d
Capsule3d
- radius : f32
- half_length : f32
Description
A 3D capsule primitive centered on the origin A three-dimensional capsule is defined as a surface at a distance (radius) from a line
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
new(radius, length) | Create a new `Capsule3d` from a radius and length |
to_cylinder(_self) | Get the part connecting the hemispherical ends of the capsule as a [`Cylinder`] |
clone
No Documentation 🚧
Arguments
- _self :
Capsule3d
- No Documentation 🚧
Returns
- arg0 :
Capsule3d
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Capsule3d
- No Documentation 🚧 - other :
Capsule3d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Create a new
Capsule3d
from a radius and length
Arguments
- radius :
f32
- No Documentation 🚧 - length :
f32
- No Documentation 🚧
Returns
- arg0 :
Capsule3d
- No Documentation 🚧
to_cylinder
Get the part connecting the hemispherical ends of the capsule as a [
Cylinder
]
Arguments
- _self :
Capsule3d
- No Documentation 🚧
Returns
- arg0 :
Cylinder
- No Documentation 🚧
Cone
Cone
- radius : f32
- height : f32
Description
A cone primitive centered on the midpoint between the tip of the cone and the center of its base.
The cone is oriented with its tip pointing towards the Y axis.
Functions
Function | Summary |
---|---|
base(_self) | Get the base of the cone as a [`Circle`] |
base_area(_self) | Get the surface area of the base of the cone |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
lateral_area(_self) | Get the surface area of the side of the cone, also known as the lateral area |
new(radius, height) | Create a new [`Cone`] from a radius and height. |
slant_height(_self) | Get the slant height of the cone, the length of the line segment connecting a point on the base to |
base
Get the base of the cone as a [
Circle
]
Arguments
- _self :
Cone
- No Documentation 🚧
Returns
- arg0 :
Circle
- No Documentation 🚧
base_area
Get the surface area of the base of the cone
Arguments
- _self :
Cone
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Cone
- No Documentation 🚧
Returns
- arg0 :
Cone
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Cone
- No Documentation 🚧 - other :
Cone
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
lateral_area
Get the surface area of the side of the cone, also known as the lateral area
Arguments
- _self :
Cone
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
new
Create a new [
Cone
] from a radius and height.
Arguments
- radius :
f32
- No Documentation 🚧 - height :
f32
- No Documentation 🚧
Returns
- arg0 :
Cone
- No Documentation 🚧
slant_height
Get the slant height of the cone, the length of the line segment connecting a point on the base to the apex
Arguments
- _self :
Cone
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
ConicalFrustum
ConicalFrustum
- radius_top : f32
- radius_bottom : f32
- height : f32
Description
A conical frustum primitive. A conical frustum can be created by slicing off a section of a cone.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
ConicalFrustum
- No Documentation 🚧
Returns
- arg0 :
ConicalFrustum
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
ConicalFrustum
- No Documentation 🚧 - other :
ConicalFrustum
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
Cuboid
Cuboid
- half_size : glam::Vec3
Description
A cuboid primitive, which is like a cube, except that the x, y, and z dimensions are not required to be the same.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
closest_point(_self, point) | Finds the point on the cuboid that is closest to the given `point`. If the point is outside the cu |
eq(_self, other) | No Documentation 🚧 |
from_corners(point1, point2) | Create a new `Cuboid` from two corner points |
from_length(length) | Create a `Cuboid` from a single length. The resulting `Cuboid` will be the same size in every dire |
from_size(size) | Create a new `Cuboid` from a given full size |
new(x_length, y_length, z_length) | Create a new `Cuboid` from a full x, y, and z length |
size(_self) | Get the size of the cuboid |
clone
No Documentation 🚧
Arguments
- _self :
Cuboid
- No Documentation 🚧
Returns
- arg0 :
Cuboid
- No Documentation 🚧
closest_point
Finds the point on the cuboid that is closest to the given
point
. If the point is outside the cuboid, the returned point will be on the surface of the cuboid. Otherwise, it will be inside the cuboid and returned as is.
Arguments
- _self :
Cuboid
- No Documentation 🚧 - point :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Cuboid
- No Documentation 🚧 - other :
Cuboid
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_corners
Create a new
Cuboid
from two corner points
Arguments
- point1 :
Vec3
- No Documentation 🚧 - point2 :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Cuboid
- No Documentation 🚧
from_length
Create a
Cuboid
from a single length. The resultingCuboid
will be the same size in every direction.
Arguments
- length :
f32
- No Documentation 🚧
Returns
- arg0 :
Cuboid
- No Documentation 🚧
from_size
Create a new
Cuboid
from a given full size
Arguments
- size :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Cuboid
- No Documentation 🚧
new
Create a new
Cuboid
from a full x, y, and z length
Arguments
- x_length :
f32
- No Documentation 🚧 - y_length :
f32
- No Documentation 🚧 - z_length :
f32
- No Documentation 🚧
Returns
- arg0 :
Cuboid
- No Documentation 🚧
size
Get the size of the cuboid
Arguments
- _self :
Cuboid
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
Cylinder
Cylinder
- radius : f32
- half_height : f32
Description
A cylinder primitive centered on the origin
Functions
Function | Summary |
---|---|
base(_self) | Get the base of the cylinder as a [`Circle`] |
base_area(_self) | Get the surface area of one base of the cylinder |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
lateral_area(_self) | Get the surface area of the side of the cylinder, also known as the lateral area |
new(radius, height) | Create a new `Cylinder` from a radius and full height |
base
Get the base of the cylinder as a [
Circle
]
Arguments
- _self :
Cylinder
- No Documentation 🚧
Returns
- arg0 :
Circle
- No Documentation 🚧
base_area
Get the surface area of one base of the cylinder
Arguments
- _self :
Cylinder
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Cylinder
- No Documentation 🚧
Returns
- arg0 :
Cylinder
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Cylinder
- No Documentation 🚧 - other :
Cylinder
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
lateral_area
Get the surface area of the side of the cylinder, also known as the lateral area
Arguments
- _self :
Cylinder
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
new
Create a new
Cylinder
from a radius and full height
Arguments
- radius :
f32
- No Documentation 🚧 - height :
f32
- No Documentation 🚧
Returns
- arg0 :
Cylinder
- No Documentation 🚧
InfinitePlane3d
InfinitePlane3d
- normal : bevy_math::direction::Dir3
Description
An unbounded plane in 3D space. It forms a separating surface through the origin, stretching infinitely far
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
isometry_from_xy(_self, origin) | Computes an [`Isometry3d`] which transforms points from the XY-plane to this plane with the given `origin`. ## Guarantees * the transformation is a [congruence] |
isometry_into_xy(_self, origin) | Computes an [`Isometry3d`] which transforms points from the plane in 3D space with the given `origin` to the XY-plane. ## Guarantees * the transformation is a [congruence] |
clone
No Documentation 🚧
Arguments
- _self :
InfinitePlane3d
- No Documentation 🚧
Returns
- arg0 :
InfinitePlane3d
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
InfinitePlane3d
- No Documentation 🚧 - other :
InfinitePlane3d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
isometry_from_xy
Computes an [
Isometry3d
] which transforms points from the XY-plane to this plane with the givenorigin
.Guarantees
- the transformation is a [congruence] meaning it will preserve all distances and angles of the transformed geometry
- uses the least rotation possible to transform the geometry
- if two geometries are transformed with the same isometry, then the relations between them, like distances, are also preserved
- compared to projections, the transformation is lossless (up to floating point errors) reversible
Non-Guarantees
- the rotation used is generally not unique
- the orientation of the transformed geometry in the XY plane might be arbitrary, to enforce some kind of alignment the user has to use an extra transformation ontop of this one See [
isometries_xy
] for example usescases. [congruence]: https://en.wikipedia.org/wiki/Congruence_(geometry) [isometries_xy
]:InfinitePlane3d::isometries_xy
Arguments
- _self :
InfinitePlane3d
- No Documentation 🚧 - origin :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Isometry3d
- No Documentation 🚧
isometry_into_xy
Computes an [
Isometry3d
] which transforms points from the plane in 3D space with the givenorigin
to the XY-plane.Guarantees
- the transformation is a [congruence] meaning it will preserve all distances and angles of the transformed geometry
- uses the least rotation possible to transform the geometry
- if two geometries are transformed with the same isometry, then the relations between them, like distances, are also preserved
- compared to projections, the transformation is lossless (up to floating point errors) reversible
Non-Guarantees
- the rotation used is generally not unique
- the orientation of the transformed geometry in the XY plane might be arbitrary, to enforce some kind of alignment the user has to use an extra transformation ontop of this one See [
isometries_xy
] for example usescases. [congruence]: https://en.wikipedia.org/wiki/Congruence_(geometry) [isometries_xy
]:InfinitePlane3d::isometries_xy
Arguments
- _self :
InfinitePlane3d
- No Documentation 🚧 - origin :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Isometry3d
- No Documentation 🚧
Line3d
Line3d
- direction : bevy_math::direction::Dir3
Description
An infinite line going through the origin along a direction in 3D space.
For a finite line: [
Segment3d
]
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
Line3d
- No Documentation 🚧
Returns
- arg0 :
Line3d
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Line3d
- No Documentation 🚧 - other :
Line3d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
Plane3d
Plane3d
- normal : bevy_math::direction::Dir3
- half_size : glam::Vec2
Description
A bounded plane in 3D space. It forms a surface starting from the origin with a defined height and width.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
new(normal, half_size) | Create a new `Plane3d` from a normal and a half size # Panics Panics if the given `normal` is zer |
clone
No Documentation 🚧
Arguments
- _self :
Plane3d
- No Documentation 🚧
Returns
- arg0 :
Plane3d
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Plane3d
- No Documentation 🚧 - other :
Plane3d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Create a new
Plane3d
from a normal and a half sizePanics
Panics if the given
normal
is zero (or very close to zero), or non-finite.
Arguments
- normal :
Vec3
- No Documentation 🚧 - half_size :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Plane3d
- No Documentation 🚧
Segment3d
Segment3d
- direction : bevy_math::direction::Dir3
- half_length : f32
Description
A segment of a line going through the origin along a direction in 3D space.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
new(direction, length) | Create a new `Segment3d` from a direction and full length of the segment |
point1(_self) | Get the position of the first point on the line segment |
point2(_self) | Get the position of the second point on the line segment |
clone
No Documentation 🚧
Arguments
- _self :
Segment3d
- No Documentation 🚧
Returns
- arg0 :
Segment3d
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Segment3d
- No Documentation 🚧 - other :
Segment3d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Create a new
Segment3d
from a direction and full length of the segment
Arguments
- direction :
Dir3
- No Documentation 🚧 - length :
f32
- No Documentation 🚧
Returns
- arg0 :
Segment3d
- No Documentation 🚧
point1
Get the position of the first point on the line segment
Arguments
- _self :
Segment3d
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
point2
Get the position of the second point on the line segment
Arguments
- _self :
Segment3d
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
Sphere
Sphere
- radius : f32
Description
A sphere primitive, representing the set of all points some distance from the origin
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
closest_point(_self, point) | Finds the point on the sphere that is closest to the given `point`. If the point is outside the sp |
diameter(_self) | Get the diameter of the sphere |
eq(_self, other) | No Documentation 🚧 |
new(radius) | Create a new [`Sphere`] from a `radius` |
clone
No Documentation 🚧
Arguments
- _self :
Sphere
- No Documentation 🚧
Returns
- arg0 :
Sphere
- No Documentation 🚧
closest_point
Finds the point on the sphere that is closest to the given
point
. If the point is outside the sphere, the returned point will be on the surface of the sphere. Otherwise, it will be inside the sphere and returned as is.
Arguments
- _self :
Sphere
- No Documentation 🚧 - point :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
diameter
Get the diameter of the sphere
Arguments
- _self :
Sphere
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Sphere
- No Documentation 🚧 - other :
Sphere
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Create a new [
Sphere
] from aradius
Arguments
- radius :
f32
- No Documentation 🚧
Returns
- arg0 :
Sphere
- No Documentation 🚧
Tetrahedron
Tetrahedron
- vertices : [glam::Vec3; 4]
Description
A tetrahedron primitive.
Functions
Function | Summary |
---|---|
centroid(_self) | Get the centroid of the tetrahedron. This function finds the geometric center of the tetrahedron |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
new(a, b, c, d) | Create a new [`Tetrahedron`] from points `a`, `b`, `c` and `d`. |
signed_volume(_self) | Get the signed volume of the tetrahedron. If it's negative, the normal vector of the face defined |
centroid
Get the centroid of the tetrahedron. This function finds the geometric center of the tetrahedron by averaging the vertices:
centroid = (a + b + c + d) / 4
.
Arguments
- _self :
Tetrahedron
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Tetrahedron
- No Documentation 🚧
Returns
- arg0 :
Tetrahedron
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Tetrahedron
- No Documentation 🚧 - other :
Tetrahedron
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Create a new [
Tetrahedron
] from pointsa
,b
,c
andd
.
Arguments
- a :
Vec3
- No Documentation 🚧 - b :
Vec3
- No Documentation 🚧 - c :
Vec3
- No Documentation 🚧 - d :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Tetrahedron
- No Documentation 🚧
signed_volume
Get the signed volume of the tetrahedron. If it's negative, the normal vector of the face defined by the first three points using the right-hand rule points away from the fourth vertex.
Arguments
- _self :
Tetrahedron
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
Torus
Torus
- minor_radius : f32
- major_radius : f32
Description
A torus primitive, often representing a ring or donut shape The set of points some distance from a circle centered at the origin
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
inner_radius(_self) | Get the inner radius of the torus. For a ring torus, this corresponds to the radius of the hole, |
new(inner_radius, outer_radius) | Create a new `Torus` from an inner and outer radius. The inner radius is the radius of the hole, a |
outer_radius(_self) | Get the outer radius of the torus. This corresponds to the overall radius of the entire object, o |
clone
No Documentation 🚧
Arguments
- _self :
Torus
- No Documentation 🚧
Returns
- arg0 :
Torus
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Torus
- No Documentation 🚧 - other :
Torus
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
inner_radius
Get the inner radius of the torus. For a ring torus, this corresponds to the radius of the hole, or
major_radius - minor_radius
Arguments
- _self :
Torus
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
new
Create a new
Torus
from an inner and outer radius. The inner radius is the radius of the hole, and the outer radius is the radius of the entire object
Arguments
- inner_radius :
f32
- No Documentation 🚧 - outer_radius :
f32
- No Documentation 🚧
Returns
- arg0 :
Torus
- No Documentation 🚧
outer_radius
Get the outer radius of the torus. This corresponds to the overall radius of the entire object, or
major_radius + minor_radius
Arguments
- _self :
Torus
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
Triangle3d
Triangle3d
- vertices : [glam::Vec3; 3]
Description
A 3D triangle primitive.
Functions
Function | Summary |
---|---|
centroid(_self) | Get the centroid of the triangle. This function finds the geometric center of the triangle by aver |
circumcenter(_self) | Get the circumcenter of the triangle. |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
is_acute(_self) | Checks if the triangle is acute, meaning all angles are less than 90 degrees |
is_degenerate(_self) | Checks if the triangle is degenerate, meaning it has zero area. A triangle is degenerate if the cr |
is_obtuse(_self) | Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees |
new(a, b, c) | Create a new [`Triangle3d`] from points `a`, `b`, and `c`. |
reverse(_self) | Reverse the triangle by swapping the first and last vertices. |
reversed(_self) | This triangle but reversed. |
centroid
Get the centroid of the triangle. This function finds the geometric center of the triangle by averaging the vertices:
centroid = (a + b + c) / 3
.
Arguments
- _self :
Triangle3d
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
circumcenter
Get the circumcenter of the triangle.
Arguments
- _self :
Triangle3d
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Triangle3d
- No Documentation 🚧
Returns
- arg0 :
Triangle3d
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Triangle3d
- No Documentation 🚧 - other :
Triangle3d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_acute
Checks if the triangle is acute, meaning all angles are less than 90 degrees
Arguments
- _self :
Triangle3d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_degenerate
Checks if the triangle is degenerate, meaning it has zero area. A triangle is degenerate if the cross product of the vectors
ab
andac
has a length less than10e-7
. This indicates that the three vertices are collinear or nearly collinear.
Arguments
- _self :
Triangle3d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_obtuse
Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees
Arguments
- _self :
Triangle3d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Create a new [
Triangle3d
] from pointsa
,b
, andc
.
Arguments
- a :
Vec3
- No Documentation 🚧 - b :
Vec3
- No Documentation 🚧 - c :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Triangle3d
- No Documentation 🚧
reverse
Reverse the triangle by swapping the first and last vertices.
Arguments
- _self :
Triangle3d
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
reversed
This triangle but reversed.
Arguments
- _self :
Triangle3d
- No Documentation 🚧
Returns
- arg0 :
Triangle3d
- No Documentation 🚧
Ray2d
Ray2d
- origin : glam::Vec2
- direction : bevy_math::direction::Dir2
Description
An infinite half-line starting at
origin
and going indirection
in 2D space.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
get_point(_self, distance) | Get a point at a given distance along the ray |
intersect_plane(_self, plane_origin, plane) | Get the distance to a plane if the ray intersects it |
new(origin, direction) | Create a new `Ray2d` from a given origin and direction |
clone
No Documentation 🚧
Arguments
- _self :
Ray2d
- No Documentation 🚧
Returns
- arg0 :
Ray2d
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Ray2d
- No Documentation 🚧 - other :
Ray2d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
get_point
Get a point at a given distance along the ray
Arguments
- _self :
Ray2d
- No Documentation 🚧 - distance :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
intersect_plane
Get the distance to a plane if the ray intersects it
Arguments
- _self :
Ray2d
- No Documentation 🚧 - plane_origin :
Vec2
- No Documentation 🚧 - plane :
Plane2d
- No Documentation 🚧
Returns
- arg0 :
Optional<f32>
- No Documentation 🚧
new
Create a new
Ray2d
from a given origin and direction
Arguments
- origin :
Vec2
- No Documentation 🚧 - direction :
Dir2
- No Documentation 🚧
Returns
- arg0 :
Ray2d
- No Documentation 🚧
Ray3d
Ray3d
- origin : glam::Vec3
- direction : bevy_math::direction::Dir3
Description
An infinite half-line starting at
origin
and going indirection
in 3D space.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
get_point(_self, distance) | Get a point at a given distance along the ray |
intersect_plane(_self, plane_origin, plane) | Get the distance to a plane if the ray intersects it |
new(origin, direction) | Create a new `Ray3d` from a given origin and direction |
clone
No Documentation 🚧
Arguments
- _self :
Ray3d
- No Documentation 🚧
Returns
- arg0 :
Ray3d
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Ray3d
- No Documentation 🚧 - other :
Ray3d
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
get_point
Get a point at a given distance along the ray
Arguments
- _self :
Ray3d
- No Documentation 🚧 - distance :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
intersect_plane
Get the distance to a plane if the ray intersects it
Arguments
- _self :
Ray3d
- No Documentation 🚧 - plane_origin :
Vec3
- No Documentation 🚧 - plane :
InfinitePlane3d
- No Documentation 🚧
Returns
- arg0 :
Optional<f32>
- No Documentation 🚧
new
Create a new
Ray3d
from a given origin and direction
Arguments
- origin :
Vec3
- No Documentation 🚧 - direction :
Dir3
- No Documentation 🚧
Returns
- arg0 :
Ray3d
- No Documentation 🚧
IRect
IRect
- min : glam::IVec2
- max : glam::IVec2
Description
A rectangle defined by two opposite corners.
The rectangle is axis aligned, and defined by its minimum and maximum coordinates, stored in
IRect::min
andIRect::max
, respectively. The minimum/maximum invariant must be upheld by the user when directly assigning the fields, otherwise some methods produce invalid results. It is generally recommended to use one of the constructor methods instead, which will ensure this invariant is met, unless you already have the minimum and maximum corners.
Functions
as_rect
Returns self as [
Rect
] (f32)
Arguments
- _self :
IRect
- No Documentation 🚧
Returns
- arg0 :
Rect
- No Documentation 🚧
as_urect
Returns self as [
URect
] (u32)
Arguments
- _self :
IRect
- No Documentation 🚧
Returns
- arg0 :
URect
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
IRect
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
center
The center point of the rectangle.
Rounding Behavior
If the (min + max) contains odd numbers they will be rounded down to the nearest whole number when calculating the center.
Examples
# use bevy_math::{IRect, IVec2}; let r = IRect::new(0, 0, 5, 2); // w=5 h=2 assert_eq!(r.center(), IVec2::new(2, 1));
Arguments
- _self :
IRect
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
IRect
- No Documentation 🚧
Returns
- arg0 :
IRect
- No Documentation 🚧
contains
Check if a point lies within this rectangle, inclusive of its edges.
Examples
# use bevy_math::IRect; let r = IRect::new(0, 0, 5, 1); // w=5 h=1 assert!(r.contains(r.center())); assert!(r.contains(r.min)); assert!(r.contains(r.max));
Arguments
- _self :
IRect
- No Documentation 🚧 - point :
IVec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
IRect
- No Documentation 🚧 - other :
IRect
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_center_half_size
Create a new rectangle from its center and half-size.
Panics
This method panics if any of the components of the half-size is negative.
Examples
# use bevy_math::{IRect, IVec2}; let r = IRect::from_center_half_size(IVec2::ZERO, IVec2::ONE); // w=2 h=2 assert_eq!(r.min, IVec2::splat(-1)); assert_eq!(r.max, IVec2::splat(1));
Arguments
- origin :
IVec2
- No Documentation 🚧 - half_size :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IRect
- No Documentation 🚧
from_center_size
Create a new rectangle from its center and size.
Rounding Behavior
If the size contains odd numbers they will be rounded down to the nearest whole number.
Panics
This method panics if any of the components of the size is negative.
Examples
# use bevy_math::{IRect, IVec2}; let r = IRect::from_center_size(IVec2::ZERO, IVec2::new(3, 2)); // w=2 h=2 assert_eq!(r.min, IVec2::splat(-1)); assert_eq!(r.max, IVec2::splat(1));
Arguments
- origin :
IVec2
- No Documentation 🚧 - size :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IRect
- No Documentation 🚧
from_corners
Create a new rectangle from two corner points. The two points do not need to be the minimum and/or maximum corners. They only need to be two opposite corners.
Examples
# use bevy_math::{IRect, IVec2}; // Unit rect from [0,0] to [1,1] let r = IRect::from_corners(IVec2::ZERO, IVec2::ONE); // w=1 h=1 // Same; the points do not need to be ordered let r = IRect::from_corners(IVec2::ONE, IVec2::ZERO); // w=1 h=1
Arguments
- p0 :
IVec2
- No Documentation 🚧 - p1 :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IRect
- No Documentation 🚧
half_size
Rectangle half-size.
Rounding Behavior
If the full size contains odd numbers they will be rounded down to the nearest whole number when calculating the half size.
Examples
# use bevy_math::{IRect, IVec2}; let r = IRect::new(0, 0, 4, 3); // w=4 h=3 assert_eq!(r.half_size(), IVec2::new(2, 1));
Arguments
- _self :
IRect
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
height
Rectangle height (max.y - min.y).
Examples
# use bevy_math::IRect; let r = IRect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.height(), 1);
Arguments
- _self :
IRect
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
inflate
Create a new rectangle by expanding it evenly on all sides. A positive expansion value produces a larger rectangle, while a negative expansion value produces a smaller rectangle. If this would result in zero or negative width or height, [
IRect::EMPTY
] is returned instead.Examples
# use bevy_math::{IRect, IVec2}; let r = IRect::new(0, 0, 5, 1); // w=5 h=1 let r2 = r.inflate(3); // w=11 h=7 assert_eq!(r2.min, IVec2::splat(-3)); assert_eq!(r2.max, IVec2::new(8, 4)); let r = IRect::new(0, -1, 4, 3); // w=4 h=4 let r2 = r.inflate(-1); // w=2 h=2 assert_eq!(r2.min, IVec2::new(1, 0)); assert_eq!(r2.max, IVec2::new(3, 2));
Arguments
- _self :
IRect
- No Documentation 🚧 - expansion :
i32
- No Documentation 🚧
Returns
- arg0 :
IRect
- No Documentation 🚧
intersect
Build a new rectangle formed of the intersection of this rectangle and another rectangle. The intersection is the largest rectangle enclosed in both rectangles. If the intersection is empty, this method returns an empty rectangle ([
IRect::is_empty()
] returnstrue
), but the actual values of [IRect::min
] and [IRect::max
] are implementation-dependent.Examples
# use bevy_math::{IRect, IVec2}; let r1 = IRect::new(0, 0, 5, 1); // w=5 h=1 let r2 = IRect::new(1, -1, 3, 3); // w=2 h=4 let r = r1.intersect(r2); assert_eq!(r.min, IVec2::new(1, 0)); assert_eq!(r.max, IVec2::new(3, 1));
Arguments
- _self :
IRect
- No Documentation 🚧 - other :
IRect
- No Documentation 🚧
Returns
- arg0 :
IRect
- No Documentation 🚧
is_empty
Check if the rectangle is empty.
Examples
# use bevy_math::{IRect, IVec2}; let r = IRect::from_corners(IVec2::ZERO, IVec2::new(0, 1)); // w=0 h=1 assert!(r.is_empty());
Arguments
- _self :
IRect
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Create a new rectangle from two corner points. The two points do not need to be the minimum and/or maximum corners. They only need to be two opposite corners.
Examples
# use bevy_math::IRect; let r = IRect::new(0, 4, 10, 6); // w=10 h=2 let r = IRect::new(2, 3, 5, -1); // w=3 h=4
Arguments
- x0 :
i32
- No Documentation 🚧 - y0 :
i32
- No Documentation 🚧 - x1 :
i32
- No Documentation 🚧 - y1 :
i32
- No Documentation 🚧
Returns
- arg0 :
IRect
- No Documentation 🚧
size
Rectangle size.
Examples
# use bevy_math::{IRect, IVec2}; let r = IRect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.size(), IVec2::new(5, 1));
Arguments
- _self :
IRect
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
union
Build a new rectangle formed of the union of this rectangle and another rectangle. The union is the smallest rectangle enclosing both rectangles.
Examples
# use bevy_math::{IRect, IVec2}; let r1 = IRect::new(0, 0, 5, 1); // w=5 h=1 let r2 = IRect::new(1, -1, 3, 3); // w=2 h=4 let r = r1.union(r2); assert_eq!(r.min, IVec2::new(0, -1)); assert_eq!(r.max, IVec2::new(5, 3));
Arguments
- _self :
IRect
- No Documentation 🚧 - other :
IRect
- No Documentation 🚧
Returns
- arg0 :
IRect
- No Documentation 🚧
union_point
Build a new rectangle formed of the union of this rectangle and a point. The union is the smallest rectangle enclosing both the rectangle and the point. If the point is already inside the rectangle, this method returns a copy of the rectangle.
Examples
# use bevy_math::{IRect, IVec2}; let r = IRect::new(0, 0, 5, 1); // w=5 h=1 let u = r.union_point(IVec2::new(3, 6)); assert_eq!(u.min, IVec2::ZERO); assert_eq!(u.max, IVec2::new(5, 6));
Arguments
- _self :
IRect
- No Documentation 🚧 - other :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IRect
- No Documentation 🚧
width
Rectangle width (max.x - min.x).
Examples
# use bevy_math::IRect; let r = IRect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.width(), 5);
Arguments
- _self :
IRect
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
Rect
Rect
- min : glam::Vec2
- max : glam::Vec2
Description
A rectangle defined by two opposite corners.
The rectangle is axis aligned, and defined by its minimum and maximum coordinates, stored in
Rect::min
andRect::max
, respectively. The minimum/maximum invariant must be upheld by the user when directly assigning the fields, otherwise some methods produce invalid results. It is generally recommended to use one of the constructor methods instead, which will ensure this invariant is met, unless you already have the minimum and maximum corners.
Functions
as_irect
Returns self as [
IRect
] (i32)
Arguments
- _self :
Rect
- No Documentation 🚧
Returns
- arg0 :
IRect
- No Documentation 🚧
as_urect
Returns self as [
URect
] (u32)
Arguments
- _self :
Rect
- No Documentation 🚧
Returns
- arg0 :
URect
- No Documentation 🚧
center
The center point of the rectangle.
Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!(r.center().abs_diff_eq(Vec2::new(2.5, 0.5), 1e-5));
Arguments
- _self :
Rect
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Rect
- No Documentation 🚧
Returns
- arg0 :
Rect
- No Documentation 🚧
contains
Check if a point lies within this rectangle, inclusive of its edges.
Examples
# use bevy_math::Rect; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!(r.contains(r.center())); assert!(r.contains(r.min)); assert!(r.contains(r.max));
Arguments
- _self :
Rect
- No Documentation 🚧 - point :
Vec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Rect
- No Documentation 🚧 - other :
Rect
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_center_half_size
Create a new rectangle from its center and half-size.
Panics
This method panics if any of the components of the half-size is negative.
Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::from_center_half_size(Vec2::ZERO, Vec2::ONE); // w=2 h=2 assert!(r.min.abs_diff_eq(Vec2::splat(-1.), 1e-5)); assert!(r.max.abs_diff_eq(Vec2::splat(1.), 1e-5));
Arguments
- origin :
Vec2
- No Documentation 🚧 - half_size :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Rect
- No Documentation 🚧
from_center_size
Create a new rectangle from its center and size.
Panics
This method panics if any of the components of the size is negative.
Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::from_center_size(Vec2::ZERO, Vec2::ONE); // w=1 h=1 assert!(r.min.abs_diff_eq(Vec2::splat(-0.5), 1e-5)); assert!(r.max.abs_diff_eq(Vec2::splat(0.5), 1e-5));
Arguments
- origin :
Vec2
- No Documentation 🚧 - size :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Rect
- No Documentation 🚧
from_corners
Create a new rectangle from two corner points. The two points do not need to be the minimum and/or maximum corners. They only need to be two opposite corners.
Examples
# use bevy_math::{Rect, Vec2}; // Unit rect from [0,0] to [1,1] let r = Rect::from_corners(Vec2::ZERO, Vec2::ONE); // w=1 h=1 // Same; the points do not need to be ordered let r = Rect::from_corners(Vec2::ONE, Vec2::ZERO); // w=1 h=1
Arguments
- p0 :
Vec2
- No Documentation 🚧 - p1 :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Rect
- No Documentation 🚧
half_size
Rectangle half-size.
Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!(r.half_size().abs_diff_eq(Vec2::new(2.5, 0.5), 1e-5));
Arguments
- _self :
Rect
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
height
Rectangle height (max.y - min.y).
Examples
# use bevy_math::Rect; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!((r.height() - 1.).abs() <= 1e-5);
Arguments
- _self :
Rect
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
inflate
Create a new rectangle by expanding it evenly on all sides. A positive expansion value produces a larger rectangle, while a negative expansion value produces a smaller rectangle. If this would result in zero or negative width or height, [
Rect::EMPTY
] is returned instead.Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 let r2 = r.inflate(3.); // w=11 h=7 assert!(r2.min.abs_diff_eq(Vec2::splat(-3.), 1e-5)); assert!(r2.max.abs_diff_eq(Vec2::new(8., 4.), 1e-5)); let r = Rect::new(0., -1., 6., 7.); // w=6 h=8 let r2 = r.inflate(-2.); // w=11 h=7 assert!(r2.min.abs_diff_eq(Vec2::new(2., 1.), 1e-5)); assert!(r2.max.abs_diff_eq(Vec2::new(4., 5.), 1e-5));
Arguments
- _self :
Rect
- No Documentation 🚧 - expansion :
f32
- No Documentation 🚧
Returns
- arg0 :
Rect
- No Documentation 🚧
intersect
Build a new rectangle formed of the intersection of this rectangle and another rectangle. The intersection is the largest rectangle enclosed in both rectangles. If the intersection is empty, this method returns an empty rectangle ([
Rect::is_empty()
] returnstrue
), but the actual values of [Rect::min
] and [Rect::max
] are implementation-dependent.Examples
# use bevy_math::{Rect, Vec2}; let r1 = Rect::new(0., 0., 5., 1.); // w=5 h=1 let r2 = Rect::new(1., -1., 3., 3.); // w=2 h=4 let r = r1.intersect(r2); assert!(r.min.abs_diff_eq(Vec2::new(1., 0.), 1e-5)); assert!(r.max.abs_diff_eq(Vec2::new(3., 1.), 1e-5));
Arguments
- _self :
Rect
- No Documentation 🚧 - other :
Rect
- No Documentation 🚧
Returns
- arg0 :
Rect
- No Documentation 🚧
is_empty
Check if the rectangle is empty.
Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::from_corners(Vec2::ZERO, Vec2::new(0., 1.)); // w=0 h=1 assert!(r.is_empty());
Arguments
- _self :
Rect
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Create a new rectangle from two corner points. The two points do not need to be the minimum and/or maximum corners. They only need to be two opposite corners.
Examples
# use bevy_math::Rect; let r = Rect::new(0., 4., 10., 6.); // w=10 h=2 let r = Rect::new(2., 3., 5., -1.); // w=3 h=4
Arguments
- x0 :
f32
- No Documentation 🚧 - y0 :
f32
- No Documentation 🚧 - x1 :
f32
- No Documentation 🚧 - y1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Rect
- No Documentation 🚧
normalize
Build a new rectangle from this one with its coordinates expressed relative to
other
in a normalized ([0..1] x [0..1]) coordinate system.Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::new(2., 3., 4., 6.); let s = Rect::new(0., 0., 10., 10.); let n = r.normalize(s); assert_eq!(n.min.x, 0.2); assert_eq!(n.min.y, 0.3); assert_eq!(n.max.x, 0.4); assert_eq!(n.max.y, 0.6);
Arguments
- _self :
Rect
- No Documentation 🚧 - other :
Rect
- No Documentation 🚧
Returns
- arg0 :
Rect
- No Documentation 🚧
size
Rectangle size.
Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!(r.size().abs_diff_eq(Vec2::new(5., 1.), 1e-5));
Arguments
- _self :
Rect
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
union
Build a new rectangle formed of the union of this rectangle and another rectangle. The union is the smallest rectangle enclosing both rectangles.
Examples
# use bevy_math::{Rect, Vec2}; let r1 = Rect::new(0., 0., 5., 1.); // w=5 h=1 let r2 = Rect::new(1., -1., 3., 3.); // w=2 h=4 let r = r1.union(r2); assert!(r.min.abs_diff_eq(Vec2::new(0., -1.), 1e-5)); assert!(r.max.abs_diff_eq(Vec2::new(5., 3.), 1e-5));
Arguments
- _self :
Rect
- No Documentation 🚧 - other :
Rect
- No Documentation 🚧
Returns
- arg0 :
Rect
- No Documentation 🚧
union_point
Build a new rectangle formed of the union of this rectangle and a point. The union is the smallest rectangle enclosing both the rectangle and the point. If the point is already inside the rectangle, this method returns a copy of the rectangle.
Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 let u = r.union_point(Vec2::new(3., 6.)); assert!(u.min.abs_diff_eq(Vec2::ZERO, 1e-5)); assert!(u.max.abs_diff_eq(Vec2::new(5., 6.), 1e-5));
Arguments
- _self :
Rect
- No Documentation 🚧 - other :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Rect
- No Documentation 🚧
width
Rectangle width (max.x - min.x).
Examples
# use bevy_math::Rect; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!((r.width() - 5.).abs() <= 1e-5);
Arguments
- _self :
Rect
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
URect
URect
- min : glam::UVec2
- max : glam::UVec2
Description
A rectangle defined by two opposite corners.
The rectangle is axis aligned, and defined by its minimum and maximum coordinates, stored in
URect::min
andURect::max
, respectively. The minimum/maximum invariant must be upheld by the user when directly assigning the fields, otherwise some methods produce invalid results. It is generally recommended to use one of the constructor methods instead, which will ensure this invariant is met, unless you already have the minimum and maximum corners.
Functions
as_irect
Returns self as [
IRect
] (i32)
Arguments
- _self :
URect
- No Documentation 🚧
Returns
- arg0 :
IRect
- No Documentation 🚧
as_rect
Returns self as [
Rect
] (f32)
Arguments
- _self :
URect
- No Documentation 🚧
Returns
- arg0 :
Rect
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
URect
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
center
The center point of the rectangle.
Rounding Behavior
If the (min + max) contains odd numbers they will be rounded down to the nearest whole number when calculating the center.
Examples
# use bevy_math::{URect, UVec2}; let r = URect::new(0, 0, 4, 2); // w=4 h=2 assert_eq!(r.center(), UVec2::new(2, 1));
Arguments
- _self :
URect
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
URect
- No Documentation 🚧
Returns
- arg0 :
URect
- No Documentation 🚧
contains
Check if a point lies within this rectangle, inclusive of its edges.
Examples
# use bevy_math::URect; let r = URect::new(0, 0, 5, 1); // w=5 h=1 assert!(r.contains(r.center())); assert!(r.contains(r.min)); assert!(r.contains(r.max));
Arguments
- _self :
URect
- No Documentation 🚧 - point :
UVec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
URect
- No Documentation 🚧 - other :
URect
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_center_half_size
Create a new rectangle from its center and half-size.
Panics
This method panics if any of the components of the half-size is negative or if
origin - half_size
results in any negatives.Examples
# use bevy_math::{URect, UVec2}; let r = URect::from_center_half_size(UVec2::ONE, UVec2::ONE); // w=2 h=2 assert_eq!(r.min, UVec2::splat(0)); assert_eq!(r.max, UVec2::splat(2));
Arguments
- origin :
UVec2
- No Documentation 🚧 - half_size :
UVec2
- No Documentation 🚧
Returns
- arg0 :
URect
- No Documentation 🚧
from_center_size
Create a new rectangle from its center and size.
Rounding Behavior
If the size contains odd numbers they will be rounded down to the nearest whole number.
Panics
This method panics if any of the components of the size is negative or if
origin - (size / 2)
results in any negatives.Examples
# use bevy_math::{URect, UVec2}; let r = URect::from_center_size(UVec2::ONE, UVec2::splat(2)); // w=2 h=2 assert_eq!(r.min, UVec2::splat(0)); assert_eq!(r.max, UVec2::splat(2));
Arguments
- origin :
UVec2
- No Documentation 🚧 - size :
UVec2
- No Documentation 🚧
Returns
- arg0 :
URect
- No Documentation 🚧
from_corners
Create a new rectangle from two corner points. The two points do not need to be the minimum and/or maximum corners. They only need to be two opposite corners.
Examples
# use bevy_math::{URect, UVec2}; // Unit rect from [0,0] to [1,1] let r = URect::from_corners(UVec2::ZERO, UVec2::ONE); // w=1 h=1 // Same; the points do not need to be ordered let r = URect::from_corners(UVec2::ONE, UVec2::ZERO); // w=1 h=1
Arguments
- p0 :
UVec2
- No Documentation 🚧 - p1 :
UVec2
- No Documentation 🚧
Returns
- arg0 :
URect
- No Documentation 🚧
half_size
Rectangle half-size.
Rounding Behavior
If the full size contains odd numbers they will be rounded down to the nearest whole number when calculating the half size.
Examples
# use bevy_math::{URect, UVec2}; let r = URect::new(0, 0, 4, 2); // w=4 h=2 assert_eq!(r.half_size(), UVec2::new(2, 1));
Arguments
- _self :
URect
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
height
Rectangle height (max.y - min.y).
Examples
# use bevy_math::URect; let r = URect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.height(), 1);
Arguments
- _self :
URect
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
inflate
Create a new rectangle by expanding it evenly on all sides. A positive expansion value produces a larger rectangle, while a negative expansion value produces a smaller rectangle. If this would result in zero width or height, [
URect::EMPTY
] is returned instead.Examples
# use bevy_math::{URect, UVec2}; let r = URect::new(4, 4, 6, 6); // w=2 h=2 let r2 = r.inflate(1); // w=4 h=4 assert_eq!(r2.min, UVec2::splat(3)); assert_eq!(r2.max, UVec2::splat(7)); let r = URect::new(4, 4, 8, 8); // w=4 h=4 let r2 = r.inflate(-1); // w=2 h=2 assert_eq!(r2.min, UVec2::splat(5)); assert_eq!(r2.max, UVec2::splat(7));
Arguments
- _self :
URect
- No Documentation 🚧 - expansion :
i32
- No Documentation 🚧
Returns
- arg0 :
URect
- No Documentation 🚧
intersect
Build a new rectangle formed of the intersection of this rectangle and another rectangle. The intersection is the largest rectangle enclosed in both rectangles. If the intersection is empty, this method returns an empty rectangle ([
URect::is_empty()
] returnstrue
), but the actual values of [URect::min
] and [URect::max
] are implementation-dependent.Examples
# use bevy_math::{URect, UVec2}; let r1 = URect::new(0, 0, 2, 2); // w=2 h=2 let r2 = URect::new(1, 1, 3, 3); // w=2 h=2 let r = r1.intersect(r2); assert_eq!(r.min, UVec2::new(1, 1)); assert_eq!(r.max, UVec2::new(2, 2));
Arguments
- _self :
URect
- No Documentation 🚧 - other :
URect
- No Documentation 🚧
Returns
- arg0 :
URect
- No Documentation 🚧
is_empty
Check if the rectangle is empty.
Examples
# use bevy_math::{URect, UVec2}; let r = URect::from_corners(UVec2::ZERO, UVec2::new(0, 1)); // w=0 h=1 assert!(r.is_empty());
Arguments
- _self :
URect
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Create a new rectangle from two corner points. The two points do not need to be the minimum and/or maximum corners. They only need to be two opposite corners.
Examples
# use bevy_math::URect; let r = URect::new(0, 4, 10, 6); // w=10 h=2 let r = URect::new(2, 4, 5, 0); // w=3 h=4
Arguments
- x0 :
u32
- No Documentation 🚧 - y0 :
u32
- No Documentation 🚧 - x1 :
u32
- No Documentation 🚧 - y1 :
u32
- No Documentation 🚧
Returns
- arg0 :
URect
- No Documentation 🚧
size
Rectangle size.
Examples
# use bevy_math::{URect, UVec2}; let r = URect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.size(), UVec2::new(5, 1));
Arguments
- _self :
URect
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
union
Build a new rectangle formed of the union of this rectangle and another rectangle. The union is the smallest rectangle enclosing both rectangles.
Examples
# use bevy_math::{URect, UVec2}; let r1 = URect::new(0, 0, 5, 1); // w=5 h=1 let r2 = URect::new(1, 0, 3, 8); // w=2 h=4 let r = r1.union(r2); assert_eq!(r.min, UVec2::new(0, 0)); assert_eq!(r.max, UVec2::new(5, 8));
Arguments
- _self :
URect
- No Documentation 🚧 - other :
URect
- No Documentation 🚧
Returns
- arg0 :
URect
- No Documentation 🚧
union_point
Build a new rectangle formed of the union of this rectangle and a point. The union is the smallest rectangle enclosing both the rectangle and the point. If the point is already inside the rectangle, this method returns a copy of the rectangle.
Examples
# use bevy_math::{URect, UVec2}; let r = URect::new(0, 0, 5, 1); // w=5 h=1 let u = r.union_point(UVec2::new(3, 6)); assert_eq!(u.min, UVec2::ZERO); assert_eq!(u.max, UVec2::new(5, 6));
Arguments
- _self :
URect
- No Documentation 🚧 - other :
UVec2
- No Documentation 🚧
Returns
- arg0 :
URect
- No Documentation 🚧
width
Rectangle width (max.x - min.x).
Examples
# use bevy_math::URect; let r = URect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.width(), 5);
Arguments
- _self :
URect
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
Rot2
Rot2
- cos : f32
- sin : f32
Description
A counterclockwise 2D rotation.
Example
# use approx::assert_relative_eq; # use bevy_math::{Rot2, Vec2}; use std::f32::consts::PI; // Create rotations from radians or degrees let rotation1 = Rot2::radians(PI / 2.0); let rotation2 = Rot2::degrees(45.0); // Get the angle back as radians or degrees assert_eq!(rotation1.as_degrees(), 90.0); assert_eq!(rotation2.as_radians(), PI / 4.0); // "Add" rotations together using `*` assert_relative_eq!(rotation1 * rotation2, Rot2::degrees(135.0)); // Rotate vectors assert_relative_eq!(rotation1 * Vec2::X, Vec2::Y);
Functions
angle_between
Returns the angle in radians needed to make
self
andother
coincide.
Arguments
- _self :
Rot2
- No Documentation 🚧 - other :
Rot2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
angle_to
Returns the angle in radians needed to make
self
andother
coincide.
Arguments
- _self :
Rot2
- No Documentation 🚧 - other :
Rot2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
as_degrees
Returns the rotation in degrees in the
(-180, 180]
range.
Arguments
- _self :
Rot2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
as_radians
Returns the rotation in radians in the
(-pi, pi]
range.
Arguments
- _self :
Rot2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
as_turn_fraction
Returns the rotation as a fraction of a full 360 degree turn.
Arguments
- _self :
Rot2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Rot2
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
degrees
Creates a [
Rot2
] from a counterclockwise angle in degrees.Note
The input rotation will always be clamped to the range
(-180°, 180°]
by design.Example
# use bevy_math::Rot2; # use approx::assert_relative_eq; let rot1 = Rot2::degrees(270.0); let rot2 = Rot2::degrees(-90.0); assert_relative_eq!(rot1, rot2); let rot3 = Rot2::degrees(180.0); assert_relative_eq!(rot1 * rot1, rot3);
Arguments
- degrees :
f32
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Rot2
- No Documentation 🚧 - other :
Rot2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
fast_renormalize
Returns
self
after an approximate normalization, assuming the value is already nearly normalized. Useful for preventing numerical error accumulation. SeeDir3::fast_renormalize
for an example of when such error accumulation might occur.
Arguments
- _self :
Rot2
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
from_sin_cos
Creates a [
Rot2
] from the sine and cosine of an angle in radians. The rotation is only valid ifsin * sin + cos * cos == 1.0
.Panics
Panics if
sin * sin + cos * cos != 1.0
when theglam_assert
feature is enabled.
Arguments
- sin :
f32
- No Documentation 🚧 - cos :
f32
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
inverse
Returns the inverse of the rotation. This is also the conjugate of the unit complex number representing the rotation.
Arguments
- _self :
Rot2
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
is_finite
Returns
true
if the rotation is neither infinite nor NaN.
Arguments
- _self :
Rot2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan
Returns
true
if the rotation is NaN.
Arguments
- _self :
Rot2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_near_identity
Returns
true
if the rotation is near [Rot2::IDENTITY
].
Arguments
- _self :
Rot2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_normalized
Returns whether
self
has a length of1.0
or not. Uses a precision threshold of approximately1e-4
.
Arguments
- _self :
Rot2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
length
Computes the length or norm of the complex number used to represent the rotation. The length is typically expected to be
1.0
. Unexpectedly denormalized rotations can be a result of incorrect construction or floating point error caused by successive operations.
Arguments
- _self :
Rot2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
length_recip
Computes
1.0 / self.length()
. For valid results,self
must not have a length of zero.
Arguments
- _self :
Rot2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
length_squared
Computes the squared length or norm of the complex number used to represent the rotation. This is generally faster than [
Rot2::length()
], as it avoids a square root operation. The length is typically expected to be1.0
. Unexpectedly denormalized rotations can be a result of incorrect construction or floating point error caused by successive operations.
Arguments
- _self :
Rot2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Rot2
- No Documentation 🚧 - rhs :
Rot2
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
Rot2
- No Documentation 🚧 - arg1 :
Dir2
- No Documentation 🚧
Returns
- arg0 :
Dir2
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
Rot2
- No Documentation 🚧 - arg1 :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
nlerp
Performs a linear interpolation between
self
andrhs
based on the values
, and normalizes the rotation afterwards. Whens == 0.0
, the result will be equal toself
. Whens == 1.0
, the result will be equal torhs
. This is slightly more efficient thanslerp
, and produces a similar result when the difference between the two rotations is small. At larger differences, the result resembles a kind of ease-in-out effect. If you would like the angular velocity to remain constant, consider usingslerp
instead.Details
nlerp
corresponds to computing an angle for a point at positions
on a line drawn between the endpoints of the arc formed byself
andrhs
on a unit circle, and normalizing the result afterwards. Note that if the angles are opposite like 0 and π, the line will pass through the origin, and the resulting angle will always be eitherself
orrhs
depending ons
. Ifs
happens to be0.5
in this case, a valid rotation cannot be computed, andself
will be returned as a fallback.Example
# use bevy_math::Rot2; # let rot1 = Rot2::IDENTITY; let rot2 = Rot2::degrees(135.0); let result1 = rot1.nlerp(rot2, 1.0 / 3.0); assert_eq!(result1.as_degrees(), 28.675055); let result2 = rot1.nlerp(rot2, 0.5); assert_eq!(result2.as_degrees(), 67.5);
Arguments
- _self :
Rot2
- No Documentation 🚧 - end :
Rot2
- No Documentation 🚧 - s :
f32
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
normalize
Returns
self
with a length of1.0
. Note that [Rot2
] should typically already be normalized by design. Manual normalization is only needed when successive operations result in accumulated floating point error, or if the rotation was constructed with invalid values.Panics
Panics if
self
has a length of zero, NaN, or infinity when debug assertions are enabled.
Arguments
- _self :
Rot2
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
radians
Creates a [
Rot2
] from a counterclockwise angle in radians.Note
The input rotation will always be clamped to the range
(-π, π]
by design.Example
# use bevy_math::Rot2; # use approx::assert_relative_eq; # use std::f32::consts::{FRAC_PI_2, PI}; let rot1 = Rot2::radians(3.0 * FRAC_PI_2); let rot2 = Rot2::radians(-FRAC_PI_2); assert_relative_eq!(rot1, rot2); let rot3 = Rot2::radians(PI); assert_relative_eq!(rot1 * rot1, rot3);
Arguments
- radians :
f32
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
sin_cos
Returns the sine and cosine of the rotation angle in radians.
Arguments
- _self :
Rot2
- No Documentation 🚧
Returns
- arg0 :
(f32, f32)
- No Documentation 🚧
slerp
Performs a spherical linear interpolation between
self
andend
based on the values
. This corresponds to interpolating between the two angles at a constant angular velocity. Whens == 0.0
, the result will be equal toself
. Whens == 1.0
, the result will be equal torhs
. If you would like the rotation to have a kind of ease-in-out effect, consider using the slightly more efficientnlerp
instead.Example
# use bevy_math::Rot2; # let rot1 = Rot2::IDENTITY; let rot2 = Rot2::degrees(135.0); let result1 = rot1.slerp(rot2, 1.0 / 3.0); assert_eq!(result1.as_degrees(), 45.0); let result2 = rot1.slerp(rot2, 0.5); assert_eq!(result2.as_degrees(), 67.5);
Arguments
- _self :
Rot2
- No Documentation 🚧 - end :
Rot2
- No Documentation 🚧 - s :
f32
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
turn_fraction
Creates a [
Rot2
] from a counterclockwise fraction of a full turn of 360 degrees.Note
The input rotation will always be clamped to the range
(-50%, 50%]
by design.Example
# use bevy_math::Rot2; # use approx::assert_relative_eq; let rot1 = Rot2::turn_fraction(0.75); let rot2 = Rot2::turn_fraction(-0.25); assert_relative_eq!(rot1, rot2); let rot3 = Rot2::turn_fraction(0.5); assert_relative_eq!(rot1 * rot1, rot3);
Arguments
- fraction :
f32
- No Documentation 🚧
Returns
- arg0 :
Rot2
- No Documentation 🚧
Val
Val
- bevy_ecs::entity::Entity
Description
A wrapper around a value of type
T
.This can be used to retrieve a value out of a [
ScriptValue::Reference
] corresponding to the typeT
. You can also use this to return values from a script function to be allocated directly as a [ScriptValue::Reference
].
Functions
Val
Val
- bevy_mod_scripting_core::bindings::query::ScriptQueryBuilder
Description
A wrapper around a value of type
T
.This can be used to retrieve a value out of a [
ScriptValue::Reference
] corresponding to the typeT
. You can also use this to return values from a script function to be allocated directly as a [ScriptValue::Reference
].
Functions
Val
Val
- bevy_mod_scripting_core::bindings::query::ScriptQueryResult
Description
A wrapper around a value of type
T
.This can be used to retrieve a value out of a [
ScriptValue::Reference
] corresponding to the typeT
. You can also use this to return values from a script function to be allocated directly as a [ScriptValue::Reference
].
Functions
Val
Val
- bevy_mod_scripting_core::docgen::info::FunctionInfo
Description
A wrapper around a value of type
T
.This can be used to retrieve a value out of a [
ScriptValue::Reference
] corresponding to the typeT
. You can also use this to return values from a script function to be allocated directly as a [ScriptValue::Reference
].
Functions
Namespace
Global
OnType
- core::any::TypeId
Description
A namespace for functions
Functions
ScriptComponentRegistration
ScriptComponentRegistration
- registration : bevy_mod_scripting_core::bindings::query::ScriptTypeRegistration
- component_id : bevy_ecs::component::ComponentId
Description
A registration for a component type.
Functions
Function | Summary |
---|---|
short_name(s) | No Documentation 🚧 |
type_name(s) | No Documentation 🚧 |
short_name
No Documentation 🚧
Arguments
- s :
ScriptComponentRegistration
- No Documentation 🚧
Returns
- arg0 :
str
- No Documentation 🚧
type_name
No Documentation 🚧
Arguments
- s :
ScriptComponentRegistration
- No Documentation 🚧
Returns
- arg0 :
str
- No Documentation 🚧
ScriptQueryBuilder
Opaque Type. 🔒
Description
A builder for a query.
Functions
Function | Summary |
---|---|
build(ctxt, s) | No Documentation 🚧 |
component(s, components) | No Documentation 🚧 |
with(s, with) | No Documentation 🚧 |
without(s, without) | No Documentation 🚧 |
build
No Documentation 🚧
Arguments
- ctxt :
FunctionCallContext
- No Documentation 🚧 - s :
ScriptQueryBuilder
- No Documentation 🚧
Returns
- arg0 :
Vec<ScriptQueryResult>
- No Documentation 🚧
component
No Documentation 🚧
Arguments
- s :
ScriptQueryBuilder
- No Documentation 🚧 - components :
ScriptComponentRegistration
- No Documentation 🚧
Returns
- arg0 :
ScriptQueryBuilder
- No Documentation 🚧
with
No Documentation 🚧
Arguments
- s :
ScriptQueryBuilder
- No Documentation 🚧 - with :
ScriptComponentRegistration
- No Documentation 🚧
Returns
- arg0 :
ScriptQueryBuilder
- No Documentation 🚧
without
No Documentation 🚧
Arguments
- s :
ScriptQueryBuilder
- No Documentation 🚧 - without :
ScriptComponentRegistration
- No Documentation 🚧
Returns
- arg0 :
ScriptQueryBuilder
- No Documentation 🚧
ScriptQueryResult
Opaque Type. 🔒
Description
A result from a query.
Functions
Function | Summary |
---|---|
components(s) | No Documentation 🚧 |
entity(s) | No Documentation 🚧 |
components
No Documentation 🚧
Arguments
- s :
ScriptQueryResult
- No Documentation 🚧
Returns
- arg0 :
Vec<ReflectReference>
- No Documentation 🚧
entity
No Documentation 🚧
Arguments
- s :
ScriptQueryResult
- No Documentation 🚧
Returns
- arg0 :
Entity
- No Documentation 🚧
ScriptResourceRegistration
ScriptResourceRegistration
- registration : bevy_mod_scripting_core::bindings::query::ScriptTypeRegistration
- resource_id : bevy_ecs::component::ComponentId
Description
A registration for a resource type.
Functions
Function | Summary |
---|---|
short_name(s) | No Documentation 🚧 |
type_name(s) | No Documentation 🚧 |
short_name
No Documentation 🚧
Arguments
- s :
ScriptResourceRegistration
- No Documentation 🚧
Returns
- arg0 :
str
- No Documentation 🚧
type_name
No Documentation 🚧
Arguments
- s :
ScriptResourceRegistration
- No Documentation 🚧
Returns
- arg0 :
str
- No Documentation 🚧
ScriptTypeRegistration
Opaque Type. 🔒
Description
A wrapper around a
TypeRegistration
that provides additional information about the type.This is used as a hook to a rust type from a scripting language. We should be able to easily convert between a type name and a [
ScriptTypeRegistration
].
Functions
Function | Summary |
---|---|
short_name(s) | No Documentation 🚧 |
type_name(s) | No Documentation 🚧 |
short_name
No Documentation 🚧
Arguments
- s :
ScriptTypeRegistration
- No Documentation 🚧
Returns
- arg0 :
String
- No Documentation 🚧
type_name
No Documentation 🚧
Arguments
- s :
ScriptTypeRegistration
- No Documentation 🚧
Returns
- arg0 :
String
- No Documentation 🚧
ScriptValue
Opaque Type. 🔒
Description
An abstraction of values that can be passed to and from scripts. This allows us to re-use logic between scripting languages.
Functions
FunctionArgInfo
FunctionArgInfo
- name : core::option::Option<alloc::borrow::Cow
> - arg_index : usize
- type_id : core::any::TypeId
Description
Information about a function argument.
Functions
FunctionInfo
FunctionInfo
- name : alloc::borrow::Cow
- namespace : bevy_mod_scripting_core::bindings::function::namespace::Namespace
- arg_info : alloc::vec::Vec<bevy_mod_scripting_core::docgen::info::FunctionArgInfo>
- return_info : bevy_mod_scripting_core::docgen::info::FunctionReturnInfo
- docs : core::option::Option<alloc::borrow::Cow
>
Description
Information about a function.
Functions
FunctionReturnInfo
FunctionReturnInfo
- type_id : core::any::TypeId
Description
Information about a function return value.
Functions
Fixed
Fixed
- timestep : bevy_utils::Duration
- overstep : bevy_utils::Duration
Description
The fixed timestep game clock following virtual time.
A specialization of the [
Time
] structure. For method documentation, see [Time<Fixed>#impl-Time<Fixed>
].It is automatically inserted as a resource by
TimePlugin
and updated based onTime<Virtual>
. The fixed clock is automatically set as the generic [Time
] resource duringFixedUpdate
schedule processing.The fixed timestep clock advances in fixed-size increments, which is extremely useful for writing logic (like physics) that should have consistent behavior, regardless of framerate.
The default
timestep()
is 64 hertz, or 15625 microseconds. This value was chosen because using 60 hertz has the potential for a pathological interaction with the monitor refresh rate where the game alternates between running two fixed timesteps and zero fixed timesteps per frame (for example when running two fixed timesteps takes longer than a frame). Additionally, the value is a power of two which losslessly converts into [f32
] and [f64
].To run a system on a fixed timestep, add it to one of the [
FixedMain
] schedules, most commonlyFixedUpdate
.This schedule is run a number of times between
PreUpdate
andUpdate
according to the accumulatedoverstep()
time divided by thetimestep()
. This means the schedule may run 0, 1 or more times during a single update (which typically corresponds to a rendered frame).
Time<Fixed>
and the generic [Time
] resource will report adelta()
equal totimestep()
and always growelapsed()
by onetimestep()
per iteration.The fixed timestep clock follows the
Time<Virtual>
clock, which means it is affected bypause()
,set_relative_speed()
andset_max_delta()
from virtual time. If the virtual clock is paused, theFixedUpdate
schedule will not run. It is guaranteed that theelapsed()
time inTime<Fixed>
is always between the previouselapsed()
and the currentelapsed()
value inTime<Virtual>
, so the values are compatible.Changing the timestep size while the game is running should not normally be done, as having a regular interval is the point of this schedule, but it may be necessary for effects like "bullet-time" if the normal granularity of the fixed timestep is too big for the slowed down time. In this case,
set_timestep()
and be called to set a new value. The new value will be used immediately for the next run of theFixedUpdate
schedule, meaning that it will affect thedelta()
value for the very nextFixedUpdate
, even if it is still during the same frame. Anyoverstep()
present in the accumulator will be processed according to the newtimestep()
value.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
Fixed
- No Documentation 🚧
Returns
- arg0 :
Fixed
- No Documentation 🚧
Real
Real
- startup : bevy_utils::Instant
- first_update : core::option::Option<bevy_utils::Instant>
- last_update : core::option::Option<bevy_utils::Instant>
Description
Real time clock representing elapsed wall clock time.
A specialization of the [
Time
] structure. For method documentation, see [Time<Real>#impl-Time<Real>
].It is automatically inserted as a resource by
TimePlugin
and updated with time instants according toTimeUpdateStrategy
.1Note: Using
TimeUpdateStrategy::ManualDuration
allows for mocking the wall clock for testing purposes. Besides this use case, it is not recommended to do this, as it will no longer represent "wall clock" time as intended.The
delta()
andelapsed()
values of this clock should be used for anything which deals specifically with real time (wall clock time). It will not be affected by relative game speed adjustments, pausing or other adjustments.1The clock does not count time from
startup()
tofirst_update()
into elapsed, but instead will start counting time from the first update call.delta()
andelapsed()
will report zero on the first update as there is no previous update instant. This means that adelta()
of zero must be handled without errors in application logic, as it may theoretically also happen at other times.[
Instant
]s forstartup()
,first_update()
andlast_update()
are recorded and accessible.1When using
TimeUpdateStrategy::ManualDuration
, [Time<Real>#impl-Time<Real>
] is only a mock of wall clock time.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
Real
- No Documentation 🚧
Returns
- arg0 :
Real
- No Documentation 🚧
Stopwatch
Stopwatch
- elapsed : bevy_utils::Duration
- is_paused : bool
Description
A Stopwatch is a struct that tracks elapsed time when started.
Note that in order to advance the stopwatch
tick
MUST be called.Examples
# use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); assert_eq!(stopwatch.elapsed_secs(), 0.0); stopwatch.tick(Duration::from_secs_f32(1.0)); // tick one second assert_eq!(stopwatch.elapsed_secs(), 1.0); stopwatch.pause(); stopwatch.tick(Duration::from_secs_f32(1.0)); // paused stopwatches don't tick assert_eq!(stopwatch.elapsed_secs(), 1.0); stopwatch.reset(); // reset the stopwatch assert!(stopwatch.is_paused()); assert_eq!(stopwatch.elapsed_secs(), 0.0);
Functions
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
Stopwatch
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Stopwatch
- No Documentation 🚧
Returns
- arg0 :
Stopwatch
- No Documentation 🚧
elapsed
Returns the elapsed time since the last
reset
of the stopwatch.Examples
# use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.tick(Duration::from_secs(1)); assert_eq!(stopwatch.elapsed(), Duration::from_secs(1));
See Also
elapsed_secs
- if anf32
value is desirable instead.elapsed_secs_f64
- if anf64
is desirable instead.
Arguments
- _self :
Stopwatch
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
elapsed_secs
Returns the elapsed time since the last
reset
of the stopwatch, in seconds.Examples
# use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.tick(Duration::from_secs(1)); assert_eq!(stopwatch.elapsed_secs(), 1.0);
See Also
elapsed
- if aDuration
is desirable instead.elapsed_secs_f64
- if anf64
is desirable instead.
Arguments
- _self :
Stopwatch
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
elapsed_secs_f64
Returns the elapsed time since the last
reset
of the stopwatch, in seconds, as f64.See Also
elapsed
- if aDuration
is desirable instead.elapsed_secs
- if anf32
is desirable instead.
Arguments
- _self :
Stopwatch
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Stopwatch
- No Documentation 🚧 - other :
Stopwatch
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_paused
Returns
true
if the stopwatch is paused.Examples
# use bevy_time::*; let mut stopwatch = Stopwatch::new(); assert!(!stopwatch.is_paused()); stopwatch.pause(); assert!(stopwatch.is_paused()); stopwatch.unpause(); assert!(!stopwatch.is_paused());
Arguments
- _self :
Stopwatch
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Create a new unpaused
Stopwatch
with no elapsed time.Examples
# use bevy_time::*; let stopwatch = Stopwatch::new(); assert_eq!(stopwatch.elapsed_secs(), 0.0); assert_eq!(stopwatch.is_paused(), false);
Arguments
Returns
- arg0 :
Stopwatch
- No Documentation 🚧
pause
Pauses the stopwatch. Any call to
tick
while paused will not have any effect on the elapsed time.Examples
# use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.pause(); stopwatch.tick(Duration::from_secs_f32(1.5)); assert!(stopwatch.is_paused()); assert_eq!(stopwatch.elapsed_secs(), 0.0);
Arguments
- _self :
Stopwatch
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
reset
Resets the stopwatch. The reset doesn't affect the paused state of the stopwatch.
Examples
# use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.tick(Duration::from_secs_f32(1.5)); stopwatch.reset(); assert_eq!(stopwatch.elapsed_secs(), 0.0);
Arguments
- _self :
Stopwatch
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
set_elapsed
Sets the elapsed time of the stopwatch.
Examples
# use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.set_elapsed(Duration::from_secs_f32(1.0)); assert_eq!(stopwatch.elapsed_secs(), 1.0);
Arguments
- _self :
Stopwatch
- No Documentation 🚧 - time :
Duration
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
unpause
Unpauses the stopwatch. Resume the effect of ticking on elapsed time.
Examples
# use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.pause(); stopwatch.tick(Duration::from_secs_f32(1.0)); stopwatch.unpause(); stopwatch.tick(Duration::from_secs_f32(1.0)); assert!(!stopwatch.is_paused()); assert_eq!(stopwatch.elapsed_secs(), 1.0);
Arguments
- _self :
Stopwatch
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
Time<()>
Time
- context : ()
- wrap_period : bevy_utils::Duration
- delta : bevy_utils::Duration
- delta_secs : f32
- delta_secs_f64 : f64
- elapsed : bevy_utils::Duration
- elapsed_secs : f32
- elapsed_secs_f64 : f64
- elapsed_wrapped : bevy_utils::Duration
- elapsed_secs_wrapped : f32
- elapsed_secs_wrapped_f64 : f64
Description
A generic clock resource that tracks how much it has advanced since its previous update and since its creation.
Multiple instances of this resource are inserted automatically by
TimePlugin
:
Time<Real>
tracks real wall-clock time elapsed.Time<Virtual>
tracks virtual game time that may be paused or scaled.Time<Fixed>
tracks fixed timesteps based on virtual time.- [
Time
] is a generic clock that corresponds to "current" or "default" time for systems. It containsTime<Virtual>
except inside theFixedMain
schedule when it containsTime<Fixed>
.The time elapsed since the previous time this clock was advanced is saved as
delta()
and the total amount of time the clock has advanced is saved aselapsed()
. Both are represented as exact [Duration
] values with fixed nanosecond precision. The clock does not support time moving backwards, but it can be updated with [Duration::ZERO
] which will setdelta()
to zero.These values are also available in seconds as
f32
viadelta_secs()
andelapsed_secs()
, and also in seconds asf64
viadelta_secs_f64()
andelapsed_secs_f64()
.Since
elapsed_secs()
will grow constantly and isf32
, it will exhibit gradual precision loss. For applications that require anf32
value but suffer from gradual precision loss there iselapsed_secs_wrapped()
available. The same wrapped value is also available as [Duration
] andf64
for consistency. The wrap period is by default 1 hour, and can be set byset_wrap_period()
.Accessing clocks
By default, any systems requiring current
delta()
orelapsed()
should useRes<Time>
to access the default time configured for the program. By default, this refers toTime<Virtual>
except during theFixedMain
schedule when it refers toTime<Fixed>
. This ensures your system can be used either inUpdate
orFixedUpdate
schedule depending on what is needed.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn ambivalent_system(time: Res<Time>) { println!("this how I see time: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }
If your system needs to react based on real time (wall clock time), like for user interfaces, it should use
Res<Time<Real>>
. Thedelta()
andelapsed()
values will always correspond to real time and will not be affected by pause, time scaling or other tweaks.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn real_time_system(time: Res<Time<Real>>) { println!("this will always be real time: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }
If your system specifically needs to access fixed timestep clock, even when placed in
Update
schedule, you should useRes<Time<Fixed>>
. Thedelta()
andelapsed()
values will correspond to the latest fixed timestep that has been run.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn fixed_time_system(time: Res<Time<Fixed>>) { println!("this will always be the last executed fixed timestep: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }
Finally, if your system specifically needs to know the current virtual game time, even if placed inside
FixedUpdate
, for example to know if the game iswas_paused()
or to useeffective_speed()
, you can useRes<Time<Virtual>>
. However, if the system is placed inFixedUpdate
, extra care must be used because your system might be run multiple times with the samedelta()
andelapsed()
values as the virtual game time has not changed between the iterations.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn fixed_time_system(time: Res<Time<Virtual>>) { println!("this will be virtual time for this update: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); println!("also the relative speed of the game is now {}", time.effective_speed()); }
If you need to change the settings for any of the clocks, for example to
pause()
the game, you should useResMut<Time<Virtual>>
.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # #[derive(Event)] struct PauseEvent(bool); fn pause_system(mut time: ResMut<Time<Virtual>>, mut events: EventReader<PauseEvent>) { for ev in events.read() { if ev.0 { time.pause(); } else { time.unpause(); } } }
Adding custom clocks
New custom clocks can be created by creating your own struct as a context and passing it to
new_with()
. These clocks can be inserted as resources as normal and then accessed by systems. You can use theadvance_by()
oradvance_to()
methods to move the clock forwards based on your own logic.If you want to add methods for your time instance and they require access to both your context and the generic time part, it's probably simplest to add a custom trait for them and implement it for
Time<Custom>
.Your context struct will need to implement the [
Default
] trait because [Time
] structures support reflection. It also makes initialization trivial by being able to callapp.init_resource::<Time<Custom>>()
.You can also replace the "generic"
Time
clock resource if the "default" time for your game should not be the default virtual time provided. You can get a "generic" snapshot of your clock by callingas_generic()
and then overwrite the [Time
] resource with it. The default systems added byTimePlugin
will overwrite the [Time
] clock duringFirst
andFixedUpdate
schedules.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # use bevy_utils::Instant; # #[derive(Debug)] struct Custom { last_external_time: Instant, } impl Default for Custom { fn default() -> Self { Self { last_external_time: Instant::now(), } } } trait CustomTime { fn update_from_external(&mut self, instant: Instant); } impl CustomTime for Time<Custom> { fn update_from_external(&mut self, instant: Instant) { let delta = instant - self.context().last_external_time; self.advance_by(delta); self.context_mut().last_external_time = instant; } }
Functions
Time
Time
- context : bevy_time::fixed::Fixed
- wrap_period : bevy_utils::Duration
- delta : bevy_utils::Duration
- delta_secs : f32
- delta_secs_f64 : f64
- elapsed : bevy_utils::Duration
- elapsed_secs : f32
- elapsed_secs_f64 : f64
- elapsed_wrapped : bevy_utils::Duration
- elapsed_secs_wrapped : f32
- elapsed_secs_wrapped_f64 : f64
Description
A generic clock resource that tracks how much it has advanced since its previous update and since its creation.
Multiple instances of this resource are inserted automatically by
TimePlugin
:
Time<Real>
tracks real wall-clock time elapsed.Time<Virtual>
tracks virtual game time that may be paused or scaled.Time<Fixed>
tracks fixed timesteps based on virtual time.- [
Time
] is a generic clock that corresponds to "current" or "default" time for systems. It containsTime<Virtual>
except inside theFixedMain
schedule when it containsTime<Fixed>
.The time elapsed since the previous time this clock was advanced is saved as
delta()
and the total amount of time the clock has advanced is saved aselapsed()
. Both are represented as exact [Duration
] values with fixed nanosecond precision. The clock does not support time moving backwards, but it can be updated with [Duration::ZERO
] which will setdelta()
to zero.These values are also available in seconds as
f32
viadelta_secs()
andelapsed_secs()
, and also in seconds asf64
viadelta_secs_f64()
andelapsed_secs_f64()
.Since
elapsed_secs()
will grow constantly and isf32
, it will exhibit gradual precision loss. For applications that require anf32
value but suffer from gradual precision loss there iselapsed_secs_wrapped()
available. The same wrapped value is also available as [Duration
] andf64
for consistency. The wrap period is by default 1 hour, and can be set byset_wrap_period()
.Accessing clocks
By default, any systems requiring current
delta()
orelapsed()
should useRes<Time>
to access the default time configured for the program. By default, this refers toTime<Virtual>
except during theFixedMain
schedule when it refers toTime<Fixed>
. This ensures your system can be used either inUpdate
orFixedUpdate
schedule depending on what is needed.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn ambivalent_system(time: Res<Time>) { println!("this how I see time: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }
If your system needs to react based on real time (wall clock time), like for user interfaces, it should use
Res<Time<Real>>
. Thedelta()
andelapsed()
values will always correspond to real time and will not be affected by pause, time scaling or other tweaks.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn real_time_system(time: Res<Time<Real>>) { println!("this will always be real time: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }
If your system specifically needs to access fixed timestep clock, even when placed in
Update
schedule, you should useRes<Time<Fixed>>
. Thedelta()
andelapsed()
values will correspond to the latest fixed timestep that has been run.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn fixed_time_system(time: Res<Time<Fixed>>) { println!("this will always be the last executed fixed timestep: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }
Finally, if your system specifically needs to know the current virtual game time, even if placed inside
FixedUpdate
, for example to know if the game iswas_paused()
or to useeffective_speed()
, you can useRes<Time<Virtual>>
. However, if the system is placed inFixedUpdate
, extra care must be used because your system might be run multiple times with the samedelta()
andelapsed()
values as the virtual game time has not changed between the iterations.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn fixed_time_system(time: Res<Time<Virtual>>) { println!("this will be virtual time for this update: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); println!("also the relative speed of the game is now {}", time.effective_speed()); }
If you need to change the settings for any of the clocks, for example to
pause()
the game, you should useResMut<Time<Virtual>>
.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # #[derive(Event)] struct PauseEvent(bool); fn pause_system(mut time: ResMut<Time<Virtual>>, mut events: EventReader<PauseEvent>) { for ev in events.read() { if ev.0 { time.pause(); } else { time.unpause(); } } }
Adding custom clocks
New custom clocks can be created by creating your own struct as a context and passing it to
new_with()
. These clocks can be inserted as resources as normal and then accessed by systems. You can use theadvance_by()
oradvance_to()
methods to move the clock forwards based on your own logic.If you want to add methods for your time instance and they require access to both your context and the generic time part, it's probably simplest to add a custom trait for them and implement it for
Time<Custom>
.Your context struct will need to implement the [
Default
] trait because [Time
] structures support reflection. It also makes initialization trivial by being able to callapp.init_resource::<Time<Custom>>()
.You can also replace the "generic"
Time
clock resource if the "default" time for your game should not be the default virtual time provided. You can get a "generic" snapshot of your clock by callingas_generic()
and then overwrite the [Time
] resource with it. The default systems added byTimePlugin
will overwrite the [Time
] clock duringFirst
andFixedUpdate
schedules.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # use bevy_utils::Instant; # #[derive(Debug)] struct Custom { last_external_time: Instant, } impl Default for Custom { fn default() -> Self { Self { last_external_time: Instant::now(), } } } trait CustomTime { fn update_from_external(&mut self, instant: Instant); } impl CustomTime for Time<Custom> { fn update_from_external(&mut self, instant: Instant) { let delta = instant - self.context().last_external_time; self.advance_by(delta); self.context_mut().last_external_time = instant; } }
Functions
Time
Time
- context : bevy_time::real::Real
- wrap_period : bevy_utils::Duration
- delta : bevy_utils::Duration
- delta_secs : f32
- delta_secs_f64 : f64
- elapsed : bevy_utils::Duration
- elapsed_secs : f32
- elapsed_secs_f64 : f64
- elapsed_wrapped : bevy_utils::Duration
- elapsed_secs_wrapped : f32
- elapsed_secs_wrapped_f64 : f64
Description
A generic clock resource that tracks how much it has advanced since its previous update and since its creation.
Multiple instances of this resource are inserted automatically by
TimePlugin
:
Time<Real>
tracks real wall-clock time elapsed.Time<Virtual>
tracks virtual game time that may be paused or scaled.Time<Fixed>
tracks fixed timesteps based on virtual time.- [
Time
] is a generic clock that corresponds to "current" or "default" time for systems. It containsTime<Virtual>
except inside theFixedMain
schedule when it containsTime<Fixed>
.The time elapsed since the previous time this clock was advanced is saved as
delta()
and the total amount of time the clock has advanced is saved aselapsed()
. Both are represented as exact [Duration
] values with fixed nanosecond precision. The clock does not support time moving backwards, but it can be updated with [Duration::ZERO
] which will setdelta()
to zero.These values are also available in seconds as
f32
viadelta_secs()
andelapsed_secs()
, and also in seconds asf64
viadelta_secs_f64()
andelapsed_secs_f64()
.Since
elapsed_secs()
will grow constantly and isf32
, it will exhibit gradual precision loss. For applications that require anf32
value but suffer from gradual precision loss there iselapsed_secs_wrapped()
available. The same wrapped value is also available as [Duration
] andf64
for consistency. The wrap period is by default 1 hour, and can be set byset_wrap_period()
.Accessing clocks
By default, any systems requiring current
delta()
orelapsed()
should useRes<Time>
to access the default time configured for the program. By default, this refers toTime<Virtual>
except during theFixedMain
schedule when it refers toTime<Fixed>
. This ensures your system can be used either inUpdate
orFixedUpdate
schedule depending on what is needed.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn ambivalent_system(time: Res<Time>) { println!("this how I see time: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }
If your system needs to react based on real time (wall clock time), like for user interfaces, it should use
Res<Time<Real>>
. Thedelta()
andelapsed()
values will always correspond to real time and will not be affected by pause, time scaling or other tweaks.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn real_time_system(time: Res<Time<Real>>) { println!("this will always be real time: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }
If your system specifically needs to access fixed timestep clock, even when placed in
Update
schedule, you should useRes<Time<Fixed>>
. Thedelta()
andelapsed()
values will correspond to the latest fixed timestep that has been run.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn fixed_time_system(time: Res<Time<Fixed>>) { println!("this will always be the last executed fixed timestep: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }
Finally, if your system specifically needs to know the current virtual game time, even if placed inside
FixedUpdate
, for example to know if the game iswas_paused()
or to useeffective_speed()
, you can useRes<Time<Virtual>>
. However, if the system is placed inFixedUpdate
, extra care must be used because your system might be run multiple times with the samedelta()
andelapsed()
values as the virtual game time has not changed between the iterations.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn fixed_time_system(time: Res<Time<Virtual>>) { println!("this will be virtual time for this update: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); println!("also the relative speed of the game is now {}", time.effective_speed()); }
If you need to change the settings for any of the clocks, for example to
pause()
the game, you should useResMut<Time<Virtual>>
.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # #[derive(Event)] struct PauseEvent(bool); fn pause_system(mut time: ResMut<Time<Virtual>>, mut events: EventReader<PauseEvent>) { for ev in events.read() { if ev.0 { time.pause(); } else { time.unpause(); } } }
Adding custom clocks
New custom clocks can be created by creating your own struct as a context and passing it to
new_with()
. These clocks can be inserted as resources as normal and then accessed by systems. You can use theadvance_by()
oradvance_to()
methods to move the clock forwards based on your own logic.If you want to add methods for your time instance and they require access to both your context and the generic time part, it's probably simplest to add a custom trait for them and implement it for
Time<Custom>
.Your context struct will need to implement the [
Default
] trait because [Time
] structures support reflection. It also makes initialization trivial by being able to callapp.init_resource::<Time<Custom>>()
.You can also replace the "generic"
Time
clock resource if the "default" time for your game should not be the default virtual time provided. You can get a "generic" snapshot of your clock by callingas_generic()
and then overwrite the [Time
] resource with it. The default systems added byTimePlugin
will overwrite the [Time
] clock duringFirst
andFixedUpdate
schedules.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # use bevy_utils::Instant; # #[derive(Debug)] struct Custom { last_external_time: Instant, } impl Default for Custom { fn default() -> Self { Self { last_external_time: Instant::now(), } } } trait CustomTime { fn update_from_external(&mut self, instant: Instant); } impl CustomTime for Time<Custom> { fn update_from_external(&mut self, instant: Instant) { let delta = instant - self.context().last_external_time; self.advance_by(delta); self.context_mut().last_external_time = instant; } }
Functions
Time
Time
- context : bevy_time::virt::Virtual
- wrap_period : bevy_utils::Duration
- delta : bevy_utils::Duration
- delta_secs : f32
- delta_secs_f64 : f64
- elapsed : bevy_utils::Duration
- elapsed_secs : f32
- elapsed_secs_f64 : f64
- elapsed_wrapped : bevy_utils::Duration
- elapsed_secs_wrapped : f32
- elapsed_secs_wrapped_f64 : f64
Description
A generic clock resource that tracks how much it has advanced since its previous update and since its creation.
Multiple instances of this resource are inserted automatically by
TimePlugin
:
Time<Real>
tracks real wall-clock time elapsed.Time<Virtual>
tracks virtual game time that may be paused or scaled.Time<Fixed>
tracks fixed timesteps based on virtual time.- [
Time
] is a generic clock that corresponds to "current" or "default" time for systems. It containsTime<Virtual>
except inside theFixedMain
schedule when it containsTime<Fixed>
.The time elapsed since the previous time this clock was advanced is saved as
delta()
and the total amount of time the clock has advanced is saved aselapsed()
. Both are represented as exact [Duration
] values with fixed nanosecond precision. The clock does not support time moving backwards, but it can be updated with [Duration::ZERO
] which will setdelta()
to zero.These values are also available in seconds as
f32
viadelta_secs()
andelapsed_secs()
, and also in seconds asf64
viadelta_secs_f64()
andelapsed_secs_f64()
.Since
elapsed_secs()
will grow constantly and isf32
, it will exhibit gradual precision loss. For applications that require anf32
value but suffer from gradual precision loss there iselapsed_secs_wrapped()
available. The same wrapped value is also available as [Duration
] andf64
for consistency. The wrap period is by default 1 hour, and can be set byset_wrap_period()
.Accessing clocks
By default, any systems requiring current
delta()
orelapsed()
should useRes<Time>
to access the default time configured for the program. By default, this refers toTime<Virtual>
except during theFixedMain
schedule when it refers toTime<Fixed>
. This ensures your system can be used either inUpdate
orFixedUpdate
schedule depending on what is needed.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn ambivalent_system(time: Res<Time>) { println!("this how I see time: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }
If your system needs to react based on real time (wall clock time), like for user interfaces, it should use
Res<Time<Real>>
. Thedelta()
andelapsed()
values will always correspond to real time and will not be affected by pause, time scaling or other tweaks.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn real_time_system(time: Res<Time<Real>>) { println!("this will always be real time: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }
If your system specifically needs to access fixed timestep clock, even when placed in
Update
schedule, you should useRes<Time<Fixed>>
. Thedelta()
andelapsed()
values will correspond to the latest fixed timestep that has been run.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn fixed_time_system(time: Res<Time<Fixed>>) { println!("this will always be the last executed fixed timestep: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }
Finally, if your system specifically needs to know the current virtual game time, even if placed inside
FixedUpdate
, for example to know if the game iswas_paused()
or to useeffective_speed()
, you can useRes<Time<Virtual>>
. However, if the system is placed inFixedUpdate
, extra care must be used because your system might be run multiple times with the samedelta()
andelapsed()
values as the virtual game time has not changed between the iterations.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn fixed_time_system(time: Res<Time<Virtual>>) { println!("this will be virtual time for this update: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); println!("also the relative speed of the game is now {}", time.effective_speed()); }
If you need to change the settings for any of the clocks, for example to
pause()
the game, you should useResMut<Time<Virtual>>
.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # #[derive(Event)] struct PauseEvent(bool); fn pause_system(mut time: ResMut<Time<Virtual>>, mut events: EventReader<PauseEvent>) { for ev in events.read() { if ev.0 { time.pause(); } else { time.unpause(); } } }
Adding custom clocks
New custom clocks can be created by creating your own struct as a context and passing it to
new_with()
. These clocks can be inserted as resources as normal and then accessed by systems. You can use theadvance_by()
oradvance_to()
methods to move the clock forwards based on your own logic.If you want to add methods for your time instance and they require access to both your context and the generic time part, it's probably simplest to add a custom trait for them and implement it for
Time<Custom>
.Your context struct will need to implement the [
Default
] trait because [Time
] structures support reflection. It also makes initialization trivial by being able to callapp.init_resource::<Time<Custom>>()
.You can also replace the "generic"
Time
clock resource if the "default" time for your game should not be the default virtual time provided. You can get a "generic" snapshot of your clock by callingas_generic()
and then overwrite the [Time
] resource with it. The default systems added byTimePlugin
will overwrite the [Time
] clock duringFirst
andFixedUpdate
schedules.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # use bevy_utils::Instant; # #[derive(Debug)] struct Custom { last_external_time: Instant, } impl Default for Custom { fn default() -> Self { Self { last_external_time: Instant::now(), } } } trait CustomTime { fn update_from_external(&mut self, instant: Instant); } impl CustomTime for Time<Custom> { fn update_from_external(&mut self, instant: Instant) { let delta = instant - self.context().last_external_time; self.advance_by(delta); self.context_mut().last_external_time = instant; } }
Functions
Timer
Timer
- stopwatch : bevy_time::stopwatch::Stopwatch
- duration : bevy_utils::Duration
- mode : bevy_time::timer::TimerMode
- finished : bool
- times_finished_this_tick : u32
Description
Tracks elapsed time. Enters the finished state once
duration
is reached.Non repeating timers will stop tracking and stay in the finished state until reset. Repeating timers will only be in the finished state on each tick
duration
is reached or exceeded, and can still be reset at any given point.Paused timers will not have elapsed time increased.
Note that in order to advance the timer
tick
MUST be called.
Functions
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
Timer
- No Documentation 🚧
duration
Returns the duration of the timer.
Examples
# use bevy_time::*; use std::time::Duration; let timer = Timer::new(Duration::from_secs(1), TimerMode::Once); assert_eq!(timer.duration(), Duration::from_secs(1));
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
elapsed
Returns the time elapsed on the timer. Guaranteed to be between 0.0 and
duration
. Will only equalduration
when the timer is finished and non repeating. See alsoStopwatch::elapsed
.Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.elapsed(), Duration::from_secs_f32(0.5));
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
elapsed_secs
Returns the time elapsed on the timer as an
f32
. See alsoTimer::elapsed
.
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
elapsed_secs_f64
Returns the time elapsed on the timer as an
f64
. See alsoTimer::elapsed
.
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Timer
- No Documentation 🚧 - other :
Timer
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
finished
Returns
true
if the timer has reached its duration. For repeating timers, this method behaves identically to [Timer::just_finished
].Examples
# use bevy_time::*; use std::time::Duration; let mut timer_once = Timer::from_seconds(1.0, TimerMode::Once); timer_once.tick(Duration::from_secs_f32(1.5)); assert!(timer_once.finished()); timer_once.tick(Duration::from_secs_f32(0.5)); assert!(timer_once.finished()); let mut timer_repeating = Timer::from_seconds(1.0, TimerMode::Repeating); timer_repeating.tick(Duration::from_secs_f32(1.1)); assert!(timer_repeating.finished()); timer_repeating.tick(Duration::from_secs_f32(0.8)); assert!(!timer_repeating.finished()); timer_repeating.tick(Duration::from_secs_f32(0.6)); assert!(timer_repeating.finished());
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
fraction
Returns the fraction of the timer elapsed time (goes from 0.0 to 1.0).
Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(2.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.fraction(), 0.25);
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
fraction_remaining
Returns the fraction of the timer remaining time (goes from 1.0 to 0.0).
Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(2.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.fraction_remaining(), 0.75);
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
from_seconds
Creates a new timer with a given duration in seconds.
Example
# use bevy_time::*; let mut timer = Timer::from_seconds(1.0, TimerMode::Once);
Arguments
- duration :
f32
- No Documentation 🚧 - mode :
TimerMode
- No Documentation 🚧
Returns
- arg0 :
Timer
- No Documentation 🚧
just_finished
Returns
true
only on the tick the timer reached its duration.Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(1.5)); assert!(timer.just_finished()); timer.tick(Duration::from_secs_f32(0.5)); assert!(!timer.just_finished());
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
mode
Returns the mode of the timer.
Examples
# use bevy_time::*; let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); assert_eq!(timer.mode(), TimerMode::Repeating);
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
TimerMode
- No Documentation 🚧
new
Creates a new timer with a given duration. See also
Timer::from_seconds
.
Arguments
- duration :
Duration
- No Documentation 🚧 - mode :
TimerMode
- No Documentation 🚧
Returns
- arg0 :
Timer
- No Documentation 🚧
pause
Pauses the Timer. Disables the ticking of the timer. See also
Stopwatch::pause
.Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); timer.pause(); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.elapsed_secs(), 0.0);
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
paused
Returns
true
if the timer is paused. See alsoStopwatch::is_paused
.Examples
# use bevy_time::*; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); assert!(!timer.paused()); timer.pause(); assert!(timer.paused()); timer.unpause(); assert!(!timer.paused());
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
remaining
Returns the remaining time using Duration
Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(2.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.remaining(), Duration::from_secs_f32(1.5));
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
remaining_secs
Returns the remaining time in seconds
Examples
# use bevy_time::*; use std::cmp::Ordering; use std::time::Duration; let mut timer = Timer::from_seconds(2.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(0.5)); let result = timer.remaining_secs().total_cmp(&1.5); assert_eq!(Ordering::Equal, result);
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
reset
Resets the timer. The reset doesn't affect the
paused
state of the timer. See alsoStopwatch::reset
. Examples# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(1.5)); timer.reset(); assert!(!timer.finished()); assert!(!timer.just_finished()); assert_eq!(timer.elapsed_secs(), 0.0);
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
set_duration
Sets the duration of the timer.
Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.5, TimerMode::Once); timer.set_duration(Duration::from_secs(1)); assert_eq!(timer.duration(), Duration::from_secs(1));
Arguments
- _self :
Timer
- No Documentation 🚧 - duration :
Duration
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
set_elapsed
Sets the elapsed time of the timer without any other considerations. See also
Stopwatch::set
.
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); timer.set_elapsed(Duration::from_secs(2)); assert_eq!(timer.elapsed(), Duration::from_secs(2)); // the timer is not finished even if the elapsed time is greater than the duration. assert!(!timer.finished());
Arguments
- _self :
Timer
- No Documentation 🚧 - time :
Duration
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
set_mode
Sets the mode of the timer.
Examples
# use bevy_time::*; let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); timer.set_mode(TimerMode::Once); assert_eq!(timer.mode(), TimerMode::Once);
Arguments
- _self :
Timer
- No Documentation 🚧 - mode :
TimerMode
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
times_finished_this_tick
Returns the number of times a repeating timer finished during the last
tick
call. For non repeating-timers, this method will only ever return 0 or 1.Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); timer.tick(Duration::from_secs_f32(6.0)); assert_eq!(timer.times_finished_this_tick(), 6); timer.tick(Duration::from_secs_f32(2.0)); assert_eq!(timer.times_finished_this_tick(), 2); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.times_finished_this_tick(), 0);
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
unpause
Unpauses the Timer. Resumes the ticking of the timer. See also
Stopwatch::unpause()
.Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); timer.pause(); timer.tick(Duration::from_secs_f32(0.5)); timer.unpause(); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.elapsed_secs(), 0.5);
Arguments
- _self :
Timer
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
TimerMode
Once
Repeating
Description
Specifies [
Timer
] behavior.
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
TimerMode
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
TimerMode
- No Documentation 🚧
Returns
- arg0 :
TimerMode
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
TimerMode
- No Documentation 🚧 - other :
TimerMode
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
Virtual
Virtual
- max_delta : bevy_utils::Duration
- paused : bool
- relative_speed : f64
- effective_speed : f64
Description
The virtual game clock representing game time.
A specialization of the [
Time
] structure. For method documentation, see [Time<Virtual>#impl-Time<Virtual>
].Normally used as
Time<Virtual>
. It is automatically inserted as a resource byTimePlugin
and updated based onTime<Real>
. The virtual clock is automatically set as the default generic [Time
] resource for the update.The virtual clock differs from real time clock in that it can be paused, sped up and slowed down. It also limits how much it can advance in a single update in order to prevent unexpected behavior in cases where updates do not happen at regular intervals (e.g. coming back after the program was suspended a long time).
The virtual clock can be paused by calling
pause()
and unpaused by callingunpause()
. When the game clock is pauseddelta()
will be zero on each update, andelapsed()
will not grow.effective_speed()
will return0.0
. Callingpause()
will not affect value thedelta()
value for the update currently being processed.The speed of the virtual clock can be changed by calling
set_relative_speed()
. A value of2.0
means that virtual clock should advance twice as fast as real time, meaning thatdelta()
values will be double of whatTime<Real>::delta()
reports andelapsed()
will go twice as fast asTime<Real>::elapsed()
. Callingset_relative_speed()
will not affect thedelta()
value for the update currently being processed.The maximum amount of delta time that can be added by a single update can be set by
set_max_delta()
. This value serves a dual purpose in the virtual clock.If the game temporarily freezes due to any reason, such as disk access, a blocking system call, or operating system level suspend, reporting the full elapsed delta time is likely to cause bugs in game logic. Usually if a laptop is suspended for an hour, it doesn't make sense to try to simulate the game logic for the elapsed hour when resuming. Instead it is better to lose the extra time and pretend a shorter duration of time passed. Setting
max_delta()
to a relatively short time means that the impact on game logic will be minimal.If the game lags for some reason, meaning that it will take a longer time to compute a frame than the real time that passes during the computation, then we would fall behind in processing virtual time. If this situation persists, and computing a frame takes longer depending on how much virtual time has passed, the game would enter a "death spiral" where computing each frame takes longer and longer and the game will appear to freeze. By limiting the maximum time that can be added at once, we also limit the amount of virtual time the game needs to compute for each frame. This means that the game will run slow, and it will run slower than real time, but it will not freeze and it will recover as soon as computation becomes fast again.
You should set
max_delta()
to a value that is approximately the minimum FPS your game should have even if heavily lagged for a moment. The actual FPS when lagged will be somewhat lower than this, depending on how much more time it takes to compute a frame compared to real time. You should also consider how stable your FPS is, as the limit will also dictate how big of an FPS drop you can accept without losing time and falling behind real time.
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
Virtual
- No Documentation 🚧
Returns
- arg0 :
Virtual
- No Documentation 🚧
GlobalTransform
GlobalTransform
- glam::Affine3A
Description
[
GlobalTransform
] is an affine transformation from entity-local coordinates to worldspace coordinates.You cannot directly mutate [
GlobalTransform
]; instead, you change an entity's transform by manipulating its [Transform
], which indirectly causes Bevy to update its [GlobalTransform
].
- To get the global transform of an entity, you should get its [
GlobalTransform
].- For transform hierarchies to work correctly, you must have both a [
Transform
] and a [GlobalTransform
].
You may use theTransformBundle
to guarantee this.TransformBundle
is now deprecated. [GlobalTransform
] is automatically inserted whenever [Transform
] is inserted.[
Transform
] and [GlobalTransform
][
Transform
] transforms an entity relative to its parent's reference frame, or relative to world space coordinates, if it doesn't have aParent
.[
GlobalTransform
] is managed by Bevy; it is computed by successively applying the [Transform
] of each ancestor entity which has a Transform. This is done automatically by Bevy-internal systems in the system setTransformPropagate
.This system runs during
PostUpdate
. If you update the [Transform
] of an entity in this schedule or after, you will notice a 1 frame lag before the [GlobalTransform
] is updated.Examples
Functions
affine
Returns the 3d affine transformation matrix as an [
Affine3A
].
Arguments
- _self :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
back
Return the local back vector (Z).
Arguments
- _self :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
GlobalTransform
- No Documentation 🚧
compute_matrix
Returns the 3d affine transformation matrix as a [
Mat4
].
Arguments
- _self :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
compute_transform
Returns the transformation as a [
Transform
]. The transform is expected to be non-degenerate and without shearing, or the output will be invalid.
Arguments
- _self :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
Transform
- No Documentation 🚧
down
Return the local down vector (-Y).
Arguments
- _self :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
GlobalTransform
- No Documentation 🚧 - other :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
forward
Return the local forward vector (-Z).
Arguments
- _self :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
from_isometry
No Documentation 🚧
Arguments
- iso :
Isometry3d
- No Documentation 🚧
Returns
- arg0 :
GlobalTransform
- No Documentation 🚧
from_rotation
No Documentation 🚧
Arguments
- rotation :
Quat
- No Documentation 🚧
Returns
- arg0 :
GlobalTransform
- No Documentation 🚧
from_scale
No Documentation 🚧
Arguments
- scale :
Vec3
- No Documentation 🚧
Returns
- arg0 :
GlobalTransform
- No Documentation 🚧
from_translation
No Documentation 🚧
Arguments
- translation :
Vec3
- No Documentation 🚧
Returns
- arg0 :
GlobalTransform
- No Documentation 🚧
from_xyz
No Documentation 🚧
Arguments
- x :
f32
- No Documentation 🚧 - y :
f32
- No Documentation 🚧 - z :
f32
- No Documentation 🚧
Returns
- arg0 :
GlobalTransform
- No Documentation 🚧
left
Return the local left vector (-X).
Arguments
- _self :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
GlobalTransform
- No Documentation 🚧 - value :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
GlobalTransform
- No Documentation 🚧 - arg1 :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
GlobalTransform
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
GlobalTransform
- No Documentation 🚧 - arg1 :
Transform
- No Documentation 🚧
Returns
- arg0 :
GlobalTransform
- No Documentation 🚧
mul_transform
Multiplies
self
withtransform
component by component, returning the resulting [GlobalTransform
]
Arguments
- _self :
GlobalTransform
- No Documentation 🚧 - transform :
Transform
- No Documentation 🚧
Returns
- arg0 :
GlobalTransform
- No Documentation 🚧
radius_vec3a
Get an upper bound of the radius from the given
extents
.
Arguments
- _self :
GlobalTransform
- No Documentation 🚧 - extents :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
reparented_to
Returns the [
Transform
]self
would have if it was a child of an entity with theparent
[GlobalTransform
]. This is useful if you want to "reparent" anEntity
. Say you have an entitye1
that you want to turn into a child ofe2
, but you wante1
to keep the same global transform, even after re-parenting. You would use:# use bevy_transform::prelude::{GlobalTransform, Transform}; # use bevy_ecs::prelude::{Entity, Query, Component, Commands}; # use bevy_hierarchy::{prelude::Parent, BuildChildren}; #[derive(Component)] struct ToReparent { new_parent: Entity, } fn reparent_system( mut commands: Commands, mut targets: Query<(&mut Transform, Entity, &GlobalTransform, &ToReparent)>, transforms: Query<&GlobalTransform>, ) { for (mut transform, entity, initial, to_reparent) in targets.iter_mut() { if let Ok(parent_transform) = transforms.get(to_reparent.new_parent) { *transform = initial.reparented_to(parent_transform); commands.entity(entity) .remove::<ToReparent>() .set_parent(to_reparent.new_parent); } } }
The transform is expected to be non-degenerate and without shearing, or the output will be invalid.
Arguments
- _self :
GlobalTransform
- No Documentation 🚧 - parent :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
Transform
- No Documentation 🚧
right
Return the local right vector (X).
Arguments
- _self :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
rotation
Get the rotation as a [
Quat
]. The transform is expected to be non-degenerate and without shearing, or the output will be invalid.Warning
This is calculated using
to_scale_rotation_translation
, meaning that you should probably use it directly if you also need translation or scale.
Arguments
- _self :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
scale
Get the scale as a [
Vec3
]. The transform is expected to be non-degenerate and without shearing, or the output will be invalid. Some of the computations overlap withto_scale_rotation_translation
, which means you should use it instead if you also need rotation.
Arguments
- _self :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
to_isometry
Returns the isometric part of the transformation as an [isometry]. Any scaling done by the transformation will be ignored. The transform is expected to be non-degenerate and without shearing, or the output will be invalid. [isometry]: Isometry3d
Arguments
- _self :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
Isometry3d
- No Documentation 🚧
transform_point
Transforms the given point from local space to global space, applying shear, scale, rotation and translation. It can be used like this:
# use bevy_transform::prelude::{GlobalTransform}; # use bevy_math::prelude::Vec3; let global_transform = GlobalTransform::from_xyz(1., 2., 3.); let local_point = Vec3::new(1., 2., 3.); let global_point = global_transform.transform_point(local_point); assert_eq!(global_point, Vec3::new(2., 4., 6.));
# use bevy_transform::prelude::{GlobalTransform}; # use bevy_math::Vec3; let global_point = Vec3::new(2., 4., 6.); let global_transform = GlobalTransform::from_xyz(1., 2., 3.); let local_point = global_transform.affine().inverse().transform_point3(global_point); assert_eq!(local_point, Vec3::new(1., 2., 3.))
To apply shear, scale, and rotation without applying translation, different functions are available:
# use bevy_transform::prelude::{GlobalTransform}; # use bevy_math::prelude::Vec3; let global_transform = GlobalTransform::from_xyz(1., 2., 3.); let local_direction = Vec3::new(1., 2., 3.); let global_direction = global_transform.affine().transform_vector3(local_direction); assert_eq!(global_direction, Vec3::new(1., 2., 3.)); let roundtripped_local_direction = global_transform.affine().inverse().transform_vector3(global_direction); assert_eq!(roundtripped_local_direction, local_direction);
Arguments
- _self :
GlobalTransform
- No Documentation 🚧 - point :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
translation
Get the translation as a [
Vec3
].
Arguments
- _self :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
translation_vec3a
Get the translation as a [
Vec3A
].
Arguments
- _self :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
up
Return the local up vector (Y).
Arguments
- _self :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
Transform
Transform
- translation : glam::Vec3
- rotation : glam::Quat
- scale : glam::Vec3
Description
Describe the position of an entity. If the entity has a parent, the position is relative to its parent position.
- To place or move an entity, you should set its [
Transform
].- To get the global transform of an entity, you should get its [
GlobalTransform
].- To be displayed, an entity must have both a [
Transform
] and a [GlobalTransform
].
You may use theTransformBundle
to guarantee this.TransformBundle
is now deprecated. [GlobalTransform
] is automatically inserted whenever [Transform
] is inserted.[
Transform
] and [GlobalTransform
][
Transform
] is the position of an entity relative to its parent position, or the reference frame if it doesn't have aParent
.[
GlobalTransform
] is the position of an entity relative to the reference frame.[
GlobalTransform
] is updated from [Transform
] by systems in the system setTransformPropagate
.This system runs during
PostUpdate
. If you update the [Transform
] of an entity during this set or after, you will notice a 1 frame lag before the [GlobalTransform
] is updated.Examples
Functions
back
Equivalent to [
local_z()
][Transform::local_z]
Arguments
- _self :
Transform
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Transform
- No Documentation 🚧
Returns
- arg0 :
Transform
- No Documentation 🚧
compute_affine
Returns the 3d affine transformation matrix from this transforms translation, rotation, and scale.
Arguments
- _self :
Transform
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
compute_matrix
Returns the 3d affine transformation matrix from this transforms translation, rotation, and scale.
Arguments
- _self :
Transform
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
down
Equivalent to [
-local_y()
][Transform::local_y]
Arguments
- _self :
Transform
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Transform
- No Documentation 🚧 - other :
Transform
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
forward
Equivalent to [
-local_z()
][Transform::local_z]
Arguments
- _self :
Transform
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
from_isometry
Creates a new [
Transform
] that is equivalent to the given [isometry]. [isometry]: Isometry3d
Arguments
- iso :
Isometry3d
- No Documentation 🚧
Returns
- arg0 :
Transform
- No Documentation 🚧
from_matrix
Extracts the translation, rotation, and scale from
matrix
. It must be a 3d affine transformation matrix.
Arguments
- world_from_local :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Transform
- No Documentation 🚧
from_rotation
Creates a new [
Transform
], withrotation
. Translation will be 0 and scale 1 on all axes.
Arguments
- rotation :
Quat
- No Documentation 🚧
Returns
- arg0 :
Transform
- No Documentation 🚧
from_scale
Creates a new [
Transform
], withscale
. Translation will be 0 and rotation 0 on all axes.
Arguments
- scale :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Transform
- No Documentation 🚧
from_translation
Creates a new [
Transform
], withtranslation
. Rotation will be 0 and scale 1 on all axes.
Arguments
- translation :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Transform
- No Documentation 🚧
from_xyz
Creates a new [
Transform
] at the position(x, y, z)
. In 2d, thez
component is used for z-ordering elements: higherz
-value will be in front of lowerz
-value.
Arguments
- x :
f32
- No Documentation 🚧 - y :
f32
- No Documentation 🚧 - z :
f32
- No Documentation 🚧
Returns
- arg0 :
Transform
- No Documentation 🚧
is_finite
Returns
true
if, and only if, translation, rotation and scale all are finite. If any of them contains aNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
Transform
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
left
Equivalent to [
-local_x()
][Transform::local_x()]
Arguments
- _self :
Transform
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
local_x
Get the unit vector in the local
X
direction.
Arguments
- _self :
Transform
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
local_y
Get the unit vector in the local
Y
direction.
Arguments
- _self :
Transform
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
local_z
Get the unit vector in the local
Z
direction.
Arguments
- _self :
Transform
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Transform
- No Documentation 🚧 - value :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
Transform
- No Documentation 🚧 - arg1 :
GlobalTransform
- No Documentation 🚧
Returns
- arg0 :
GlobalTransform
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
Transform
- No Documentation 🚧 - arg1 :
Transform
- No Documentation 🚧
Returns
- arg0 :
Transform
- No Documentation 🚧
mul_transform
Multiplies
self
withtransform
component by component, returning the resulting [Transform
]
Arguments
- _self :
Transform
- No Documentation 🚧 - transform :
Transform
- No Documentation 🚧
Returns
- arg0 :
Transform
- No Documentation 🚧
right
Equivalent to [
local_x()
][Transform::local_x()]
Arguments
- _self :
Transform
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
rotate
Rotates this [
Transform
] by the given rotation. If this [Transform
] has a parent, therotation
is relative to the rotation of the parent.Examples
- [
3d_rotation
] [3d_rotation
]: https://github.com/bevyengine/bevy/blob/latest/examples/transforms/3d_rotation.rs
Arguments
- _self :
Transform
- No Documentation 🚧 - rotation :
Quat
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
rotate_around
Rotates this [
Transform
] around apoint
in space. If this [Transform
] has a parent, thepoint
is relative to the [Transform
] of the parent.
Arguments
- _self :
Transform
- No Documentation 🚧 - point :
Vec3
- No Documentation 🚧 - rotation :
Quat
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
rotate_axis
Rotates this [
Transform
] around the givenaxis
byangle
(in radians). If this [Transform
] has a parent, theaxis
is relative to the rotation of the parent.
Arguments
- _self :
Transform
- No Documentation 🚧 - axis :
Dir3
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
rotate_local
Rotates this [
Transform
] by the givenrotation
. Therotation
is relative to this [Transform
]'s current rotation.
Arguments
- _self :
Transform
- No Documentation 🚧 - rotation :
Quat
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
rotate_local_axis
Rotates this [
Transform
] around its localaxis
byangle
(in radians).
Arguments
- _self :
Transform
- No Documentation 🚧 - axis :
Dir3
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
rotate_local_x
Rotates this [
Transform
] around its localX
axis byangle
(in radians).
Arguments
- _self :
Transform
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
rotate_local_y
Rotates this [
Transform
] around its localY
axis byangle
(in radians).
Arguments
- _self :
Transform
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
rotate_local_z
Rotates this [
Transform
] around its localZ
axis byangle
(in radians).
Arguments
- _self :
Transform
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
rotate_x
Rotates this [
Transform
] around theX
axis byangle
(in radians). If this [Transform
] has a parent, the axis is relative to the rotation of the parent.
Arguments
- _self :
Transform
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
rotate_y
Rotates this [
Transform
] around theY
axis byangle
(in radians). If this [Transform
] has a parent, the axis is relative to the rotation of the parent.
Arguments
- _self :
Transform
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
rotate_z
Rotates this [
Transform
] around theZ
axis byangle
(in radians). If this [Transform
] has a parent, the axis is relative to the rotation of the parent.
Arguments
- _self :
Transform
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
to_isometry
Get the [isometry] defined by this transform's rotation and translation, ignoring scale. [isometry]: Isometry3d
Arguments
- _self :
Transform
- No Documentation 🚧
Returns
- arg0 :
Isometry3d
- No Documentation 🚧
transform_point
Transforms the given
point
, applying scale, rotation and translation. If this [Transform
] has an ancestor entity with a [Transform
] component, [Transform::transform_point
] will transform a point in local space into its parent transform's space. If this [Transform
] does not have a parent, [Transform::transform_point
] will transform a point in local space into worldspace coordinates. If you always want to transform a point in local space to worldspace, or if you need the inverse transformations, see [GlobalTransform::transform_point()
].
Arguments
- _self :
Transform
- No Documentation 🚧 - point :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
translate_around
Translates this [
Transform
] around apoint
in space. If this [Transform
] has a parent, thepoint
is relative to the [Transform
] of the parent.
Arguments
- _self :
Transform
- No Documentation 🚧 - point :
Vec3
- No Documentation 🚧 - rotation :
Quat
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
up
Equivalent to [
local_y()
][Transform::local_y]
Arguments
- _self :
Transform
- No Documentation 🚧
Returns
- arg0 :
Dir3
- No Documentation 🚧
with_rotation
Returns this [
Transform
] with a new rotation.
Arguments
- _self :
Transform
- No Documentation 🚧 - rotation :
Quat
- No Documentation 🚧
Returns
- arg0 :
Transform
- No Documentation 🚧
with_scale
Returns this [
Transform
] with a new scale.
Arguments
- _self :
Transform
- No Documentation 🚧 - scale :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Transform
- No Documentation 🚧
with_translation
Returns this [
Transform
] with a new translation.
Arguments
- _self :
Transform
- No Documentation 🚧 - translation :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Transform
- No Documentation 🚧
Duration
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
abs_diff
Computes the absolute difference between
self
andother
.Examples
use std::time::Duration; assert_eq!(Duration::new(100, 0).abs_diff(Duration::new(80, 0)), Duration::new(20, 0)); assert_eq!(Duration::new(100, 400_000_000).abs_diff(Duration::new(110, 0)), Duration::new(9, 600_000_000));
Arguments
- _self :
Duration
- No Documentation 🚧 - other :
Duration
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
Duration
- No Documentation 🚧 - rhs :
Duration
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
as_micros
Returns the total number of whole microseconds contained by this
Duration
.Examples
use std::time::Duration; let duration = Duration::new(5, 730_023_852); assert_eq!(duration.as_micros(), 5_730_023);
Arguments
- _self :
Duration
- No Documentation 🚧
Returns
- arg0 :
u128
- No Documentation 🚧
as_millis
Returns the total number of whole milliseconds contained by this
Duration
.Examples
use std::time::Duration; let duration = Duration::new(5, 730_023_852); assert_eq!(duration.as_millis(), 5_730);
Arguments
- _self :
Duration
- No Documentation 🚧
Returns
- arg0 :
u128
- No Documentation 🚧
as_nanos
Returns the total number of nanoseconds contained by this
Duration
.Examples
use std::time::Duration; let duration = Duration::new(5, 730_023_852); assert_eq!(duration.as_nanos(), 5_730_023_852);
Arguments
- _self :
Duration
- No Documentation 🚧
Returns
- arg0 :
u128
- No Documentation 🚧
as_secs
Returns the number of whole seconds contained by this
Duration
. The returned value does not include the fractional (nanosecond) part of the duration, which can be obtained using [subsec_nanos
].Examples
use std::time::Duration; let duration = Duration::new(5, 730_023_852); assert_eq!(duration.as_secs(), 5);
To determine the total number of seconds represented by the
Duration
including the fractional part, use [as_secs_f64
] or [as_secs_f32
] [as_secs_f64
]: Duration::as_secs_f64 [as_secs_f32
]: Duration::as_secs_f32 [subsec_nanos
]: Duration::subsec_nanos
Arguments
- _self :
Duration
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
as_secs_f32
Returns the number of seconds contained by this
Duration
asf32
. The returned value includes the fractional (nanosecond) part of the duration.Examples
use std::time::Duration; let dur = Duration::new(2, 700_000_000); assert_eq!(dur.as_secs_f32(), 2.7);
Arguments
- _self :
Duration
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
as_secs_f64
Returns the number of seconds contained by this
Duration
asf64
. The returned value includes the fractional (nanosecond) part of the duration.Examples
use std::time::Duration; let dur = Duration::new(2, 700_000_000); assert_eq!(dur.as_secs_f64(), 2.7);
Arguments
- _self :
Duration
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
Duration
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Duration
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
Duration
- No Documentation 🚧 - rhs :
u32
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
div_duration_f32
Divides
Duration
byDuration
and returnsf32
.Examples
use std::time::Duration; let dur1 = Duration::new(2, 700_000_000); let dur2 = Duration::new(5, 400_000_000); assert_eq!(dur1.div_duration_f32(dur2), 0.5);
Arguments
- _self :
Duration
- No Documentation 🚧 - rhs :
Duration
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
div_duration_f64
Divides
Duration
byDuration
and returnsf64
.Examples
use std::time::Duration; let dur1 = Duration::new(2, 700_000_000); let dur2 = Duration::new(5, 400_000_000); assert_eq!(dur1.div_duration_f64(dur2), 0.5);
Arguments
- _self :
Duration
- No Documentation 🚧 - rhs :
Duration
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
div_f32
Divides
Duration
byf32
.Panics
This method will panic if result is negative, overflows
Duration
or not finite.Examples
use std::time::Duration; let dur = Duration::new(2, 700_000_000); // note that due to rounding errors result is slightly // different from 0.859_872_611 assert_eq!(dur.div_f32(3.14), Duration::new(0, 859_872_580)); assert_eq!(dur.div_f32(3.14e5), Duration::new(0, 8_599));
Arguments
- _self :
Duration
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
div_f64
Divides
Duration
byf64
.Panics
This method will panic if result is negative, overflows
Duration
or not finite.Examples
use std::time::Duration; let dur = Duration::new(2, 700_000_000); assert_eq!(dur.div_f64(3.14), Duration::new(0, 859_872_611)); assert_eq!(dur.div_f64(3.14e5), Duration::new(0, 8_599));
Arguments
- _self :
Duration
- No Documentation 🚧 - rhs :
f64
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Duration
- No Documentation 🚧 - other :
Duration
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_micros
Creates a new
Duration
from the specified number of microseconds.Examples
use std::time::Duration; let duration = Duration::from_micros(1_000_002); assert_eq!(1, duration.as_secs()); assert_eq!(2_000, duration.subsec_nanos());
Arguments
- micros :
u64
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
from_millis
Creates a new
Duration
from the specified number of milliseconds.Examples
use std::time::Duration; let duration = Duration::from_millis(2_569); assert_eq!(2, duration.as_secs()); assert_eq!(569_000_000, duration.subsec_nanos());
Arguments
- millis :
u64
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
from_nanos
Creates a new
Duration
from the specified number of nanoseconds. Note: Using this on the return value ofas_nanos()
might cause unexpected behavior:as_nanos()
returns a u128, and can return values that do not fit in u64, e.g. 585 years. Instead, consider using the patternDuration::new(d.as_secs(), d.subsec_nanos())
if you cannot copy/clone the Duration directly.Examples
use std::time::Duration; let duration = Duration::from_nanos(1_000_000_123); assert_eq!(1, duration.as_secs()); assert_eq!(123, duration.subsec_nanos());
Arguments
- nanos :
u64
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
from_secs
Creates a new
Duration
from the specified number of whole seconds.Examples
use std::time::Duration; let duration = Duration::from_secs(5); assert_eq!(5, duration.as_secs()); assert_eq!(0, duration.subsec_nanos());
Arguments
- secs :
u64
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
from_secs_f32
Creates a new
Duration
from the specified number of seconds represented asf32
.Panics
This constructor will panic if
secs
is negative, overflowsDuration
or not finite.Examples
use std::time::Duration; let res = Duration::from_secs_f32(0.0); assert_eq!(res, Duration::new(0, 0)); let res = Duration::from_secs_f32(1e-20); assert_eq!(res, Duration::new(0, 0)); let res = Duration::from_secs_f32(4.2e-7); assert_eq!(res, Duration::new(0, 420)); let res = Duration::from_secs_f32(2.7); assert_eq!(res, Duration::new(2, 700_000_048)); let res = Duration::from_secs_f32(3e10); assert_eq!(res, Duration::new(30_000_001_024, 0)); // subnormal float let res = Duration::from_secs_f32(f32::from_bits(1)); assert_eq!(res, Duration::new(0, 0)); // conversion uses rounding let res = Duration::from_secs_f32(0.999e-9); assert_eq!(res, Duration::new(0, 1));
Arguments
- secs :
f32
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
from_secs_f64
Creates a new
Duration
from the specified number of seconds represented asf64
.Panics
This constructor will panic if
secs
is negative, overflowsDuration
or not finite.Examples
use std::time::Duration; let res = Duration::from_secs_f64(0.0); assert_eq!(res, Duration::new(0, 0)); let res = Duration::from_secs_f64(1e-20); assert_eq!(res, Duration::new(0, 0)); let res = Duration::from_secs_f64(4.2e-7); assert_eq!(res, Duration::new(0, 420)); let res = Duration::from_secs_f64(2.7); assert_eq!(res, Duration::new(2, 700_000_000)); let res = Duration::from_secs_f64(3e10); assert_eq!(res, Duration::new(30_000_000_000, 0)); // subnormal float let res = Duration::from_secs_f64(f64::from_bits(1)); assert_eq!(res, Duration::new(0, 0)); // conversion uses rounding let res = Duration::from_secs_f64(0.999e-9); assert_eq!(res, Duration::new(0, 1));
Arguments
- secs :
f64
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
is_zero
Returns true if this
Duration
spans no time.Examples
use std::time::Duration; assert!(Duration::ZERO.is_zero()); assert!(Duration::new(0, 0).is_zero()); assert!(Duration::from_nanos(0).is_zero()); assert!(Duration::from_secs(0).is_zero()); assert!(!Duration::new(1, 1).is_zero()); assert!(!Duration::from_nanos(1).is_zero()); assert!(!Duration::from_secs(1).is_zero());
Arguments
- _self :
Duration
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Duration
- No Documentation 🚧 - rhs :
u32
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
mul_f32
Multiplies
Duration
byf32
.Panics
This method will panic if result is negative, overflows
Duration
or not finite.Examples
use std::time::Duration; let dur = Duration::new(2, 700_000_000); assert_eq!(dur.mul_f32(3.14), Duration::new(8, 478_000_641)); assert_eq!(dur.mul_f32(3.14e5), Duration::new(847_800, 0));
Arguments
- _self :
Duration
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
mul_f64
Multiplies
Duration
byf64
.Panics
This method will panic if result is negative, overflows
Duration
or not finite.Examples
use std::time::Duration; let dur = Duration::new(2, 700_000_000); assert_eq!(dur.mul_f64(3.14), Duration::new(8, 478_000_000)); assert_eq!(dur.mul_f64(3.14e5), Duration::new(847_800, 0));
Arguments
- _self :
Duration
- No Documentation 🚧 - rhs :
f64
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
new
Creates a new
Duration
from the specified number of whole seconds and additional nanoseconds. If the number of nanoseconds is greater than 1 billion (the number of nanoseconds in a second), then it will carry over into the seconds provided.Panics
This constructor will panic if the carry from the nanoseconds overflows the seconds counter.
Examples
use std::time::Duration; let five_seconds = Duration::new(5, 0);
Arguments
- secs :
u64
- No Documentation 🚧 - nanos :
u32
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
saturating_add
Saturating
Duration
addition. Computesself + other
, returning [Duration::MAX
] if overflow occurred.Examples
#![feature(duration_constants)] use std::time::Duration; assert_eq!(Duration::new(0, 0).saturating_add(Duration::new(0, 1)), Duration::new(0, 1)); assert_eq!(Duration::new(1, 0).saturating_add(Duration::new(u64::MAX, 0)), Duration::MAX);
Arguments
- _self :
Duration
- No Documentation 🚧 - rhs :
Duration
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
saturating_mul
Saturating
Duration
multiplication. Computesself * other
, returning [Duration::MAX
] if overflow occurred.Examples
#![feature(duration_constants)] use std::time::Duration; assert_eq!(Duration::new(0, 500_000_001).saturating_mul(2), Duration::new(1, 2)); assert_eq!(Duration::new(u64::MAX - 1, 0).saturating_mul(2), Duration::MAX);
Arguments
- _self :
Duration
- No Documentation 🚧 - rhs :
u32
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
saturating_sub
Saturating
Duration
subtraction. Computesself - other
, returning [Duration::ZERO
] if the result would be negative or if overflow occurred.Examples
use std::time::Duration; assert_eq!(Duration::new(0, 1).saturating_sub(Duration::new(0, 0)), Duration::new(0, 1)); assert_eq!(Duration::new(0, 0).saturating_sub(Duration::new(0, 1)), Duration::ZERO);
Arguments
- _self :
Duration
- No Documentation 🚧 - rhs :
Duration
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
Duration
- No Documentation 🚧 - rhs :
Duration
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
subsec_micros
Returns the fractional part of this
Duration
, in whole microseconds. This method does not return the length of the duration when represented by microseconds. The returned number always represents a fractional portion of a second (i.e., it is less than one million).Examples
use std::time::Duration; let duration = Duration::from_micros(1_234_567); assert_eq!(duration.as_secs(), 1); assert_eq!(duration.subsec_micros(), 234_567);
Arguments
- _self :
Duration
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
subsec_millis
Returns the fractional part of this
Duration
, in whole milliseconds. This method does not return the length of the duration when represented by milliseconds. The returned number always represents a fractional portion of a second (i.e., it is less than one thousand).Examples
use std::time::Duration; let duration = Duration::from_millis(5_432); assert_eq!(duration.as_secs(), 5); assert_eq!(duration.subsec_millis(), 432);
Arguments
- _self :
Duration
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
subsec_nanos
Returns the fractional part of this
Duration
, in nanoseconds. This method does not return the length of the duration when represented by nanoseconds. The returned number always represents a fractional portion of a second (i.e., it is less than one billion).Examples
use std::time::Duration; let duration = Duration::from_millis(5_010); assert_eq!(duration.as_secs(), 5); assert_eq!(duration.subsec_nanos(), 10_000_000);
Arguments
- _self :
Duration
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
Instant
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
Function | Summary |
---|---|
add(_self, other) | # Panics This function may panic if the resulting point in time cannot be represented by the unde |
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
duration_since(_self, earlier) | Returns the amount of time elapsed from another instant to this one, or zero duration if that inst |
elapsed(_self) | Returns the amount of time elapsed since this instant. # Panics Previous Rust versions panicked w |
eq(_self, other) | No Documentation 🚧 |
now() | Returns an instant corresponding to "now". # Examples ``` use std::time::Instant; let now = Instant::now(); ` |
saturating_duration_since(_self, earlier) | Returns the amount of time elapsed from another instant to this one, or zero duration if that inst |
sub(_self, other) | No Documentation 🚧 |
sub-1(arg0, arg1) | No Documentation 🚧 |
add
Panics
This function may panic if the resulting point in time cannot be represented by the underlying data structure. See [
Instant::checked_add
] for a version without panic.
Arguments
- _self :
Instant
- No Documentation 🚧 - other :
Duration
- No Documentation 🚧
Returns
- arg0 :
Instant
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
Instant
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Instant
- No Documentation 🚧
Returns
- arg0 :
Instant
- No Documentation 🚧
duration_since
Returns the amount of time elapsed from another instant to this one, or zero duration if that instant is later than this one.
Panics
Previous Rust versions panicked when
earlier
was later thanself
. Currently this method saturates. Future versions may reintroduce the panic in some circumstances. See [Monotonicity]. [Monotonicity]: Instant#monotonicityExamples
use std::time::{Duration, Instant}; use std::thread::sleep; let now = Instant::now(); sleep(Duration::new(1, 0)); let new_now = Instant::now(); println!("{:?}", new_now.duration_since(now)); println!("{:?}", now.duration_since(new_now)); // 0ns
Arguments
- _self :
Instant
- No Documentation 🚧 - earlier :
Instant
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
elapsed
Returns the amount of time elapsed since this instant.
Panics
Previous Rust versions panicked when the current time was earlier than self. Currently this method returns a Duration of zero in that case. Future versions may reintroduce the panic. See [Monotonicity]. [Monotonicity]: Instant#monotonicity
Examples
use std::thread::sleep; use std::time::{Duration, Instant}; let instant = Instant::now(); let three_secs = Duration::from_secs(3); sleep(three_secs); assert!(instant.elapsed() >= three_secs);
Arguments
- _self :
Instant
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Instant
- No Documentation 🚧 - other :
Instant
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
now
Returns an instant corresponding to "now".
Examples
use std::time::Instant; let now = Instant::now();
Arguments
Returns
- arg0 :
Instant
- No Documentation 🚧
saturating_duration_since
Returns the amount of time elapsed from another instant to this one, or zero duration if that instant is later than this one.
Examples
use std::time::{Duration, Instant}; use std::thread::sleep; let now = Instant::now(); sleep(Duration::new(1, 0)); let new_now = Instant::now(); println!("{:?}", new_now.saturating_duration_since(now)); println!("{:?}", now.saturating_duration_since(new_now)); // 0ns
Arguments
- _self :
Instant
- No Documentation 🚧 - earlier :
Instant
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
Instant
- No Documentation 🚧 - other :
Duration
- No Documentation 🚧
Returns
- arg0 :
Instant
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
Instant
- No Documentation 🚧 - arg1 :
Instant
- No Documentation 🚧
Returns
- arg0 :
Duration
- No Documentation 🚧
HashMap<GamepadAxisAxisSettings, >
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
HashMap<GamepadButtonButtonAxisSettings, >
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
HashMap<GamepadButtonButtonSettings, >
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
HashMap<GamepadInputf32, >
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
HashSet
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
bool
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
char
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
TypeId
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
RangeFull
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
RangeFull
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
RangeFull
- No Documentation 🚧
Returns
- arg0 :
RangeFull
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
RangeFull
- No Documentation 🚧 - other :
RangeFull
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
Option<[u8; 6]>
None
Some
- [u8; 6]
Description
No Documentation 🚧
Functions
Option
None
Some
- alloc::borrow::Cow
Description
No Documentation 🚧
Functions
Option
None
Some
- String
Description
No Documentation 🚧
Functions
Option
None
Some
- bevy_input::touch::ForceTouch
Description
No Documentation 🚧
Functions
Option<Val>
None
Some
- bevy_mod_scripting_core::bindings::function::from::Val<bevy_ecs::entity::Entity>
Description
No Documentation 🚧
Functions
Option
None
Some
- ReflectReference
Description
No Documentation 🚧
Functions
Option
None
Some
- bevy_utils::Instant
Description
No Documentation 🚧
Functions
Option
None
Some
- char
Description
No Documentation 🚧
Functions
Option
None
Some
- f32
Description
No Documentation 🚧
Functions
Option
None
Some
- f64
Description
No Documentation 🚧
Functions
Option
None
Some
- u16
Description
No Documentation 🚧
Functions
Option
None
Some
- usize
Description
No Documentation 🚧
Functions
AtomicBool
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
self
by value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicBool; let some_bool = AtomicBool::new(true); assert_eq!(some_bool.into_inner(), true);
Arguments
- _self :
AtomicBool
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
new
Creates a new
AtomicBool
.Examples
use std::sync::atomic::AtomicBool; let atomic_true = AtomicBool::new(true); let atomic_false = AtomicBool::new(false);
Arguments
- v :
bool
- No Documentation 🚧
Returns
- arg0 :
AtomicBool
- No Documentation 🚧
AtomicI16
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
self
by value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicI16; let some_var = AtomicI16::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
- _self :
AtomicI16
- No Documentation 🚧
Returns
- arg0 :
i16
- No Documentation 🚧
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicI16; let atomic_forty_two = AtomicI16::new(42);
Arguments
- v :
i16
- No Documentation 🚧
Returns
- arg0 :
AtomicI16
- No Documentation 🚧
AtomicI32
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
self
by value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicI32; let some_var = AtomicI32::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
- _self :
AtomicI32
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicI32; let atomic_forty_two = AtomicI32::new(42);
Arguments
- v :
i32
- No Documentation 🚧
Returns
- arg0 :
AtomicI32
- No Documentation 🚧
AtomicI64
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
self
by value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicI64; let some_var = AtomicI64::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
- _self :
AtomicI64
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicI64; let atomic_forty_two = AtomicI64::new(42);
Arguments
- v :
i64
- No Documentation 🚧
Returns
- arg0 :
AtomicI64
- No Documentation 🚧
AtomicI8
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
self
by value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicI8; let some_var = AtomicI8::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
- _self :
AtomicI8
- No Documentation 🚧
Returns
- arg0 :
i8
- No Documentation 🚧
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicI8; let atomic_forty_two = AtomicI8::new(42);
Arguments
- v :
i8
- No Documentation 🚧
Returns
- arg0 :
AtomicI8
- No Documentation 🚧
AtomicIsize
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
self
by value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicIsize; let some_var = AtomicIsize::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
- _self :
AtomicIsize
- No Documentation 🚧
Returns
- arg0 :
isize
- No Documentation 🚧
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicIsize; let atomic_forty_two = AtomicIsize::new(42);
Arguments
- v :
isize
- No Documentation 🚧
Returns
- arg0 :
AtomicIsize
- No Documentation 🚧
AtomicU16
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
self
by value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicU16; let some_var = AtomicU16::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
- _self :
AtomicU16
- No Documentation 🚧
Returns
- arg0 :
u16
- No Documentation 🚧
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicU16; let atomic_forty_two = AtomicU16::new(42);
Arguments
- v :
u16
- No Documentation 🚧
Returns
- arg0 :
AtomicU16
- No Documentation 🚧
AtomicU32
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
self
by value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicU32; let some_var = AtomicU32::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
- _self :
AtomicU32
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicU32; let atomic_forty_two = AtomicU32::new(42);
Arguments
- v :
u32
- No Documentation 🚧
Returns
- arg0 :
AtomicU32
- No Documentation 🚧
AtomicU64
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
self
by value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicU64; let some_var = AtomicU64::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
- _self :
AtomicU64
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicU64; let atomic_forty_two = AtomicU64::new(42);
Arguments
- v :
u64
- No Documentation 🚧
Returns
- arg0 :
AtomicU64
- No Documentation 🚧
AtomicU8
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
self
by value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicU8; let some_var = AtomicU8::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
- _self :
AtomicU8
- No Documentation 🚧
Returns
- arg0 :
u8
- No Documentation 🚧
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicU8; let atomic_forty_two = AtomicU8::new(42);
Arguments
- v :
u8
- No Documentation 🚧
Returns
- arg0 :
AtomicU8
- No Documentation 🚧
AtomicUsize
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
self
by value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicUsize; let some_var = AtomicUsize::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
- _self :
AtomicUsize
- No Documentation 🚧
Returns
- arg0 :
usize
- No Documentation 🚧
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicUsize; let atomic_forty_two = AtomicUsize::new(42);
Arguments
- v :
usize
- No Documentation 🚧
Returns
- arg0 :
AtomicUsize
- No Documentation 🚧
f32
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
f64
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
Affine2
Affine2
- matrix2 : glam::Mat2
- translation : glam::Vec2
Description
No Documentation 🚧
Functions
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two 3x4 matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
Affine2
- No Documentation 🚧 - rhs :
Affine2
- No Documentation 🚧 - max_abs_diff :
f32
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Affine2
- No Documentation 🚧
Returns
- arg0 :
Affine2
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Affine2
- No Documentation 🚧 - rhs :
Affine2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_angle
Creates an affine transform from the given rotation
angle
.
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Affine2
- No Documentation 🚧
from_angle_translation
Creates an affine transform from the given 2D rotation
angle
(in radians) andtranslation
. Equivalent toAffine2::from_translation(translation) * Affine2::from_angle(angle)
Arguments
- angle :
f32
- No Documentation 🚧 - translation :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Affine2
- No Documentation 🚧
from_cols
Creates an affine transform from three column vectors.
Arguments
- x_axis :
Vec2
- No Documentation 🚧 - y_axis :
Vec2
- No Documentation 🚧 - z_axis :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Affine2
- No Documentation 🚧
from_mat2
Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation)
Arguments
- matrix2 :
Mat2
- No Documentation 🚧
Returns
- arg0 :
Affine2
- No Documentation 🚧
from_mat2_translation
Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) and a translation vector. Equivalent to
Affine2::from_translation(translation) * Affine2::from_mat2(mat2)
Arguments
- matrix2 :
Mat2
- No Documentation 🚧 - translation :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Affine2
- No Documentation 🚧
from_mat3
The given
Mat3
must be an affine transform,
Arguments
- m :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Affine2
- No Documentation 🚧
from_mat3a
The given [
Mat3A
] must be an affine transform,
Arguments
- m :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
Affine2
- No Documentation 🚧
from_scale
Creates an affine transform that changes scale. Note that if any scale is zero the transform will be non-invertible.
Arguments
- scale :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Affine2
- No Documentation 🚧
from_scale_angle_translation
Creates an affine transform from the given 2D
scale
, rotationangle
(in radians) andtranslation
. Equivalent toAffine2::from_translation(translation) * Affine2::from_angle(angle) * Affine2::from_scale(scale)
Arguments
- scale :
Vec2
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧 - translation :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Affine2
- No Documentation 🚧
from_translation
Creates an affine transformation from the given 2D
translation
.
Arguments
- translation :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Affine2
- No Documentation 🚧
inverse
Return the inverse of this transform. Note that if the transform is not invertible the result will be invalid.
Arguments
- _self :
Affine2
- No Documentation 🚧
Returns
- arg0 :
Affine2
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
Affine2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
Affine2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Affine2
- No Documentation 🚧 - rhs :
Affine2
- No Documentation 🚧
Returns
- arg0 :
Affine2
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
Affine2
- No Documentation 🚧 - arg1 :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
Affine2
- No Documentation 🚧 - arg1 :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
to_cols_array
Creates a
[f32; 6]
array storing data in column major order.
Arguments
- _self :
Affine2
- No Documentation 🚧
Returns
- arg0 :
[f32; 6]
- No Documentation 🚧
to_cols_array_2d
Creates a
[[f32; 2]; 3]
2D array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
Affine2
- No Documentation 🚧
Returns
- arg0 :
[[f32; 2]; 3]
- No Documentation 🚧
transform_point2
Transforms the given 2D point, applying shear, scale, rotation and translation.
Arguments
- _self :
Affine2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
transform_vector2
Transforms the given 2D vector, applying shear, scale and rotation (but NOT translation). To also apply translation, use [
Self::transform_point2()
] instead.
Arguments
- _self :
Affine2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
Affine3A
Affine3A
- matrix3 : glam::Mat3A
- translation : glam::Vec3A
Description
No Documentation 🚧
Functions
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two 3x4 matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
Affine3A
- No Documentation 🚧 - rhs :
Affine3A
- No Documentation 🚧 - max_abs_diff :
f32
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Affine3A
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Affine3A
- No Documentation 🚧 - rhs :
Affine3A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_axis_angle
Creates an affine transform containing a 3D rotation around a normalized rotation
axis
ofangle
(in radians).
Arguments
- axis :
Vec3
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
from_cols
Creates an affine transform from three column vectors.
Arguments
- x_axis :
Vec3A
- No Documentation 🚧 - y_axis :
Vec3A
- No Documentation 🚧 - z_axis :
Vec3A
- No Documentation 🚧 - w_axis :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
from_mat3
Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation)
Arguments
- mat3 :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
from_mat3_translation
Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) and a translation vector. Equivalent to
Affine3A::from_translation(translation) * Affine3A::from_mat3(mat3)
Arguments
- mat3 :
Mat3
- No Documentation 🚧 - translation :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
from_mat4
The given
Mat4
must be an affine transform, i.e. contain no perspective transform.
Arguments
- m :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
from_quat
Creates an affine transform from the given
rotation
quaternion.
Arguments
- rotation :
Quat
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
from_rotation_translation
Creates an affine transform from the given 3D
rotation
andtranslation
. Equivalent toAffine3A::from_translation(translation) * Affine3A::from_quat(rotation)
Arguments
- rotation :
Quat
- No Documentation 🚧 - translation :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
from_rotation_x
Creates an affine transform containing a 3D rotation around the x axis of
angle
(in radians).
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
from_rotation_y
Creates an affine transform containing a 3D rotation around the y axis of
angle
(in radians).
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
from_rotation_z
Creates an affine transform containing a 3D rotation around the z axis of
angle
(in radians).
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
from_scale
Creates an affine transform that changes scale. Note that if any scale is zero the transform will be non-invertible.
Arguments
- scale :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
from_scale_rotation_translation
Creates an affine transform from the given 3D
scale
,rotation
andtranslation
. Equivalent toAffine3A::from_translation(translation) * Affine3A::from_quat(rotation) * Affine3A::from_scale(scale)
Arguments
- scale :
Vec3
- No Documentation 🚧 - rotation :
Quat
- No Documentation 🚧 - translation :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
from_translation
Creates an affine transformation from the given 3D
translation
.
Arguments
- translation :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
inverse
Return the inverse of this transform. Note that if the transform is not invertible the result will be invalid.
Arguments
- _self :
Affine3A
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
Affine3A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
Affine3A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
look_at_lh
Creates a left-handed view transform using a camera position, an up direction, and a focal point. For a view coordinate system with
+X=right
,+Y=up
and+Z=forward
.Panics
Will panic if
up
is not normalized whenglam_assert
is enabled.
Arguments
- eye :
Vec3
- No Documentation 🚧 - center :
Vec3
- No Documentation 🚧 - up :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
look_at_rh
Creates a right-handed view transform using a camera position, an up direction, and a focal point. For a view coordinate system with
+X=right
,+Y=up
and+Z=back
.Panics
Will panic if
up
is not normalized whenglam_assert
is enabled.
Arguments
- eye :
Vec3
- No Documentation 🚧 - center :
Vec3
- No Documentation 🚧 - up :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
look_to_lh
Creates a left-handed view transform using a camera position, an up direction, and a facing direction. For a view coordinate system with
+X=right
,+Y=up
and+Z=forward
.
Arguments
- eye :
Vec3
- No Documentation 🚧 - dir :
Vec3
- No Documentation 🚧 - up :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
look_to_rh
Creates a right-handed view transform using a camera position, an up direction, and a facing direction. For a view coordinate system with
+X=right
,+Y=up
and+Z=back
.
Arguments
- eye :
Vec3
- No Documentation 🚧 - dir :
Vec3
- No Documentation 🚧 - up :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Affine3A
- No Documentation 🚧 - rhs :
Affine3A
- No Documentation 🚧
Returns
- arg0 :
Affine3A
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
Affine3A
- No Documentation 🚧 - arg1 :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
to_cols_array
Creates a
[f32; 12]
array storing data in column major order.
Arguments
- _self :
Affine3A
- No Documentation 🚧
Returns
- arg0 :
[f32; 12]
- No Documentation 🚧
to_cols_array_2d
Creates a
[[f32; 3]; 4]
3D array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
Affine3A
- No Documentation 🚧
Returns
- arg0 :
[[f32; 3]; 4]
- No Documentation 🚧
transform_point3
Transforms the given 3D points, applying shear, scale, rotation and translation.
Arguments
- _self :
Affine3A
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
transform_point3a
Transforms the given [
Vec3A
], applying shear, scale, rotation and translation.
Arguments
- _self :
Affine3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
transform_vector3
Transforms the given 3D vector, applying shear, scale and rotation (but NOT translation). To also apply translation, use [
Self::transform_point3()
] instead.
Arguments
- _self :
Affine3A
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
transform_vector3a
Transforms the given [
Vec3A
], applying shear, scale and rotation (but NOT translation). To also apply translation, use [Self::transform_point3a()
] instead.
Arguments
- _self :
Affine3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
BVec2
BVec2
- x : bool
- y : bool
Description
No Documentation 🚧
Functions
Function | Summary |
---|---|
all(_self) | Returns true if all the elements are true, false otherwise. |
any(_self) | Returns true if any of the elements are true, false otherwise. |
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
bitmask(_self) | Returns a bitmask with the lowest 2 bits set from the elements of `self`. A true element results i |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
from_array(a) | Creates a new vector mask from a bool array. |
new(x, y) | Creates a new vector mask. |
set(_self, index, value) | Sets the element at `index`. Panics if `index` is greater than 1. |
splat(v) | Creates a vector mask with all elements set to `v`. |
test(_self, index) | Tests the value at `index`. Panics if `index` is greater than 1. |
all
Returns true if all the elements are true, false otherwise.
Arguments
- _self :
BVec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
any
Returns true if any of the elements are true, false otherwise.
Arguments
- _self :
BVec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
BVec2
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
bitmask
Returns a bitmask with the lowest 2 bits set from the elements of
self
. A true element results in a1
bit and a false element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
BVec2
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
BVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
BVec2
- No Documentation 🚧 - other :
BVec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_array
Creates a new vector mask from a bool array.
Arguments
- a :
[bool; 2]
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
new
Creates a new vector mask.
Arguments
- x :
bool
- No Documentation 🚧 - y :
bool
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
set
Sets the element at
index
. Panics ifindex
is greater than 1.
Arguments
- _self :
BVec2
- No Documentation 🚧 - index :
usize
- No Documentation 🚧 - value :
bool
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
splat
Creates a vector mask with all elements set to
v
.
Arguments
- v :
bool
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
test
Tests the value at
index
. Panics ifindex
is greater than 1.
Arguments
- _self :
BVec2
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
BVec3
BVec3
- x : bool
- y : bool
- z : bool
Description
No Documentation 🚧
Functions
Function | Summary |
---|---|
all(_self) | Returns true if all the elements are true, false otherwise. |
any(_self) | Returns true if any of the elements are true, false otherwise. |
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
bitmask(_self) | Returns a bitmask with the lowest 3 bits set from the elements of `self`. A true element results i |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
from_array(a) | Creates a new vector mask from a bool array. |
new(x, y, z) | Creates a new vector mask. |
set(_self, index, value) | Sets the element at `index`. Panics if `index` is greater than 2. |
splat(v) | Creates a vector mask with all elements set to `v`. |
test(_self, index) | Tests the value at `index`. Panics if `index` is greater than 2. |
all
Returns true if all the elements are true, false otherwise.
Arguments
- _self :
BVec3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
any
Returns true if any of the elements are true, false otherwise.
Arguments
- _self :
BVec3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
BVec3
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
bitmask
Returns a bitmask with the lowest 3 bits set from the elements of
self
. A true element results in a1
bit and a false element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
BVec3
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
BVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
BVec3
- No Documentation 🚧 - other :
BVec3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_array
Creates a new vector mask from a bool array.
Arguments
- a :
[bool; 3]
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
new
Creates a new vector mask.
Arguments
- x :
bool
- No Documentation 🚧 - y :
bool
- No Documentation 🚧 - z :
bool
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
set
Sets the element at
index
. Panics ifindex
is greater than 2.
Arguments
- _self :
BVec3
- No Documentation 🚧 - index :
usize
- No Documentation 🚧 - value :
bool
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
splat
Creates a vector mask with all elements set to
v
.
Arguments
- v :
bool
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
test
Tests the value at
index
. Panics ifindex
is greater than 2.
Arguments
- _self :
BVec3
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
BVec3A
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
Function | Summary |
---|---|
all(_self) | Returns true if all the elements are true, false otherwise. |
any(_self) | Returns true if any of the elements are true, false otherwise. |
bitmask(_self) | Returns a bitmask with the lowest 3 bits set from the elements of `self`. A true element results i |
clone(_self) | No Documentation 🚧 |
eq(_self, rhs) | No Documentation 🚧 |
from_array(a) | Creates a new vector mask from a bool array. |
new(x, y, z) | Creates a new vector mask. |
set(_self, index, value) | Sets the element at `index`. Panics if `index` is greater than 2. |
splat(v) | Creates a vector mask with all elements set to `v`. |
test(_self, index) | Tests the value at `index`. Panics if `index` is greater than 2. |
all
Returns true if all the elements are true, false otherwise.
Arguments
- _self :
BVec3A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
any
Returns true if any of the elements are true, false otherwise.
Arguments
- _self :
BVec3A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
bitmask
Returns a bitmask with the lowest 3 bits set from the elements of
self
. A true element results in a1
bit and a false element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
BVec3A
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
BVec3A
- No Documentation 🚧
Returns
- arg0 :
BVec3A
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
BVec3A
- No Documentation 🚧 - rhs :
BVec3A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_array
Creates a new vector mask from a bool array.
Arguments
- a :
[bool; 3]
- No Documentation 🚧
Returns
- arg0 :
BVec3A
- No Documentation 🚧
new
Creates a new vector mask.
Arguments
- x :
bool
- No Documentation 🚧 - y :
bool
- No Documentation 🚧 - z :
bool
- No Documentation 🚧
Returns
- arg0 :
BVec3A
- No Documentation 🚧
set
Sets the element at
index
. Panics ifindex
is greater than 2.
Arguments
- _self :
BVec3A
- No Documentation 🚧 - index :
usize
- No Documentation 🚧 - value :
bool
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
splat
Creates a vector mask with all elements set to
v
.
Arguments
- v :
bool
- No Documentation 🚧
Returns
- arg0 :
BVec3A
- No Documentation 🚧
test
Tests the value at
index
. Panics ifindex
is greater than 2.
Arguments
- _self :
BVec3A
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
BVec4
BVec4
- x : bool
- y : bool
- z : bool
- w : bool
Description
No Documentation 🚧
Functions
Function | Summary |
---|---|
all(_self) | Returns true if all the elements are true, false otherwise. |
any(_self) | Returns true if any of the elements are true, false otherwise. |
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
bitmask(_self) | Returns a bitmask with the lowest 4 bits set from the elements of `self`. A true element results i |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
from_array(a) | Creates a new vector mask from a bool array. |
new(x, y, z, w) | Creates a new vector mask. |
set(_self, index, value) | Sets the element at `index`. Panics if `index` is greater than 3. |
splat(v) | Creates a vector mask with all elements set to `v`. |
test(_self, index) | Tests the value at `index`. Panics if `index` is greater than 3. |
all
Returns true if all the elements are true, false otherwise.
Arguments
- _self :
BVec4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
any
Returns true if any of the elements are true, false otherwise.
Arguments
- _self :
BVec4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
BVec4
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
bitmask
Returns a bitmask with the lowest 4 bits set from the elements of
self
. A true element results in a1
bit and a false element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
BVec4
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
BVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
BVec4
- No Documentation 🚧 - other :
BVec4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_array
Creates a new vector mask from a bool array.
Arguments
- a :
[bool; 4]
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
new
Creates a new vector mask.
Arguments
- x :
bool
- No Documentation 🚧 - y :
bool
- No Documentation 🚧 - z :
bool
- No Documentation 🚧 - w :
bool
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
set
Sets the element at
index
. Panics ifindex
is greater than 3.
Arguments
- _self :
BVec4
- No Documentation 🚧 - index :
usize
- No Documentation 🚧 - value :
bool
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
splat
Creates a vector mask with all elements set to
v
.
Arguments
- v :
bool
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
test
Tests the value at
index
. Panics ifindex
is greater than 3.
Arguments
- _self :
BVec4
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
BVec4A
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
Function | Summary |
---|---|
all(_self) | Returns true if all the elements are true, false otherwise. |
any(_self) | Returns true if any of the elements are true, false otherwise. |
bitmask(_self) | Returns a bitmask with the lowest 4 bits set from the elements of `self`. A true element results i |
clone(_self) | No Documentation 🚧 |
eq(_self, rhs) | No Documentation 🚧 |
from_array(a) | Creates a new vector mask from a bool array. |
new(x, y, z, w) | Creates a new vector mask. |
set(_self, index, value) | Sets the element at `index`. Panics if `index` is greater than 3. |
splat(v) | Creates a vector mask with all elements set to `v`. |
test(_self, index) | Tests the value at `index`. Panics if `index` is greater than 3. |
all
Returns true if all the elements are true, false otherwise.
Arguments
- _self :
BVec4A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
any
Returns true if any of the elements are true, false otherwise.
Arguments
- _self :
BVec4A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
bitmask
Returns a bitmask with the lowest 4 bits set from the elements of
self
. A true element results in a1
bit and a false element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
BVec4A
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
BVec4A
- No Documentation 🚧
Returns
- arg0 :
BVec4A
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
BVec4A
- No Documentation 🚧 - rhs :
BVec4A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_array
Creates a new vector mask from a bool array.
Arguments
- a :
[bool; 4]
- No Documentation 🚧
Returns
- arg0 :
BVec4A
- No Documentation 🚧
new
Creates a new vector mask.
Arguments
- x :
bool
- No Documentation 🚧 - y :
bool
- No Documentation 🚧 - z :
bool
- No Documentation 🚧 - w :
bool
- No Documentation 🚧
Returns
- arg0 :
BVec4A
- No Documentation 🚧
set
Sets the element at
index
. Panics ifindex
is greater than 3.
Arguments
- _self :
BVec4A
- No Documentation 🚧 - index :
usize
- No Documentation 🚧 - value :
bool
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
splat
Creates a vector mask with all elements set to
v
.
Arguments
- v :
bool
- No Documentation 🚧
Returns
- arg0 :
BVec4A
- No Documentation 🚧
test
Tests the value at
index
. Panics ifindex
is greater than 3.
Arguments
- _self :
BVec4A
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
DAffine2
DAffine2
- matrix2 : glam::DMat2
- translation : glam::DVec2
Description
No Documentation 🚧
Functions
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two 3x4 matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
DAffine2
- No Documentation 🚧 - rhs :
DAffine2
- No Documentation 🚧 - max_abs_diff :
f64
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
DAffine2
- No Documentation 🚧
Returns
- arg0 :
DAffine2
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
DAffine2
- No Documentation 🚧 - rhs :
DAffine2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_angle
Creates an affine transform from the given rotation
angle
.
Arguments
- angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DAffine2
- No Documentation 🚧
from_angle_translation
Creates an affine transform from the given 2D rotation
angle
(in radians) andtranslation
. Equivalent toDAffine2::from_translation(translation) * DAffine2::from_angle(angle)
Arguments
- angle :
f64
- No Documentation 🚧 - translation :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DAffine2
- No Documentation 🚧
from_cols
Creates an affine transform from three column vectors.
Arguments
- x_axis :
DVec2
- No Documentation 🚧 - y_axis :
DVec2
- No Documentation 🚧 - z_axis :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DAffine2
- No Documentation 🚧
from_mat2
Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation)
Arguments
- matrix2 :
DMat2
- No Documentation 🚧
Returns
- arg0 :
DAffine2
- No Documentation 🚧
from_mat2_translation
Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) and a translation vector. Equivalent to
DAffine2::from_translation(translation) * DAffine2::from_mat2(mat2)
Arguments
- matrix2 :
DMat2
- No Documentation 🚧 - translation :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DAffine2
- No Documentation 🚧
from_mat3
The given
DMat3
must be an affine transform,
Arguments
- m :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DAffine2
- No Documentation 🚧
from_scale
Creates an affine transform that changes scale. Note that if any scale is zero the transform will be non-invertible.
Arguments
- scale :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DAffine2
- No Documentation 🚧
from_scale_angle_translation
Creates an affine transform from the given 2D
scale
, rotationangle
(in radians) andtranslation
. Equivalent toDAffine2::from_translation(translation) * DAffine2::from_angle(angle) * DAffine2::from_scale(scale)
Arguments
- scale :
DVec2
- No Documentation 🚧 - angle :
f64
- No Documentation 🚧 - translation :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DAffine2
- No Documentation 🚧
from_translation
Creates an affine transformation from the given 2D
translation
.
Arguments
- translation :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DAffine2
- No Documentation 🚧
inverse
Return the inverse of this transform. Note that if the transform is not invertible the result will be invalid.
Arguments
- _self :
DAffine2
- No Documentation 🚧
Returns
- arg0 :
DAffine2
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
DAffine2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
DAffine2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
DAffine2
- No Documentation 🚧 - rhs :
DAffine2
- No Documentation 🚧
Returns
- arg0 :
DAffine2
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
DAffine2
- No Documentation 🚧 - arg1 :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
to_cols_array
Creates a
[f64; 6]
array storing data in column major order.
Arguments
- _self :
DAffine2
- No Documentation 🚧
Returns
- arg0 :
[f64; 6]
- No Documentation 🚧
to_cols_array_2d
Creates a
[[f64; 2]; 3]
2D array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
DAffine2
- No Documentation 🚧
Returns
- arg0 :
[[f64; 2]; 3]
- No Documentation 🚧
transform_point2
Transforms the given 2D point, applying shear, scale, rotation and translation.
Arguments
- _self :
DAffine2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
transform_vector2
Transforms the given 2D vector, applying shear, scale and rotation (but NOT translation). To also apply translation, use [
Self::transform_point2()
] instead.
Arguments
- _self :
DAffine2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
DAffine3
DAffine3
- matrix3 : glam::DMat3
- translation : glam::DVec3
Description
No Documentation 🚧
Functions
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two 3x4 matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
DAffine3
- No Documentation 🚧 - rhs :
DAffine3
- No Documentation 🚧 - max_abs_diff :
f64
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
DAffine3
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
DAffine3
- No Documentation 🚧 - rhs :
DAffine3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_axis_angle
Creates an affine transform containing a 3D rotation around a normalized rotation
axis
ofangle
(in radians).
Arguments
- axis :
DVec3
- No Documentation 🚧 - angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
from_cols
Creates an affine transform from three column vectors.
Arguments
- x_axis :
DVec3
- No Documentation 🚧 - y_axis :
DVec3
- No Documentation 🚧 - z_axis :
DVec3
- No Documentation 🚧 - w_axis :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
from_mat3
Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation)
Arguments
- mat3 :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
from_mat3_translation
Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) and a translation vector. Equivalent to
DAffine3::from_translation(translation) * DAffine3::from_mat3(mat3)
Arguments
- mat3 :
DMat3
- No Documentation 🚧 - translation :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
from_mat4
The given
DMat4
must be an affine transform, i.e. contain no perspective transform.
Arguments
- m :
DMat4
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
from_quat
Creates an affine transform from the given
rotation
quaternion.
Arguments
- rotation :
DQuat
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
from_rotation_translation
Creates an affine transform from the given 3D
rotation
andtranslation
. Equivalent toDAffine3::from_translation(translation) * DAffine3::from_quat(rotation)
Arguments
- rotation :
DQuat
- No Documentation 🚧 - translation :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
from_rotation_x
Creates an affine transform containing a 3D rotation around the x axis of
angle
(in radians).
Arguments
- angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
from_rotation_y
Creates an affine transform containing a 3D rotation around the y axis of
angle
(in radians).
Arguments
- angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
from_rotation_z
Creates an affine transform containing a 3D rotation around the z axis of
angle
(in radians).
Arguments
- angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
from_scale
Creates an affine transform that changes scale. Note that if any scale is zero the transform will be non-invertible.
Arguments
- scale :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
from_scale_rotation_translation
Creates an affine transform from the given 3D
scale
,rotation
andtranslation
. Equivalent toDAffine3::from_translation(translation) * DAffine3::from_quat(rotation) * DAffine3::from_scale(scale)
Arguments
- scale :
DVec3
- No Documentation 🚧 - rotation :
DQuat
- No Documentation 🚧 - translation :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
from_translation
Creates an affine transformation from the given 3D
translation
.
Arguments
- translation :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
inverse
Return the inverse of this transform. Note that if the transform is not invertible the result will be invalid.
Arguments
- _self :
DAffine3
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
DAffine3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
DAffine3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
look_at_lh
Creates a left-handed view transform using a camera position, an up direction, and a focal point. For a view coordinate system with
+X=right
,+Y=up
and+Z=forward
.Panics
Will panic if
up
is not normalized whenglam_assert
is enabled.
Arguments
- eye :
DVec3
- No Documentation 🚧 - center :
DVec3
- No Documentation 🚧 - up :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
look_at_rh
Creates a right-handed view transform using a camera position, an up direction, and a focal point. For a view coordinate system with
+X=right
,+Y=up
and+Z=back
.Panics
Will panic if
up
is not normalized whenglam_assert
is enabled.
Arguments
- eye :
DVec3
- No Documentation 🚧 - center :
DVec3
- No Documentation 🚧 - up :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
look_to_lh
Creates a left-handed view transform using a camera position, an up direction, and a facing direction. For a view coordinate system with
+X=right
,+Y=up
and+Z=forward
.
Arguments
- eye :
DVec3
- No Documentation 🚧 - dir :
DVec3
- No Documentation 🚧 - up :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
look_to_rh
Creates a right-handed view transform using a camera position, an up direction, and a facing direction. For a view coordinate system with
+X=right
,+Y=up
and+Z=back
.
Arguments
- eye :
DVec3
- No Documentation 🚧 - dir :
DVec3
- No Documentation 🚧 - up :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
DAffine3
- No Documentation 🚧 - rhs :
DAffine3
- No Documentation 🚧
Returns
- arg0 :
DAffine3
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
DAffine3
- No Documentation 🚧 - arg1 :
DMat4
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
to_cols_array
Creates a
[f64; 12]
array storing data in column major order.
Arguments
- _self :
DAffine3
- No Documentation 🚧
Returns
- arg0 :
[f64; 12]
- No Documentation 🚧
to_cols_array_2d
Creates a
[[f64; 3]; 4]
3D array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
DAffine3
- No Documentation 🚧
Returns
- arg0 :
[[f64; 3]; 4]
- No Documentation 🚧
transform_point3
Transforms the given 3D points, applying shear, scale, rotation and translation.
Arguments
- _self :
DAffine3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
transform_vector3
Transforms the given 3D vector, applying shear, scale and rotation (but NOT translation). To also apply translation, use [
Self::transform_point3()
] instead.
Arguments
- _self :
DAffine3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
DMat2
DMat2
- x_axis : glam::DVec2
- y_axis : glam::DVec2
Description
No Documentation 🚧
Functions
abs
Takes the absolute value of each element in
self
Arguments
- _self :
DMat2
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
DMat2
- No Documentation 🚧 - rhs :
DMat2
- No Documentation 🚧 - max_abs_diff :
f64
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
DMat2
- No Documentation 🚧 - rhs :
DMat2
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
add_mat2
Adds two 2x2 matrices.
Arguments
- _self :
DMat2
- No Documentation 🚧 - rhs :
DMat2
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
as_mat2
No Documentation 🚧
Arguments
- _self :
DMat2
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
DMat2
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
col
Returns the matrix column for the given
index
.Panics
Panics if
index
is greater than 1.
Arguments
- _self :
DMat2
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
determinant
Returns the determinant of
self
.
Arguments
- _self :
DMat2
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
DMat2
- No Documentation 🚧 - rhs :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
div_scalar
Divides a 2x2 matrix by a scalar.
Arguments
- _self :
DMat2
- No Documentation 🚧 - rhs :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
DMat2
- No Documentation 🚧 - rhs :
DMat2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_angle
Creates a 2x2 matrix containing a rotation of
angle
(in radians).
Arguments
- angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
from_cols
Creates a 2x2 matrix from two column vectors.
Arguments
- x_axis :
DVec2
- No Documentation 🚧 - y_axis :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
from_diagonal
Creates a 2x2 matrix with its diagonal set to
diagonal
and all other entries set to 0.
Arguments
- diagonal :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
from_mat3
Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column.
Arguments
- m :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
from_mat3_minor
Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the
i
th column andj
th row.Panics
Panics if
i
orj
is greater than 2.
Arguments
- m :
DMat3
- No Documentation 🚧 - i :
usize
- No Documentation 🚧 - j :
usize
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
from_scale_angle
Creates a 2x2 matrix containing the combining non-uniform
scale
and rotation ofangle
(in radians).
Arguments
- scale :
DVec2
- No Documentation 🚧 - angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
inverse
Returns the inverse of
self
. If the matrix is not invertible the returned matrix will be invalid.Panics
Will panic if the determinant of
self
is zero whenglam_assert
is enabled.
Arguments
- _self :
DMat2
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
DMat2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
DMat2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
DMat2
- No Documentation 🚧 - rhs :
DMat2
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
DMat2
- No Documentation 🚧 - arg1 :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
DMat2
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
mul_mat2
Multiplies two 2x2 matrices.
Arguments
- _self :
DMat2
- No Documentation 🚧 - rhs :
DMat2
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
mul_scalar
Multiplies a 2x2 matrix by a scalar.
Arguments
- _self :
DMat2
- No Documentation 🚧 - rhs :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
mul_vec2
Transforms a 2D vector.
Arguments
- _self :
DMat2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
DMat2
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
row
Returns the matrix row for the given
index
.Panics
Panics if
index
is greater than 1.
Arguments
- _self :
DMat2
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
DMat2
- No Documentation 🚧 - rhs :
DMat2
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
sub_mat2
Subtracts two 2x2 matrices.
Arguments
- _self :
DMat2
- No Documentation 🚧 - rhs :
DMat2
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
to_cols_array
Creates a
[f64; 4]
array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
DMat2
- No Documentation 🚧
Returns
- arg0 :
[f64; 4]
- No Documentation 🚧
to_cols_array_2d
Creates a
[[f64; 2]; 2]
2D array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
DMat2
- No Documentation 🚧
Returns
- arg0 :
[[f64; 2]; 2]
- No Documentation 🚧
transpose
Returns the transpose of
self
.
Arguments
- _self :
DMat2
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
DMat3
DMat3
- x_axis : glam::DVec3
- y_axis : glam::DVec3
- z_axis : glam::DVec3
Description
No Documentation 🚧
Functions
abs
Takes the absolute value of each element in
self
Arguments
- _self :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
DMat3
- No Documentation 🚧 - rhs :
DMat3
- No Documentation 🚧 - max_abs_diff :
f64
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
DMat3
- No Documentation 🚧 - rhs :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
add_mat3
Adds two 3x3 matrices.
Arguments
- _self :
DMat3
- No Documentation 🚧 - rhs :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
as_mat3
No Documentation 🚧
Arguments
- _self :
DMat3
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
col
Returns the matrix column for the given
index
.Panics
Panics if
index
is greater than 2.
Arguments
- _self :
DMat3
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
determinant
Returns the determinant of
self
.
Arguments
- _self :
DMat3
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
DMat3
- No Documentation 🚧 - rhs :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
div_scalar
Divides a 3x3 matrix by a scalar.
Arguments
- _self :
DMat3
- No Documentation 🚧 - rhs :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
DMat3
- No Documentation 🚧 - rhs :
DMat3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_angle
Creates an affine transformation matrix from the given 2D rotation
angle
(in radians). The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()
] and [Self::transform_vector2()
].
Arguments
- angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
from_axis_angle
Creates a 3D rotation matrix from a normalized rotation
axis
andangle
(in radians).Panics
Will panic if
axis
is not normalized whenglam_assert
is enabled.
Arguments
- axis :
DVec3
- No Documentation 🚧 - angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
from_cols
Creates a 3x3 matrix from three column vectors.
Arguments
- x_axis :
DVec3
- No Documentation 🚧 - y_axis :
DVec3
- No Documentation 🚧 - z_axis :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
from_diagonal
Creates a 3x3 matrix with its diagonal set to
diagonal
and all other entries set to 0.
Arguments
- diagonal :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
from_euler
Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in radians).
Arguments
- order :
EulerRot
- No Documentation 🚧 - a :
f64
- No Documentation 🚧 - b :
f64
- No Documentation 🚧 - c :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
from_mat2
Creates an affine transformation matrix from the given 2x2 matrix. The resulting matrix can be used to transform 2D points and vectors. See [
Self::transform_point2()
] and [Self::transform_vector2()
].
Arguments
- m :
DMat2
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
from_mat4
Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column.
Arguments
- m :
DMat4
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
from_mat4_minor
Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the
i
th column andj
th row.Panics
Panics if
i
orj
is greater than 3.
Arguments
- m :
DMat4
- No Documentation 🚧 - i :
usize
- No Documentation 🚧 - j :
usize
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
from_quat
Creates a 3D rotation matrix from the given quaternion.
Panics
Will panic if
rotation
is not normalized whenglam_assert
is enabled.
Arguments
- rotation :
DQuat
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
from_rotation_x
Creates a 3D rotation matrix from
angle
(in radians) around the x axis.
Arguments
- angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
from_rotation_y
Creates a 3D rotation matrix from
angle
(in radians) around the y axis.
Arguments
- angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
from_rotation_z
Creates a 3D rotation matrix from
angle
(in radians) around the z axis.
Arguments
- angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
from_scale
Creates an affine transformation matrix from the given non-uniform 2D
scale
. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()
] and [Self::transform_vector2()
].Panics
Will panic if all elements of
scale
are zero whenglam_assert
is enabled.
Arguments
- scale :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
from_scale_angle_translation
Creates an affine transformation matrix from the given 2D
scale
, rotationangle
(in radians) andtranslation
. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()
] and [Self::transform_vector2()
].
Arguments
- scale :
DVec2
- No Documentation 🚧 - angle :
f64
- No Documentation 🚧 - translation :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
from_translation
Creates an affine transformation matrix from the given 2D
translation
. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()
] and [Self::transform_vector2()
].
Arguments
- translation :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
inverse
Returns the inverse of
self
. If the matrix is not invertible the returned matrix will be invalid.Panics
Will panic if the determinant of
self
is zero whenglam_assert
is enabled.
Arguments
- _self :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
DMat3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
DMat3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
DMat3
- No Documentation 🚧 - rhs :
DAffine2
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
DMat3
- No Documentation 🚧 - arg1 :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
DMat3
- No Documentation 🚧 - arg1 :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
mul-3
No Documentation 🚧
Arguments
- arg0 :
DMat3
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
mul_mat3
Multiplies two 3x3 matrices.
Arguments
- _self :
DMat3
- No Documentation 🚧 - rhs :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
mul_scalar
Multiplies a 3x3 matrix by a scalar.
Arguments
- _self :
DMat3
- No Documentation 🚧 - rhs :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
mul_vec3
Transforms a 3D vector.
Arguments
- _self :
DMat3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
row
Returns the matrix row for the given
index
.Panics
Panics if
index
is greater than 2.
Arguments
- _self :
DMat3
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
DMat3
- No Documentation 🚧 - rhs :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
sub_mat3
Subtracts two 3x3 matrices.
Arguments
- _self :
DMat3
- No Documentation 🚧 - rhs :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
to_cols_array
Creates a
[f64; 9]
array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
DMat3
- No Documentation 🚧
Returns
- arg0 :
[f64; 9]
- No Documentation 🚧
to_cols_array_2d
Creates a
[[f64; 3]; 3]
3D array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
DMat3
- No Documentation 🚧
Returns
- arg0 :
[[f64; 3]; 3]
- No Documentation 🚧
to_euler
Extract Euler angles with the given Euler rotation order. Note if the input matrix contains scales, shears, or other non-rotation transformations then the resulting Euler angles will be ill-defined.
Panics
Will panic if any input matrix column is not normalized when
glam_assert
is enabled.
Arguments
- _self :
DMat3
- No Documentation 🚧 - order :
EulerRot
- No Documentation 🚧
Returns
- arg0 :
(f64, f64, f64)
- No Documentation 🚧
transform_point2
Transforms the given 2D vector as a point. This is the equivalent of multiplying
rhs
as a 3D vector wherez
is1
. This method assumes thatself
contains a valid affine transform.Panics
Will panic if the 2nd row of
self
is not(0, 0, 1)
whenglam_assert
is enabled.
Arguments
- _self :
DMat3
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
transform_vector2
Rotates the given 2D vector. This is the equivalent of multiplying
rhs
as a 3D vector wherez
is0
. This method assumes thatself
contains a valid affine transform.Panics
Will panic if the 2nd row of
self
is not(0, 0, 1)
whenglam_assert
is enabled.
Arguments
- _self :
DMat3
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
transpose
Returns the transpose of
self
.
Arguments
- _self :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
DMat4
DMat4
- x_axis : glam::DVec4
- y_axis : glam::DVec4
- z_axis : glam::DVec4
- w_axis : glam::DVec4
Description
No Documentation 🚧
Functions
abs
Takes the absolute value of each element in
self
Arguments
- _self :
DMat4
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
DMat4
- No Documentation 🚧 - rhs :
DMat4
- No Documentation 🚧 - max_abs_diff :
f64
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
DMat4
- No Documentation 🚧 - rhs :
DMat4
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
add_mat4
Adds two 4x4 matrices.
Arguments
- _self :
DMat4
- No Documentation 🚧 - rhs :
DMat4
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
as_mat4
No Documentation 🚧
Arguments
- _self :
DMat4
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
DMat4
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
col
Returns the matrix column for the given
index
.Panics
Panics if
index
is greater than 3.
Arguments
- _self :
DMat4
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
determinant
Returns the determinant of
self
.
Arguments
- _self :
DMat4
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
DMat4
- No Documentation 🚧 - rhs :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
div_scalar
Divides a 4x4 matrix by a scalar.
Arguments
- _self :
DMat4
- No Documentation 🚧 - rhs :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
DMat4
- No Documentation 🚧 - rhs :
DMat4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_axis_angle
Creates an affine transformation matrix containing a 3D rotation around a normalized rotation
axis
ofangle
(in radians). The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].Panics
Will panic if
axis
is not normalized whenglam_assert
is enabled.
Arguments
- axis :
DVec3
- No Documentation 🚧 - angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
from_cols
Creates a 4x4 matrix from four column vectors.
Arguments
- x_axis :
DVec4
- No Documentation 🚧 - y_axis :
DVec4
- No Documentation 🚧 - z_axis :
DVec4
- No Documentation 🚧 - w_axis :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
from_diagonal
Creates a 4x4 matrix with its diagonal set to
diagonal
and all other entries set to 0.
Arguments
- diagonal :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
from_euler
Creates a affine transformation matrix containing a rotation from the given euler rotation sequence and angles (in radians). The resulting matrix can be used to transform 3D points and vectors. See [
Self::transform_point3()
] and [Self::transform_vector3()
].
Arguments
- order :
EulerRot
- No Documentation 🚧 - a :
f64
- No Documentation 🚧 - b :
f64
- No Documentation 🚧 - c :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
from_mat3
Creates an affine transformation matrix from the given 3x3 linear transformation matrix. The resulting matrix can be used to transform 3D points and vectors. See [
Self::transform_point3()
] and [Self::transform_vector3()
].
Arguments
- m :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
from_quat
Creates an affine transformation matrix from the given
rotation
quaternion. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].Panics
Will panic if
rotation
is not normalized whenglam_assert
is enabled.
Arguments
- rotation :
DQuat
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
from_rotation_translation
Creates an affine transformation matrix from the given 3D
translation
. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].Panics
Will panic if
rotation
is not normalized whenglam_assert
is enabled.
Arguments
- rotation :
DQuat
- No Documentation 🚧 - translation :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
from_rotation_x
Creates an affine transformation matrix containing a 3D rotation around the x axis of
angle
(in radians). The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].
Arguments
- angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
from_rotation_y
Creates an affine transformation matrix containing a 3D rotation around the y axis of
angle
(in radians). The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].
Arguments
- angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
from_rotation_z
Creates an affine transformation matrix containing a 3D rotation around the z axis of
angle
(in radians). The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].
Arguments
- angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
from_scale
Creates an affine transformation matrix containing the given 3D non-uniform
scale
. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].Panics
Will panic if all elements of
scale
are zero whenglam_assert
is enabled.
Arguments
- scale :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
from_scale_rotation_translation
Creates an affine transformation matrix from the given 3D
scale
,rotation
andtranslation
. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].Panics
Will panic if
rotation
is not normalized whenglam_assert
is enabled.
Arguments
- scale :
DVec3
- No Documentation 🚧 - rotation :
DQuat
- No Documentation 🚧 - translation :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
from_translation
Creates an affine transformation matrix from the given 3D
translation
. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].
Arguments
- translation :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
inverse
Returns the inverse of
self
. If the matrix is not invertible the returned matrix will be invalid.Panics
Will panic if the determinant of
self
is zero whenglam_assert
is enabled.
Arguments
- _self :
DMat4
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
DMat4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
DMat4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
look_at_lh
Creates a left-handed view matrix using a camera position, an up direction, and a focal point. For a view coordinate system with
+X=right
,+Y=up
and+Z=forward
.Panics
Will panic if
up
is not normalized whenglam_assert
is enabled.
Arguments
- eye :
DVec3
- No Documentation 🚧 - center :
DVec3
- No Documentation 🚧 - up :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
look_at_rh
Creates a right-handed view matrix using a camera position, an up direction, and a focal point. For a view coordinate system with
+X=right
,+Y=up
and+Z=back
.Panics
Will panic if
up
is not normalized whenglam_assert
is enabled.
Arguments
- eye :
DVec3
- No Documentation 🚧 - center :
DVec3
- No Documentation 🚧 - up :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
look_to_lh
Creates a left-handed view matrix using a camera position, an up direction, and a facing direction. For a view coordinate system with
+X=right
,+Y=up
and+Z=forward
.
Arguments
- eye :
DVec3
- No Documentation 🚧 - dir :
DVec3
- No Documentation 🚧 - up :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
look_to_rh
Creates a right-handed view matrix using a camera position, an up direction, and a facing direction. For a view coordinate system with
+X=right
,+Y=up
and+Z=back
.
Arguments
- eye :
DVec3
- No Documentation 🚧 - dir :
DVec3
- No Documentation 🚧 - up :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
DMat4
- No Documentation 🚧 - rhs :
DAffine3
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
DMat4
- No Documentation 🚧 - arg1 :
DMat4
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
DMat4
- No Documentation 🚧 - arg1 :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
mul-3
No Documentation 🚧
Arguments
- arg0 :
DMat4
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
mul_mat4
Multiplies two 4x4 matrices.
Arguments
- _self :
DMat4
- No Documentation 🚧 - rhs :
DMat4
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
mul_scalar
Multiplies a 4x4 matrix by a scalar.
Arguments
- _self :
DMat4
- No Documentation 🚧 - rhs :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
mul_vec4
Transforms a 4D vector.
Arguments
- _self :
DMat4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
DMat4
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
orthographic_lh
Creates a left-handed orthographic projection matrix with
[0,1]
depth range. Useful to map a left-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect.
Arguments
- left :
f64
- No Documentation 🚧 - right :
f64
- No Documentation 🚧 - bottom :
f64
- No Documentation 🚧 - top :
f64
- No Documentation 🚧 - near :
f64
- No Documentation 🚧 - far :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
orthographic_rh
Creates a right-handed orthographic projection matrix with
[0,1]
depth range. Useful to map a right-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect.
Arguments
- left :
f64
- No Documentation 🚧 - right :
f64
- No Documentation 🚧 - bottom :
f64
- No Documentation 🚧 - top :
f64
- No Documentation 🚧 - near :
f64
- No Documentation 🚧 - far :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
orthographic_rh_gl
Creates a right-handed orthographic projection matrix with
[-1,1]
depth range. This is the same as the OpenGLglOrtho
function in OpenGL. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glOrtho.xml Useful to map a right-handed coordinate system to the normalized device coordinates that OpenGL expects.
Arguments
- left :
f64
- No Documentation 🚧 - right :
f64
- No Documentation 🚧 - bottom :
f64
- No Documentation 🚧 - top :
f64
- No Documentation 🚧 - near :
f64
- No Documentation 🚧 - far :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
perspective_infinite_lh
Creates an infinite left-handed perspective projection matrix with
[0,1]
depth range. Likeperspective_lh
, but with an infinite value forz_far
. The result is that points nearz_near
are mapped to depth0
, and as they move towards infinity the depth approaches1
.Panics
Will panic if
z_near
orz_far
are less than or equal to zero whenglam_assert
is enabled.
Arguments
- fov_y_radians :
f64
- No Documentation 🚧 - aspect_ratio :
f64
- No Documentation 🚧 - z_near :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
perspective_infinite_reverse_lh
Creates an infinite reverse left-handed perspective projection matrix with
[0,1]
depth range. Similar toperspective_infinite_lh
, but mapsZ = z_near
to a depth of1
andZ = infinity
to a depth of0
.Panics
Will panic if
z_near
is less than or equal to zero whenglam_assert
is enabled.
Arguments
- fov_y_radians :
f64
- No Documentation 🚧 - aspect_ratio :
f64
- No Documentation 🚧 - z_near :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
perspective_infinite_reverse_rh
Creates an infinite reverse right-handed perspective projection matrix with
[0,1]
depth range. Similar toperspective_infinite_rh
, but mapsZ = z_near
to a depth of1
andZ = infinity
to a depth of0
.Panics
Will panic if
z_near
is less than or equal to zero whenglam_assert
is enabled.
Arguments
- fov_y_radians :
f64
- No Documentation 🚧 - aspect_ratio :
f64
- No Documentation 🚧 - z_near :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
perspective_infinite_rh
Creates an infinite right-handed perspective projection matrix with
[0,1]
depth range. Likeperspective_rh
, but with an infinite value forz_far
. The result is that points nearz_near
are mapped to depth0
, and as they move towards infinity the depth approaches1
.Panics
Will panic if
z_near
orz_far
are less than or equal to zero whenglam_assert
is enabled.
Arguments
- fov_y_radians :
f64
- No Documentation 🚧 - aspect_ratio :
f64
- No Documentation 🚧 - z_near :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
perspective_lh
Creates a left-handed perspective projection matrix with
[0,1]
depth range. Useful to map the standard left-handed coordinate system into what WebGPU/Metal/Direct3D expect.Panics
Will panic if
z_near
orz_far
are less than or equal to zero whenglam_assert
is enabled.
Arguments
- fov_y_radians :
f64
- No Documentation 🚧 - aspect_ratio :
f64
- No Documentation 🚧 - z_near :
f64
- No Documentation 🚧 - z_far :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
perspective_rh
Creates a right-handed perspective projection matrix with
[0,1]
depth range. Useful to map the standard right-handed coordinate system into what WebGPU/Metal/Direct3D expect.Panics
Will panic if
z_near
orz_far
are less than or equal to zero whenglam_assert
is enabled.
Arguments
- fov_y_radians :
f64
- No Documentation 🚧 - aspect_ratio :
f64
- No Documentation 🚧 - z_near :
f64
- No Documentation 🚧 - z_far :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
perspective_rh_gl
Creates a right-handed perspective projection matrix with
[-1,1]
depth range. Useful to map the standard right-handed coordinate system into what OpenGL expects. This is the same as the OpenGLgluPerspective
function. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluPerspective.xml
Arguments
- fov_y_radians :
f64
- No Documentation 🚧 - aspect_ratio :
f64
- No Documentation 🚧 - z_near :
f64
- No Documentation 🚧 - z_far :
f64
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
project_point3
Transforms the given 3D vector as a point, applying perspective correction. This is the equivalent of multiplying the 3D vector as a 4D vector where
w
is1.0
. The perspective divide is performed meaning the resulting 3D vector is divided byw
. This method assumes thatself
contains a projective transform.
Arguments
- _self :
DMat4
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
row
Returns the matrix row for the given
index
.Panics
Panics if
index
is greater than 3.
Arguments
- _self :
DMat4
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
DMat4
- No Documentation 🚧 - rhs :
DMat4
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
sub_mat4
Subtracts two 4x4 matrices.
Arguments
- _self :
DMat4
- No Documentation 🚧 - rhs :
DMat4
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
to_cols_array
Creates a
[f64; 16]
array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
DMat4
- No Documentation 🚧
Returns
- arg0 :
[f64; 16]
- No Documentation 🚧
to_cols_array_2d
Creates a
[[f64; 4]; 4]
4D array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
DMat4
- No Documentation 🚧
Returns
- arg0 :
[[f64; 4]; 4]
- No Documentation 🚧
to_euler
Extract Euler angles with the given Euler rotation order. Note if the upper 3x3 matrix contain scales, shears, or other non-rotation transformations then the resulting Euler angles will be ill-defined.
Panics
Will panic if any column of the upper 3x3 rotation matrix is not normalized when
glam_assert
is enabled.
Arguments
- _self :
DMat4
- No Documentation 🚧 - order :
EulerRot
- No Documentation 🚧
Returns
- arg0 :
(f64, f64, f64)
- No Documentation 🚧
transform_point3
Transforms the given 3D vector as a point. This is the equivalent of multiplying the 3D vector as a 4D vector where
w
is1.0
. This method assumes thatself
contains a valid affine transform. It does not perform a perspective divide, ifself
contains a perspective transform, or if you are unsure, the [Self::project_point3()
] method should be used instead.Panics
Will panic if the 3rd row of
self
is not(0, 0, 0, 1)
whenglam_assert
is enabled.
Arguments
- _self :
DMat4
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
transform_vector3
Transforms the give 3D vector as a direction. This is the equivalent of multiplying the 3D vector as a 4D vector where
w
is0.0
. This method assumes thatself
contains a valid affine transform.Panics
Will panic if the 3rd row of
self
is not(0, 0, 0, 1)
whenglam_assert
is enabled.
Arguments
- _self :
DMat4
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
transpose
Returns the transpose of
self
.
Arguments
- _self :
DMat4
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
DQuat
DQuat
- x : f64
- y : f64
- z : f64
- w : f64
Description
No Documentation 🚧
Functions
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two quaternions contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
DQuat
- No Documentation 🚧 - rhs :
DQuat
- No Documentation 🚧 - max_abs_diff :
f64
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
add
Adds two quaternions. The sum is not guaranteed to be normalized. Note that addition is not the same as combining the rotations represented by the two quaternions! That corresponds to multiplication.
Arguments
- _self :
DQuat
- No Documentation 🚧 - rhs :
DQuat
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
angle_between
Returns the angle (in radians) for the minimal rotation for transforming this quaternion into another. Both quaternions must be normalized.
Panics
Will panic if
self
orrhs
are not normalized whenglam_assert
is enabled.
Arguments
- _self :
DQuat
- No Documentation 🚧 - rhs :
DQuat
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
as_quat
No Documentation 🚧
Arguments
- _self :
DQuat
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
DQuat
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
conjugate
Returns the quaternion conjugate of
self
. For a unit quaternion the conjugate is also the inverse.
Arguments
- _self :
DQuat
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
div
Divides a quaternion by a scalar value. The quotient is not guaranteed to be normalized.
Arguments
- _self :
DQuat
- No Documentation 🚧 - rhs :
f64
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
. The dot product is equal to the cosine of the angle between two quaternion rotations.
Arguments
- _self :
DQuat
- No Documentation 🚧 - rhs :
DQuat
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
DQuat
- No Documentation 🚧 - rhs :
DQuat
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_affine3
Creates a quaternion from a 3x3 rotation matrix inside a 3D affine transform. Note if the input affine matrix contain scales, shears, or other non-rotation transformations then the resulting quaternion will be ill-defined.
Panics
Will panic if any input affine matrix column is not normalized when
glam_assert
is enabled.
Arguments
- a :
DAffine3
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
from_array
Creates a rotation quaternion from an array.
Preconditions
This function does not check if the input is normalized, it is up to the user to provide normalized input or to normalized the resulting quaternion.
Arguments
- a :
[f64; 4]
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
from_axis_angle
Create a quaternion for a normalized rotation
axis
andangle
(in radians). The axis must be a unit vector.Panics
Will panic if
axis
is not normalized whenglam_assert
is enabled.
Arguments
- axis :
DVec3
- No Documentation 🚧 - angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
from_euler
Creates a quaternion from the given Euler rotation sequence and the angles (in radians).
Arguments
- euler :
EulerRot
- No Documentation 🚧 - a :
f64
- No Documentation 🚧 - b :
f64
- No Documentation 🚧 - c :
f64
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
from_mat3
Creates a quaternion from a 3x3 rotation matrix. Note if the input matrix contain scales, shears, or other non-rotation transformations then the resulting quaternion will be ill-defined.
Panics
Will panic if any input matrix column is not normalized when
glam_assert
is enabled.
Arguments
- mat :
DMat3
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
from_mat4
Creates a quaternion from the upper 3x3 rotation matrix inside a homogeneous 4x4 matrix. Note if the upper 3x3 matrix contain scales, shears, or other non-rotation transformations then the resulting quaternion will be ill-defined.
Panics
Will panic if any column of the upper 3x3 rotation matrix is not normalized when
glam_assert
is enabled.
Arguments
- mat :
DMat4
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
from_rotation_arc
Gets the minimal rotation for transforming
from
toto
. The rotation is in the plane spanned by the two vectors. Will rotate at most 180 degrees. The inputs must be unit vectors.from_rotation_arc(from, to) * from ≈ to
. For near-singular cases (from≈to and from≈-to) the current implementation is only accurate to about 0.001 (forf32
).Panics
Will panic if
from
orto
are not normalized whenglam_assert
is enabled.
Arguments
- from :
DVec3
- No Documentation 🚧 - to :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
from_rotation_arc_2d
Gets the minimal rotation for transforming
from
toto
. The resulting rotation is around the z axis. Will rotate at most 180 degrees. The inputs must be unit vectors.from_rotation_arc_2d(from, to) * from ≈ to
. For near-singular cases (from≈to and from≈-to) the current implementation is only accurate to about 0.001 (forf32
).Panics
Will panic if
from
orto
are not normalized whenglam_assert
is enabled.
Arguments
- from :
DVec2
- No Documentation 🚧 - to :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
from_rotation_arc_colinear
Gets the minimal rotation for transforming
from
to eitherto
or-to
. This means that the resulting quaternion will rotatefrom
so that it is colinear withto
. The rotation is in the plane spanned by the two vectors. Will rotate at most 90 degrees. The inputs must be unit vectors.to.dot(from_rotation_arc_colinear(from, to) * from).abs() ≈ 1
.Panics
Will panic if
from
orto
are not normalized whenglam_assert
is enabled.
Arguments
- from :
DVec3
- No Documentation 🚧 - to :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
from_rotation_x
Creates a quaternion from the
angle
(in radians) around the x axis.
Arguments
- angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
from_rotation_y
Creates a quaternion from the
angle
(in radians) around the y axis.
Arguments
- angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
from_rotation_z
Creates a quaternion from the
angle
(in radians) around the z axis.
Arguments
- angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
from_scaled_axis
Create a quaternion that rotates
v.length()
radians aroundv.normalize()
.from_scaled_axis(Vec3::ZERO)
results in the identity quaternion.
Arguments
- v :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
from_vec4
Creates a new rotation quaternion from a 4D vector.
Preconditions
This function does not check if the input is normalized, it is up to the user to provide normalized input or to normalized the resulting quaternion.
Arguments
- v :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
from_xyzw
Creates a new rotation quaternion. This should generally not be called manually unless you know what you are doing. Use one of the other constructors instead such as
identity
orfrom_axis_angle
.from_xyzw
is mostly used by unit tests andserde
deserialization.Preconditions
This function does not check if the input is normalized, it is up to the user to provide normalized input or to normalized the resulting quaternion.
Arguments
- x :
f64
- No Documentation 🚧 - y :
f64
- No Documentation 🚧 - z :
f64
- No Documentation 🚧 - w :
f64
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
inverse
Returns the inverse of a normalized quaternion. Typically quaternion inverse returns the conjugate of a normalized quaternion. Because
self
is assumed to already be unit length this method does not normalize before returning the conjugate.Panics
Will panic if
self
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
DQuat
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
DQuat
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan
Returns
true
if any elements areNAN
.
Arguments
- _self :
DQuat
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_near_identity
No Documentation 🚧
Arguments
- _self :
DQuat
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_normalized
Returns whether
self
of length1.0
or not. Uses a precision threshold of1e-6
.
Arguments
- _self :
DQuat
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
length
Computes the length of
self
.
Arguments
- _self :
DQuat
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
- _self :
DQuat
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
length_squared
Computes the squared length of
self
. This is generally faster thanlength()
as it avoids a square root operation.
Arguments
- _self :
DQuat
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
lerp
Performs a linear interpolation between
self
andrhs
based on the values
. Whens
is0.0
, the result will be equal toself
. Whens
is1.0
, the result will be equal torhs
.Panics
Will panic if
self
orend
are not normalized whenglam_assert
is enabled.
Arguments
- _self :
DQuat
- No Documentation 🚧 - end :
DQuat
- No Documentation 🚧 - s :
f64
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
mul
Multiplies two quaternions. If they each represent a rotation, the result will represent the combined rotation. Note that due to floating point rounding the result may not be perfectly normalized.
Panics
Will panic if
self
orrhs
are not normalized whenglam_assert
is enabled.
Arguments
- _self :
DQuat
- No Documentation 🚧 - rhs :
DQuat
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
DQuat
- No Documentation 🚧 - arg1 :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
DQuat
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
mul_quat
Multiplies two quaternions. If they each represent a rotation, the result will represent the combined rotation. Note that due to floating point rounding the result may not be perfectly normalized.
Panics
Will panic if
self
orrhs
are not normalized whenglam_assert
is enabled.
Arguments
- _self :
DQuat
- No Documentation 🚧 - rhs :
DQuat
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
mul_vec3
Multiplies a quaternion and a 3D vector, returning the rotated vector.
Panics
Will panic if
self
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
DQuat
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
DQuat
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
normalize
Returns
self
normalized to length 1.0. For valid results,self
must not be of length zero. Panics Will panic ifself
is zero length whenglam_assert
is enabled.
Arguments
- _self :
DQuat
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
rotate_towards
Rotates towards
rhs
up tomax_angle
(in radians). Whenmax_angle
is0.0
, the result will be equal toself
. Whenmax_angle
is equal toself.angle_between(rhs)
, the result will be equal torhs
. Ifmax_angle
is negative, rotates towards the exact opposite ofrhs
. Will not go past the target. Both quaternions must be normalized.Panics
Will panic if
self
orrhs
are not normalized whenglam_assert
is enabled.
Arguments
- _self :
DQuat
- No Documentation 🚧 - rhs :
DQuat
- No Documentation 🚧 - max_angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
slerp
Performs a spherical linear interpolation between
self
andend
based on the values
. Whens
is0.0
, the result will be equal toself
. Whens
is1.0
, the result will be equal toend
.Panics
Will panic if
self
orend
are not normalized whenglam_assert
is enabled.
Arguments
- _self :
DQuat
- No Documentation 🚧 - end :
DQuat
- No Documentation 🚧 - s :
f64
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
sub
Subtracts the
rhs
quaternion fromself
. The difference is not guaranteed to be normalized.
Arguments
- _self :
DQuat
- No Documentation 🚧 - rhs :
DQuat
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
to_array
[x, y, z, w]
Arguments
- _self :
DQuat
- No Documentation 🚧
Returns
- arg0 :
[f64; 4]
- No Documentation 🚧
to_euler
Returns the rotation angles for the given euler rotation sequence.
Arguments
- _self :
DQuat
- No Documentation 🚧 - order :
EulerRot
- No Documentation 🚧
Returns
- arg0 :
(f64, f64, f64)
- No Documentation 🚧
to_scaled_axis
Returns the rotation axis scaled by the rotation in radians.
Arguments
- _self :
DQuat
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
xyz
Returns the vector part of the quaternion.
Arguments
- _self :
DQuat
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
DVec2
DVec2
- x : f64
- y : f64
Description
No Documentation 🚧
Functions
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two vectors contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧 - max_abs_diff :
f64
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
DVec2
- No Documentation 🚧 - arg1 :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
DVec2
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
angle_between
No Documentation 🚧
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
angle_to
Returns the angle of rotation (in radians) from
self
torhs
in the range[-π, +π]
. The inputs do not need to be unit vectors however they must be non-zero.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
as_i64vec2
Casts all elements of
self
toi64
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
as_ivec2
Casts all elements of
self
toi32
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
as_u64vec2
Casts all elements of
self
tou64
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
as_uvec2
Casts all elements of
self
tou32
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
as_vec2
Casts all elements of
self
tof32
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
f64::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
DVec2
- No Documentation 🚧 - min :
DVec2
- No Documentation 🚧 - max :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
clamp_length
Returns a vector with a length no less than
min
and no more thanmax
.Panics
Will panic if
min
is greater thanmax
, or if eithermin
ormax
is negative, whenglam_assert
is enabled.
Arguments
- _self :
DVec2
- No Documentation 🚧 - min :
f64
- No Documentation 🚧 - max :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
clamp_length_max
Returns a vector with a length no more than
max
.Panics
Will panic if
max
is negative whenglam_assert
is enabled.
Arguments
- _self :
DVec2
- No Documentation 🚧 - max :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
clamp_length_min
Returns a vector with a length no less than
min
.Panics
Will panic if
min
is negative whenglam_assert
is enabled.
Arguments
- _self :
DVec2
- No Documentation 🚧 - min :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
copysign
Returns a vector with signs of
rhs
and the magnitudes ofself
.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
distance
Computes the Euclidean distance between two points in space.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
DVec2
- No Documentation 🚧 - arg1 :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
DVec2
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
DVec2
- No Documentation 🚧 - other :
DVec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
exp
Returns a vector containing
e^self
(the exponential function) for each element ofself
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
extend
Creates a 3D vector from
self
and the givenz
value.
Arguments
- _self :
DVec2
- No Documentation 🚧 - z :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
fract
Returns a vector containing the fractional part of the vector as
self - self.trunc()
. Note that this differs from the GLSL implementation offract
which returnsself - self.floor()
. Note that this is fast but not precise for large numbers.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
fract_gl
Returns a vector containing the fractional part of the vector as
self - self.floor()
. Note that this differs from the Rust implementation offract
which returnsself - self.trunc()
. Note that this is fast but not precise for large numbers.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
from_angle
Creates a 2D vector containing
[angle.cos(), angle.sin()]
. This can be used in conjunction with the [rotate()
][Self::rotate()] method, e.g.DVec2::from_angle(PI).rotate(DVec2::Y)
will create the vector[-1, 0]
and rotate [DVec2::Y
] around it returning-DVec2::Y
.
Arguments
- angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[f64; 2]
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_finite_mask
Performs
is_finite
on each element of self, returning a vector mask of the results. In other words, this computes[x.is_finite(), y.is_finite(), ...]
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan_mask
Performs
is_nan
on each element of self, returning a vector mask of the results. In other words, this computes[x.is_nan(), y.is_nan(), ...]
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
is_negative_bitmask
Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of
self
. A negative element results in a1
bit and a positive element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
is_normalized
Returns whether
self
is length1.0
or not. Uses a precision threshold of approximately1e-4
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
length
Computes the length of
self
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
length_squared
Computes the squared length of
self
. This is faster thanlength()
as it avoids a square root operation.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
lerp
Performs a linear interpolation between
self
andrhs
based on the values
. Whens
is0.0
, the result will be equal toself
. Whens
is1.0
, the result will be equal torhs
. Whens
is outside of range[0, 1]
, the result is linearly extrapolated.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧 - s :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
midpoint
Calculates the midpoint between
self
andrhs
. The midpoint is the average of, or halfway point between, two vectors.a.midpoint(b)
should yield the same result asa.lerp(b, 0.5)
while being slightly cheaper to compute.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
move_towards
Moves towards
rhs
based on the valued
. Whend
is0.0
, the result will be equal toself
. Whend
is equal toself.distance(rhs)
, the result will be equal torhs
. Will not go pastrhs
.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧 - d :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
DVec2
- No Documentation 🚧 - arg1 :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
DVec2
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
mul_add
Fused multiply-add. Computes
(self * a) + b
element-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Usingmul_add
may be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind.
Arguments
- _self :
DVec2
- No Documentation 🚧 - a :
DVec2
- No Documentation 🚧 - b :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
f64
- No Documentation 🚧 - y :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
normalize
Returns
self
normalized to length 1.0. For valid results,self
must be finite and not of length zero, nor very close to zero. See also [Self::try_normalize()
] and [Self::normalize_or_zero()
]. Panics Will panic if the resulting normalized vector is not finite whenglam_assert
is enabled.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
normalize_or
Returns
self
normalized to length 1.0 if possible, else returns a fallback value. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be the fallback value. See also [Self::try_normalize()
].
Arguments
- _self :
DVec2
- No Documentation 🚧 - fallback :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
normalize_or_zero
Returns
self
normalized to length 1.0 if possible, else returns zero. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be zero. See also [Self::try_normalize()
].
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
perp
Returns a vector that is equal to
self
rotated by 90 degrees.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
perp_dot
The perpendicular dot product of
self
andrhs
. Also known as the wedge product, 2D cross product, and determinant.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
powf
Returns a vector containing each element of
self
raised to the power ofn
.
Arguments
- _self :
DVec2
- No Documentation 🚧 - n :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
project_onto
Returns the vector projection of
self
ontorhs
.rhs
must be of non-zero length.Panics
Will panic if
rhs
is zero length whenglam_assert
is enabled.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
project_onto_normalized
Returns the vector projection of
self
ontorhs
.rhs
must be normalized.Panics
Will panic if
rhs
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
recip
Returns a vector containing the reciprocal
1.0/n
of each element ofself
.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
reflect
Returns the reflection vector for a given incident vector
self
and surface normalnormal
.normal
must be normalized.Panics
Will panic if
normal
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
DVec2
- No Documentation 🚧 - normal :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
refract
Returns the refraction direction for a given incident vector
self
, surface normalnormal
and ratio of indices of refraction,eta
. When total internal reflection occurs, a zero vector will be returned.self
andnormal
must be normalized.Panics
Will panic if
self
ornormal
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
DVec2
- No Documentation 🚧 - normal :
DVec2
- No Documentation 🚧 - eta :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
reject_from
Returns the vector rejection of
self
fromrhs
. The vector rejection is the vector perpendicular to the projection ofself
ontorhs
, in rhs words the result ofself - self.project_onto(rhs)
.rhs
must be of non-zero length.Panics
Will panic if
rhs
has a length of zero whenglam_assert
is enabled.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
reject_from_normalized
Returns the vector rejection of
self
fromrhs
. The vector rejection is the vector perpendicular to the projection ofself
ontorhs
, in rhs words the result ofself - self.project_onto(rhs)
.rhs
must be normalized.Panics
Will panic if
rhs
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
DVec2
- No Documentation 🚧 - arg1 :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
DVec2
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
. [Euclidean division]: f64::rem_euclid
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
rotate
Returns
rhs
rotated by the angle ofself
. Ifself
is normalized, then this just rotation. This is what you usually want. Otherwise, it will be like a rotation with a multiplication byself
's length.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
rotate_towards
Rotates towards
rhs
up tomax_angle
(in radians). Whenmax_angle
is0.0
, the result will be equal toself
. Whenmax_angle
is equal toself.angle_between(rhs)
, the result will be equal torhs
. Ifmax_angle
is negative, rotates towards the exact opposite ofrhs
. Will not go past the target.
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧 - max_angle :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
round
Returns a vector containing the nearest integer to a number for each element of
self
. Round half-way cases away from 0.0.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec2
- No Documentation 🚧 - if_true :
DVec2
- No Documentation 🚧 - if_false :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
signum
Returns a vector with elements representing the sign of
self
.
1.0
if the number is positive,+0.0
orINFINITY
-1.0
if the number is negative,-0.0
orNEG_INFINITY
NAN
if the number isNAN
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
DVec2
- No Documentation 🚧 - rhs :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
DVec2
- No Documentation 🚧 - arg1 :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
DVec2
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
to_angle
Returns the angle (in radians) of this vector in the range
[-π, +π]
. The input does not need to be a unit vector however it must be non-zero.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
to_array
[x, y]
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
[f64; 2]
- No Documentation 🚧
trunc
Returns a vector containing the integer part each element of
self
. This means numbers are always truncated towards zero.
Arguments
- _self :
DVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
with_x
Creates a 2D vector from
self
with the given value ofx
.
Arguments
- _self :
DVec2
- No Documentation 🚧 - x :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
with_y
Creates a 2D vector from
self
with the given value ofy
.
Arguments
- _self :
DVec2
- No Documentation 🚧 - y :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
DVec3
DVec3
- x : f64
- y : f64
- z : f64
Description
No Documentation 🚧
Functions
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two vectors contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧 - max_abs_diff :
f64
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
DVec3
- No Documentation 🚧 - arg1 :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
DVec3
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
angle_between
Returns the angle (in radians) between two vectors in the range
[0, +π]
. The inputs do not need to be unit vectors however they must be non-zero.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
any_orthogonal_vector
Returns some vector that is orthogonal to the given one. The input vector must be finite and non-zero. The output vector is not necessarily unit length. For that use [
Self::any_orthonormal_vector()
] instead.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
any_orthonormal_vector
Returns any unit vector that is orthogonal to the given one. The input vector must be unit length.
Panics
Will panic if
self
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
as_i64vec3
Casts all elements of
self
toi64
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
as_ivec3
Casts all elements of
self
toi32
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
as_u64vec3
Casts all elements of
self
tou64
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
as_uvec3
Casts all elements of
self
tou32
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
as_vec3
Casts all elements of
self
tof32
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
as_vec3a
Casts all elements of
self
tof32
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
f64::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
DVec3
- No Documentation 🚧 - min :
DVec3
- No Documentation 🚧 - max :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
clamp_length
Returns a vector with a length no less than
min
and no more thanmax
.Panics
Will panic if
min
is greater thanmax
, or if eithermin
ormax
is negative, whenglam_assert
is enabled.
Arguments
- _self :
DVec3
- No Documentation 🚧 - min :
f64
- No Documentation 🚧 - max :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
clamp_length_max
Returns a vector with a length no more than
max
.Panics
Will panic if
max
is negative whenglam_assert
is enabled.
Arguments
- _self :
DVec3
- No Documentation 🚧 - max :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
clamp_length_min
Returns a vector with a length no less than
min
.Panics
Will panic if
min
is negative whenglam_assert
is enabled.
Arguments
- _self :
DVec3
- No Documentation 🚧 - min :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
copysign
Returns a vector with signs of
rhs
and the magnitudes ofself
.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
cross
Computes the cross product of
self
andrhs
.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
distance
Computes the Euclidean distance between two points in space.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
DVec3
- No Documentation 🚧 - arg1 :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
DVec3
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
DVec3
- No Documentation 🚧 - other :
DVec3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
exp
Returns a vector containing
e^self
(the exponential function) for each element ofself
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
extend
Creates a 4D vector from
self
and the givenw
value.
Arguments
- _self :
DVec3
- No Documentation 🚧 - w :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
fract
Returns a vector containing the fractional part of the vector as
self - self.trunc()
. Note that this differs from the GLSL implementation offract
which returnsself - self.floor()
. Note that this is fast but not precise for large numbers.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
fract_gl
Returns a vector containing the fractional part of the vector as
self - self.floor()
. Note that this differs from the Rust implementation offract
which returnsself - self.trunc()
. Note that this is fast but not precise for large numbers.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[f64; 3]
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_finite_mask
Performs
is_finite
on each element of self, returning a vector mask of the results. In other words, this computes[x.is_finite(), y.is_finite(), ...]
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan_mask
Performs
is_nan
on each element of self, returning a vector mask of the results. In other words, this computes[x.is_nan(), y.is_nan(), ...]
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
is_negative_bitmask
Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of
self
. A negative element results in a1
bit and a positive element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
is_normalized
Returns whether
self
is length1.0
or not. Uses a precision threshold of approximately1e-4
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
length
Computes the length of
self
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
length_squared
Computes the squared length of
self
. This is faster thanlength()
as it avoids a square root operation.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
lerp
Performs a linear interpolation between
self
andrhs
based on the values
. Whens
is0.0
, the result will be equal toself
. Whens
is1.0
, the result will be equal torhs
. Whens
is outside of range[0, 1]
, the result is linearly extrapolated.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧 - s :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
midpoint
Calculates the midpoint between
self
andrhs
. The midpoint is the average of, or halfway point between, two vectors.a.midpoint(b)
should yield the same result asa.lerp(b, 0.5)
while being slightly cheaper to compute.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
move_towards
Moves towards
rhs
based on the valued
. Whend
is0.0
, the result will be equal toself
. Whend
is equal toself.distance(rhs)
, the result will be equal torhs
. Will not go pastrhs
.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧 - d :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
DVec3
- No Documentation 🚧 - arg1 :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
DVec3
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
mul_add
Fused multiply-add. Computes
(self * a) + b
element-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Usingmul_add
may be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind.
Arguments
- _self :
DVec3
- No Documentation 🚧 - a :
DVec3
- No Documentation 🚧 - b :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
f64
- No Documentation 🚧 - y :
f64
- No Documentation 🚧 - z :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
normalize
Returns
self
normalized to length 1.0. For valid results,self
must be finite and not of length zero, nor very close to zero. See also [Self::try_normalize()
] and [Self::normalize_or_zero()
]. Panics Will panic if the resulting normalized vector is not finite whenglam_assert
is enabled.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
normalize_or
Returns
self
normalized to length 1.0 if possible, else returns a fallback value. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be the fallback value. See also [Self::try_normalize()
].
Arguments
- _self :
DVec3
- No Documentation 🚧 - fallback :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
normalize_or_zero
Returns
self
normalized to length 1.0 if possible, else returns zero. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be zero. See also [Self::try_normalize()
].
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
powf
Returns a vector containing each element of
self
raised to the power ofn
.
Arguments
- _self :
DVec3
- No Documentation 🚧 - n :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
project_onto
Returns the vector projection of
self
ontorhs
.rhs
must be of non-zero length.Panics
Will panic if
rhs
is zero length whenglam_assert
is enabled.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
project_onto_normalized
Returns the vector projection of
self
ontorhs
.rhs
must be normalized.Panics
Will panic if
rhs
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
recip
Returns a vector containing the reciprocal
1.0/n
of each element ofself
.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
reflect
Returns the reflection vector for a given incident vector
self
and surface normalnormal
.normal
must be normalized.Panics
Will panic if
normal
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
DVec3
- No Documentation 🚧 - normal :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
refract
Returns the refraction direction for a given incident vector
self
, surface normalnormal
and ratio of indices of refraction,eta
. When total internal reflection occurs, a zero vector will be returned.self
andnormal
must be normalized.Panics
Will panic if
self
ornormal
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
DVec3
- No Documentation 🚧 - normal :
DVec3
- No Documentation 🚧 - eta :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
reject_from
Returns the vector rejection of
self
fromrhs
. The vector rejection is the vector perpendicular to the projection ofself
ontorhs
, in rhs words the result ofself - self.project_onto(rhs)
.rhs
must be of non-zero length.Panics
Will panic if
rhs
has a length of zero whenglam_assert
is enabled.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
reject_from_normalized
Returns the vector rejection of
self
fromrhs
. The vector rejection is the vector perpendicular to the projection ofself
ontorhs
, in rhs words the result ofself - self.project_onto(rhs)
.rhs
must be normalized.Panics
Will panic if
rhs
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
DVec3
- No Documentation 🚧 - arg1 :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
DVec3
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
. [Euclidean division]: f64::rem_euclid
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
round
Returns a vector containing the nearest integer to a number for each element of
self
. Round half-way cases away from 0.0.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec3
- No Documentation 🚧 - if_true :
DVec3
- No Documentation 🚧 - if_false :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
signum
Returns a vector with elements representing the sign of
self
.
1.0
if the number is positive,+0.0
orINFINITY
-1.0
if the number is negative,-0.0
orNEG_INFINITY
NAN
if the number isNAN
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
DVec3
- No Documentation 🚧 - rhs :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
DVec3
- No Documentation 🚧 - arg1 :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
DVec3
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
to_array
[x, y, z]
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
[f64; 3]
- No Documentation 🚧
trunc
Returns a vector containing the integer part each element of
self
. This means numbers are always truncated towards zero.
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
truncate
Creates a 2D vector from the
x
andy
elements ofself
, discardingz
. Truncation may also be performed by using [self.xy()
][crate::swizzles::Vec3Swizzles::xy()].
Arguments
- _self :
DVec3
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
with_x
Creates a 3D vector from
self
with the given value ofx
.
Arguments
- _self :
DVec3
- No Documentation 🚧 - x :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
with_y
Creates a 3D vector from
self
with the given value ofy
.
Arguments
- _self :
DVec3
- No Documentation 🚧 - y :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
with_z
Creates a 3D vector from
self
with the given value ofz
.
Arguments
- _self :
DVec3
- No Documentation 🚧 - z :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
DVec4
DVec4
- x : f64
- y : f64
- z : f64
- w : f64
Description
No Documentation 🚧
Functions
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two vectors contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧 - max_abs_diff :
f64
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
DVec4
- No Documentation 🚧 - arg1 :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
DVec4
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
as_i64vec4
Casts all elements of
self
toi64
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
as_ivec4
Casts all elements of
self
toi32
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
as_u64vec4
Casts all elements of
self
tou64
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
as_uvec4
Casts all elements of
self
tou32
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
as_vec4
Casts all elements of
self
tof32
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
f64::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
DVec4
- No Documentation 🚧 - min :
DVec4
- No Documentation 🚧 - max :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
clamp_length
Returns a vector with a length no less than
min
and no more thanmax
.Panics
Will panic if
min
is greater thanmax
, or if eithermin
ormax
is negative, whenglam_assert
is enabled.
Arguments
- _self :
DVec4
- No Documentation 🚧 - min :
f64
- No Documentation 🚧 - max :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
clamp_length_max
Returns a vector with a length no more than
max
.Panics
Will panic if
max
is negative whenglam_assert
is enabled.
Arguments
- _self :
DVec4
- No Documentation 🚧 - max :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
clamp_length_min
Returns a vector with a length no less than
min
.Panics
Will panic if
min
is negative whenglam_assert
is enabled.
Arguments
- _self :
DVec4
- No Documentation 🚧 - min :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
copysign
Returns a vector with signs of
rhs
and the magnitudes ofself
.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
distance
Computes the Euclidean distance between two points in space.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
DVec4
- No Documentation 🚧 - arg1 :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
DVec4
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
DVec4
- No Documentation 🚧 - other :
DVec4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
exp
Returns a vector containing
e^self
(the exponential function) for each element ofself
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
fract
Returns a vector containing the fractional part of the vector as
self - self.trunc()
. Note that this differs from the GLSL implementation offract
which returnsself - self.floor()
. Note that this is fast but not precise for large numbers.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
fract_gl
Returns a vector containing the fractional part of the vector as
self - self.floor()
. Note that this differs from the Rust implementation offract
which returnsself - self.trunc()
. Note that this is fast but not precise for large numbers.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[f64; 4]
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_finite_mask
Performs
is_finite
on each element of self, returning a vector mask of the results. In other words, this computes[x.is_finite(), y.is_finite(), ...]
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan_mask
Performs
is_nan
on each element of self, returning a vector mask of the results. In other words, this computes[x.is_nan(), y.is_nan(), ...]
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
is_negative_bitmask
Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of
self
. A negative element results in a1
bit and a positive element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
is_normalized
Returns whether
self
is length1.0
or not. Uses a precision threshold of approximately1e-4
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
length
Computes the length of
self
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
length_squared
Computes the squared length of
self
. This is faster thanlength()
as it avoids a square root operation.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
lerp
Performs a linear interpolation between
self
andrhs
based on the values
. Whens
is0.0
, the result will be equal toself
. Whens
is1.0
, the result will be equal torhs
. Whens
is outside of range[0, 1]
, the result is linearly extrapolated.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧 - s :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
midpoint
Calculates the midpoint between
self
andrhs
. The midpoint is the average of, or halfway point between, two vectors.a.midpoint(b)
should yield the same result asa.lerp(b, 0.5)
while being slightly cheaper to compute.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
f64
- No Documentation 🚧
move_towards
Moves towards
rhs
based on the valued
. Whend
is0.0
, the result will be equal toself
. Whend
is equal toself.distance(rhs)
, the result will be equal torhs
. Will not go pastrhs
.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧 - d :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
DVec4
- No Documentation 🚧 - arg1 :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
DVec4
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
mul_add
Fused multiply-add. Computes
(self * a) + b
element-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Usingmul_add
may be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind.
Arguments
- _self :
DVec4
- No Documentation 🚧 - a :
DVec4
- No Documentation 🚧 - b :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
f64
- No Documentation 🚧 - y :
f64
- No Documentation 🚧 - z :
f64
- No Documentation 🚧 - w :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
normalize
Returns
self
normalized to length 1.0. For valid results,self
must be finite and not of length zero, nor very close to zero. See also [Self::try_normalize()
] and [Self::normalize_or_zero()
]. Panics Will panic if the resulting normalized vector is not finite whenglam_assert
is enabled.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
normalize_or
Returns
self
normalized to length 1.0 if possible, else returns a fallback value. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be the fallback value. See also [Self::try_normalize()
].
Arguments
- _self :
DVec4
- No Documentation 🚧 - fallback :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
normalize_or_zero
Returns
self
normalized to length 1.0 if possible, else returns zero. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be zero. See also [Self::try_normalize()
].
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
powf
Returns a vector containing each element of
self
raised to the power ofn
.
Arguments
- _self :
DVec4
- No Documentation 🚧 - n :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
project_onto
Returns the vector projection of
self
ontorhs
.rhs
must be of non-zero length.Panics
Will panic if
rhs
is zero length whenglam_assert
is enabled.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
project_onto_normalized
Returns the vector projection of
self
ontorhs
.rhs
must be normalized.Panics
Will panic if
rhs
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
recip
Returns a vector containing the reciprocal
1.0/n
of each element ofself
.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
reflect
Returns the reflection vector for a given incident vector
self
and surface normalnormal
.normal
must be normalized.Panics
Will panic if
normal
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
DVec4
- No Documentation 🚧 - normal :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
refract
Returns the refraction direction for a given incident vector
self
, surface normalnormal
and ratio of indices of refraction,eta
. When total internal reflection occurs, a zero vector will be returned.self
andnormal
must be normalized.Panics
Will panic if
self
ornormal
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
DVec4
- No Documentation 🚧 - normal :
DVec4
- No Documentation 🚧 - eta :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
reject_from
Returns the vector rejection of
self
fromrhs
. The vector rejection is the vector perpendicular to the projection ofself
ontorhs
, in rhs words the result ofself - self.project_onto(rhs)
.rhs
must be of non-zero length.Panics
Will panic if
rhs
has a length of zero whenglam_assert
is enabled.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
reject_from_normalized
Returns the vector rejection of
self
fromrhs
. The vector rejection is the vector perpendicular to the projection ofself
ontorhs
, in rhs words the result ofself - self.project_onto(rhs)
.rhs
must be normalized.Panics
Will panic if
rhs
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
DVec4
- No Documentation 🚧 - arg1 :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
DVec4
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
. [Euclidean division]: f64::rem_euclid
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
round
Returns a vector containing the nearest integer to a number for each element of
self
. Round half-way cases away from 0.0.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec4
- No Documentation 🚧 - if_true :
DVec4
- No Documentation 🚧 - if_false :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
signum
Returns a vector with elements representing the sign of
self
.
1.0
if the number is positive,+0.0
orINFINITY
-1.0
if the number is negative,-0.0
orNEG_INFINITY
NAN
if the number isNAN
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
DVec4
- No Documentation 🚧 - rhs :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
DVec4
- No Documentation 🚧 - arg1 :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
DVec4
- No Documentation 🚧 - arg1 :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
to_array
[x, y, z, w]
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
[f64; 4]
- No Documentation 🚧
trunc
Returns a vector containing the integer part each element of
self
. This means numbers are always truncated towards zero.
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
truncate
Creates a 3D vector from the
x
,y
andz
elements ofself
, discardingw
. Truncation to [DVec3
] may also be performed by using [self.xyz()
][crate::swizzles::Vec4Swizzles::xyz()].
Arguments
- _self :
DVec4
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
with_w
Creates a 4D vector from
self
with the given value ofw
.
Arguments
- _self :
DVec4
- No Documentation 🚧 - w :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
with_x
Creates a 4D vector from
self
with the given value ofx
.
Arguments
- _self :
DVec4
- No Documentation 🚧 - x :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
with_y
Creates a 4D vector from
self
with the given value ofy
.
Arguments
- _self :
DVec4
- No Documentation 🚧 - y :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
with_z
Creates a 4D vector from
self
with the given value ofz
.
Arguments
- _self :
DVec4
- No Documentation 🚧 - z :
f64
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
EulerRot
ZYX
ZXY
YXZ
YZX
XYZ
XZY
ZYZ
ZXZ
YXY
YZY
XYX
XZX
ZYXEx
ZXYEx
YXZEx
YZXEx
XYZEx
XZYEx
ZYZEx
ZXZEx
YXYEx
YZYEx
XYXEx
XZXEx
Description
No Documentation 🚧
Functions
Function | Summary |
---|---|
assert_receiver_is_total_eq(_self) | No Documentation 🚧 |
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
EulerRot
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
EulerRot
- No Documentation 🚧
Returns
- arg0 :
EulerRot
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
EulerRot
- No Documentation 🚧 - other :
EulerRot
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
I64Vec2
I64Vec2
- x : i64
- y : i64
Description
No Documentation 🚧
Functions
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
I64Vec2
- No Documentation 🚧 - arg1 :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
I64Vec2
- No Documentation 🚧 - arg1 :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
as_dvec2
Casts all elements of
self
tof64
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
as_ivec2
Casts all elements of
self
toi32
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
as_u64vec2
Casts all elements of
self
tou64
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
as_uvec2
Casts all elements of
self
tou32
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
as_vec2
Casts all elements of
self
tof32
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
i64::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - min :
I64Vec2
- No Documentation 🚧 - max :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
I64Vec2
- No Documentation 🚧 - arg1 :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
I64Vec2
- No Documentation 🚧 - arg1 :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.Panics
This function will panic if any
rhs
element is 0 or the division results in overflow.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - other :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
extend
Creates a 3D vector from
self
and the givenz
value.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - z :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[i64; 2]
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
is_negative_bitmask
Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of
self
. A negative element results in a1
bit and a positive element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
length_squared
Computes the squared length of
self
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
I64Vec2
- No Documentation 🚧 - arg1 :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
I64Vec2
- No Documentation 🚧 - arg1 :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
i64
- No Documentation 🚧 - y :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
perp
Returns a vector that is equal to
self
rotated by 90 degrees.
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
perp_dot
The perpendicular dot product of
self
andrhs
. Also known as the wedge product, 2D cross product, and determinant.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
I64Vec2
- No Documentation 🚧 - arg1 :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
I64Vec2
- No Documentation 🚧 - arg1 :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
.Panics
This function will panic if any
rhs
element is 0 or the division results in overflow. [Euclidean division]: i64::rem_euclid
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
rotate
Returns
rhs
rotated by the angle ofself
. Ifself
is normalized, then this just rotation. This is what you usually want. Otherwise, it will be like a rotation with a multiplication byself
's length.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
saturating_add
Returns a vector containing the saturating addition of
self
andrhs
. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
saturating_div
Returns a vector containing the saturating division of
self
andrhs
. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
saturating_mul
Returns a vector containing the saturating multiplication of
self
andrhs
. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
saturating_sub
Returns a vector containing the saturating subtraction of
self
andrhs
. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
self
and unsigned vectorrhs
. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec2
- No Documentation 🚧 - if_true :
I64Vec2
- No Documentation 🚧 - if_false :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
signum
Returns a vector with elements representing the sign of
self
.
0
if the number is zero1
if the number is positive-1
if the number is negative
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
I64Vec2
- No Documentation 🚧 - arg1 :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
I64Vec2
- No Documentation 🚧 - arg1 :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
to_array
[x, y]
Arguments
- _self :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
[i64; 2]
- No Documentation 🚧
with_x
Creates a 2D vector from
self
with the given value ofx
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - x :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
with_y
Creates a 2D vector from
self
with the given value ofy
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - y :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
wrapping_add
Returns a vector containing the wrapping addition of
self
andrhs
. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
self
and unsigned vectorrhs
. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
wrapping_div
Returns a vector containing the wrapping division of
self
andrhs
. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
wrapping_mul
Returns a vector containing the wrapping multiplication of
self
andrhs
. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
wrapping_sub
Returns a vector containing the wrapping subtraction of
self
andrhs
. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
self
and unsigned vectorrhs
. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]
.
Arguments
- _self :
I64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
I64Vec3
I64Vec3
- x : i64
- y : i64
- z : i64
Description
No Documentation 🚧
Functions
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
I64Vec3
- No Documentation 🚧 - arg1 :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
I64Vec3
- No Documentation 🚧 - arg1 :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
as_dvec3
Casts all elements of
self
tof64
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
as_ivec3
Casts all elements of
self
toi32
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
as_u64vec3
Casts all elements of
self
tou64
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
as_uvec3
Casts all elements of
self
tou32
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
as_vec3
Casts all elements of
self
tof32
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
as_vec3a
Casts all elements of
self
tof32
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
i64::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - min :
I64Vec3
- No Documentation 🚧 - max :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cross
Computes the cross product of
self
andrhs
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
I64Vec3
- No Documentation 🚧 - arg1 :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
I64Vec3
- No Documentation 🚧 - arg1 :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.Panics
This function will panic if any
rhs
element is 0 or the division results in overflow.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - other :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
extend
Creates a 4D vector from
self
and the givenw
value.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - w :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[i64; 3]
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
is_negative_bitmask
Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of
self
. A negative element results in a1
bit and a positive element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
length_squared
Computes the squared length of
self
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
I64Vec3
- No Documentation 🚧 - arg1 :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
I64Vec3
- No Documentation 🚧 - arg1 :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
i64
- No Documentation 🚧 - y :
i64
- No Documentation 🚧 - z :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
I64Vec3
- No Documentation 🚧 - arg1 :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
I64Vec3
- No Documentation 🚧 - arg1 :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
.Panics
This function will panic if any
rhs
element is 0 or the division results in overflow. [Euclidean division]: i64::rem_euclid
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
saturating_add
Returns a vector containing the saturating addition of
self
andrhs
. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
saturating_div
Returns a vector containing the saturating division of
self
andrhs
. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
saturating_mul
Returns a vector containing the saturating multiplication of
self
andrhs
. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
saturating_sub
Returns a vector containing the saturating subtraction of
self
andrhs
. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
self
and unsigned vectorrhs
. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec3
- No Documentation 🚧 - if_true :
I64Vec3
- No Documentation 🚧 - if_false :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
signum
Returns a vector with elements representing the sign of
self
.
0
if the number is zero1
if the number is positive-1
if the number is negative
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
I64Vec3
- No Documentation 🚧 - arg1 :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
I64Vec3
- No Documentation 🚧 - arg1 :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
to_array
[x, y, z]
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
[i64; 3]
- No Documentation 🚧
truncate
Creates a 2D vector from the
x
andy
elements ofself
, discardingz
. Truncation may also be performed by using [self.xy()
][crate::swizzles::Vec3Swizzles::xy()].
Arguments
- _self :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
with_x
Creates a 3D vector from
self
with the given value ofx
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - x :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
with_y
Creates a 3D vector from
self
with the given value ofy
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - y :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
with_z
Creates a 3D vector from
self
with the given value ofz
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - z :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
wrapping_add
Returns a vector containing the wrapping addition of
self
andrhs
. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
self
and unsigned vectorrhs
. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
wrapping_div
Returns a vector containing the wrapping division of
self
andrhs
. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
wrapping_mul
Returns a vector containing the wrapping multiplication of
self
andrhs
. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
wrapping_sub
Returns a vector containing the wrapping subtraction of
self
andrhs
. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
self
and unsigned vectorrhs
. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]
.
Arguments
- _self :
I64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
I64Vec4
I64Vec4
- x : i64
- y : i64
- z : i64
- w : i64
Description
No Documentation 🚧
Functions
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
I64Vec4
- No Documentation 🚧 - arg1 :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
I64Vec4
- No Documentation 🚧 - arg1 :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
as_dvec4
Casts all elements of
self
tof64
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
as_ivec4
Casts all elements of
self
toi32
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
as_u64vec4
Casts all elements of
self
tou64
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
as_uvec4
Casts all elements of
self
tou32
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
as_vec4
Casts all elements of
self
tof32
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
i64::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - min :
I64Vec4
- No Documentation 🚧 - max :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
I64Vec4
- No Documentation 🚧 - arg1 :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
I64Vec4
- No Documentation 🚧 - arg1 :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.Panics
This function will panic if any
rhs
element is 0 or the division results in overflow.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - other :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[i64; 4]
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
is_negative_bitmask
Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of
self
. A negative element results in a1
bit and a positive element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
length_squared
Computes the squared length of
self
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
i64
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
I64Vec4
- No Documentation 🚧 - arg1 :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
I64Vec4
- No Documentation 🚧 - arg1 :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
i64
- No Documentation 🚧 - y :
i64
- No Documentation 🚧 - z :
i64
- No Documentation 🚧 - w :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
I64Vec4
- No Documentation 🚧 - arg1 :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
I64Vec4
- No Documentation 🚧 - arg1 :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
.Panics
This function will panic if any
rhs
element is 0 or the division results in overflow. [Euclidean division]: i64::rem_euclid
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
saturating_add
Returns a vector containing the saturating addition of
self
andrhs
. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
saturating_div
Returns a vector containing the saturating division of
self
andrhs
. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
saturating_mul
Returns a vector containing the saturating multiplication of
self
andrhs
. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
saturating_sub
Returns a vector containing the saturating subtraction of
self
andrhs
. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
self
and unsigned vectorrhs
. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec4
- No Documentation 🚧 - if_true :
I64Vec4
- No Documentation 🚧 - if_false :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
signum
Returns a vector with elements representing the sign of
self
.
0
if the number is zero1
if the number is positive-1
if the number is negative
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
I64Vec4
- No Documentation 🚧 - arg1 :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
I64Vec4
- No Documentation 🚧 - arg1 :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
to_array
[x, y, z, w]
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
[i64; 4]
- No Documentation 🚧
truncate
Creates a 3D vector from the
x
,y
andz
elements ofself
, discardingw
. Truncation to [I64Vec3
] may also be performed by using [self.xyz()
][crate::swizzles::Vec4Swizzles::xyz()].
Arguments
- _self :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
with_w
Creates a 4D vector from
self
with the given value ofw
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - w :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
with_x
Creates a 4D vector from
self
with the given value ofx
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - x :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
with_y
Creates a 4D vector from
self
with the given value ofy
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - y :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
with_z
Creates a 4D vector from
self
with the given value ofz
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - z :
i64
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
wrapping_add
Returns a vector containing the wrapping addition of
self
andrhs
. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
self
and unsigned vectorrhs
. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
wrapping_div
Returns a vector containing the wrapping division of
self
andrhs
. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
wrapping_mul
Returns a vector containing the wrapping multiplication of
self
andrhs
. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
wrapping_sub
Returns a vector containing the wrapping subtraction of
self
andrhs
. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
self
and unsigned vectorrhs
. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]
.
Arguments
- _self :
I64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
IVec2
IVec2
- x : i32
- y : i32
Description
No Documentation 🚧
Functions
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
IVec2
- No Documentation 🚧 - arg1 :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
IVec2
- No Documentation 🚧 - arg1 :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
as_dvec2
Casts all elements of
self
tof64
.
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
as_i64vec2
Casts all elements of
self
toi64
.
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
as_u64vec2
Casts all elements of
self
tou64
.
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
as_uvec2
Casts all elements of
self
tou32
.
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
as_vec2
Casts all elements of
self
tof32
.
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
i32::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
IVec2
- No Documentation 🚧 - min :
IVec2
- No Documentation 🚧 - max :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
IVec2
- No Documentation 🚧 - arg1 :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
IVec2
- No Documentation 🚧 - arg1 :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.Panics
This function will panic if any
rhs
element is 0 or the division results in overflow.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
IVec2
- No Documentation 🚧 - other :
IVec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
extend
Creates a 3D vector from
self
and the givenz
value.
Arguments
- _self :
IVec2
- No Documentation 🚧 - z :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[i32; 2]
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
is_negative_bitmask
Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of
self
. A negative element results in a1
bit and a positive element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
length_squared
Computes the squared length of
self
.
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
IVec2
- No Documentation 🚧 - arg1 :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
IVec2
- No Documentation 🚧 - arg1 :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
i32
- No Documentation 🚧 - y :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
perp
Returns a vector that is equal to
self
rotated by 90 degrees.
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
perp_dot
The perpendicular dot product of
self
andrhs
. Also known as the wedge product, 2D cross product, and determinant.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
IVec2
- No Documentation 🚧 - arg1 :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
IVec2
- No Documentation 🚧 - arg1 :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
.Panics
This function will panic if any
rhs
element is 0 or the division results in overflow. [Euclidean division]: i32::rem_euclid
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
rotate
Returns
rhs
rotated by the angle ofself
. Ifself
is normalized, then this just rotation. This is what you usually want. Otherwise, it will be like a rotation with a multiplication byself
's length.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
saturating_add
Returns a vector containing the saturating addition of
self
andrhs
. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
saturating_div
Returns a vector containing the saturating division of
self
andrhs
. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
saturating_mul
Returns a vector containing the saturating multiplication of
self
andrhs
. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
saturating_sub
Returns a vector containing the saturating subtraction of
self
andrhs
. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
self
and unsigned vectorrhs
. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec2
- No Documentation 🚧 - if_true :
IVec2
- No Documentation 🚧 - if_false :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
signum
Returns a vector with elements representing the sign of
self
.
0
if the number is zero1
if the number is positive-1
if the number is negative
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
IVec2
- No Documentation 🚧 - arg1 :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
IVec2
- No Documentation 🚧 - arg1 :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
to_array
[x, y]
Arguments
- _self :
IVec2
- No Documentation 🚧
Returns
- arg0 :
[i32; 2]
- No Documentation 🚧
with_x
Creates a 2D vector from
self
with the given value ofx
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - x :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
with_y
Creates a 2D vector from
self
with the given value ofy
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - y :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
wrapping_add
Returns a vector containing the wrapping addition of
self
andrhs
. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
self
and unsigned vectorrhs
. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
wrapping_div
Returns a vector containing the wrapping division of
self
andrhs
. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
wrapping_mul
Returns a vector containing the wrapping multiplication of
self
andrhs
. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
wrapping_sub
Returns a vector containing the wrapping subtraction of
self
andrhs
. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
self
and unsigned vectorrhs
. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]
.
Arguments
- _self :
IVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
IVec3
IVec3
- x : i32
- y : i32
- z : i32
Description
No Documentation 🚧
Functions
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
IVec3
- No Documentation 🚧 - arg1 :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
IVec3
- No Documentation 🚧 - arg1 :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
as_dvec3
Casts all elements of
self
tof64
.
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
as_i64vec3
Casts all elements of
self
toi64
.
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
as_u64vec3
Casts all elements of
self
tou64
.
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
as_uvec3
Casts all elements of
self
tou32
.
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
as_vec3
Casts all elements of
self
tof32
.
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
as_vec3a
Casts all elements of
self
tof32
.
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
i32::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
IVec3
- No Documentation 🚧 - min :
IVec3
- No Documentation 🚧 - max :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cross
Computes the cross product of
self
andrhs
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
IVec3
- No Documentation 🚧 - arg1 :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
IVec3
- No Documentation 🚧 - arg1 :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.Panics
This function will panic if any
rhs
element is 0 or the division results in overflow.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
IVec3
- No Documentation 🚧 - other :
IVec3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
extend
Creates a 4D vector from
self
and the givenw
value.
Arguments
- _self :
IVec3
- No Documentation 🚧 - w :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[i32; 3]
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
is_negative_bitmask
Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of
self
. A negative element results in a1
bit and a positive element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
length_squared
Computes the squared length of
self
.
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
IVec3
- No Documentation 🚧 - arg1 :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
IVec3
- No Documentation 🚧 - arg1 :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
i32
- No Documentation 🚧 - y :
i32
- No Documentation 🚧 - z :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
IVec3
- No Documentation 🚧 - arg1 :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
IVec3
- No Documentation 🚧 - arg1 :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
.Panics
This function will panic if any
rhs
element is 0 or the division results in overflow. [Euclidean division]: i32::rem_euclid
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
saturating_add
Returns a vector containing the saturating addition of
self
andrhs
. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
saturating_div
Returns a vector containing the saturating division of
self
andrhs
. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
saturating_mul
Returns a vector containing the saturating multiplication of
self
andrhs
. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
saturating_sub
Returns a vector containing the saturating subtraction of
self
andrhs
. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
self
and unsigned vectorrhs
. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec3
- No Documentation 🚧 - if_true :
IVec3
- No Documentation 🚧 - if_false :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
signum
Returns a vector with elements representing the sign of
self
.
0
if the number is zero1
if the number is positive-1
if the number is negative
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
IVec3
- No Documentation 🚧 - arg1 :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
IVec3
- No Documentation 🚧 - arg1 :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
to_array
[x, y, z]
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
[i32; 3]
- No Documentation 🚧
truncate
Creates a 2D vector from the
x
andy
elements ofself
, discardingz
. Truncation may also be performed by using [self.xy()
][crate::swizzles::Vec3Swizzles::xy()].
Arguments
- _self :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
with_x
Creates a 3D vector from
self
with the given value ofx
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - x :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
with_y
Creates a 3D vector from
self
with the given value ofy
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - y :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
with_z
Creates a 3D vector from
self
with the given value ofz
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - z :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
wrapping_add
Returns a vector containing the wrapping addition of
self
andrhs
. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
self
and unsigned vectorrhs
. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
wrapping_div
Returns a vector containing the wrapping division of
self
andrhs
. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
wrapping_mul
Returns a vector containing the wrapping multiplication of
self
andrhs
. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
wrapping_sub
Returns a vector containing the wrapping subtraction of
self
andrhs
. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
self
and unsigned vectorrhs
. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]
.
Arguments
- _self :
IVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
IVec4
IVec4
- x : i32
- y : i32
- z : i32
- w : i32
Description
No Documentation 🚧
Functions
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
IVec4
- No Documentation 🚧 - arg1 :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
IVec4
- No Documentation 🚧 - arg1 :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
as_dvec4
Casts all elements of
self
tof64
.
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
as_i64vec4
Casts all elements of
self
toi64
.
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
as_u64vec4
Casts all elements of
self
tou64
.
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
as_uvec4
Casts all elements of
self
tou32
.
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
as_vec4
Casts all elements of
self
tof32
.
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
i32::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
IVec4
- No Documentation 🚧 - min :
IVec4
- No Documentation 🚧 - max :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
IVec4
- No Documentation 🚧 - arg1 :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
IVec4
- No Documentation 🚧 - arg1 :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.Panics
This function will panic if any
rhs
element is 0 or the division results in overflow.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
IVec4
- No Documentation 🚧 - other :
IVec4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[i32; 4]
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
is_negative_bitmask
Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of
self
. A negative element results in a1
bit and a positive element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
length_squared
Computes the squared length of
self
.
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
i32
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
IVec4
- No Documentation 🚧 - arg1 :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
IVec4
- No Documentation 🚧 - arg1 :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
i32
- No Documentation 🚧 - y :
i32
- No Documentation 🚧 - z :
i32
- No Documentation 🚧 - w :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
IVec4
- No Documentation 🚧 - arg1 :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
IVec4
- No Documentation 🚧 - arg1 :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
.Panics
This function will panic if any
rhs
element is 0 or the division results in overflow. [Euclidean division]: i32::rem_euclid
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
saturating_add
Returns a vector containing the saturating addition of
self
andrhs
. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
saturating_div
Returns a vector containing the saturating division of
self
andrhs
. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
saturating_mul
Returns a vector containing the saturating multiplication of
self
andrhs
. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
saturating_sub
Returns a vector containing the saturating subtraction of
self
andrhs
. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
self
and unsigned vectorrhs
. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec4
- No Documentation 🚧 - if_true :
IVec4
- No Documentation 🚧 - if_false :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
signum
Returns a vector with elements representing the sign of
self
.
0
if the number is zero1
if the number is positive-1
if the number is negative
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
IVec4
- No Documentation 🚧 - arg1 :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
IVec4
- No Documentation 🚧 - arg1 :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
to_array
[x, y, z, w]
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
[i32; 4]
- No Documentation 🚧
truncate
Creates a 3D vector from the
x
,y
andz
elements ofself
, discardingw
. Truncation to [IVec3
] may also be performed by using [self.xyz()
][crate::swizzles::Vec4Swizzles::xyz()].
Arguments
- _self :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
with_w
Creates a 4D vector from
self
with the given value ofw
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - w :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
with_x
Creates a 4D vector from
self
with the given value ofx
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - x :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
with_y
Creates a 4D vector from
self
with the given value ofy
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - y :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
with_z
Creates a 4D vector from
self
with the given value ofz
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - z :
i32
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
wrapping_add
Returns a vector containing the wrapping addition of
self
andrhs
. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
self
and unsigned vectorrhs
. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
wrapping_div
Returns a vector containing the wrapping division of
self
andrhs
. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
wrapping_mul
Returns a vector containing the wrapping multiplication of
self
andrhs
. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
wrapping_sub
Returns a vector containing the wrapping subtraction of
self
andrhs
. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
self
and unsigned vectorrhs
. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]
.
Arguments
- _self :
IVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
Mat2
Mat2
- x_axis : glam::Vec2
- y_axis : glam::Vec2
Description
No Documentation 🚧
Functions
abs
Takes the absolute value of each element in
self
Arguments
- _self :
Mat2
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
Mat2
- No Documentation 🚧 - rhs :
Mat2
- No Documentation 🚧 - max_abs_diff :
f32
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
Mat2
- No Documentation 🚧 - rhs :
Mat2
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
add_mat2
Adds two 2x2 matrices.
Arguments
- _self :
Mat2
- No Documentation 🚧 - rhs :
Mat2
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
as_dmat2
No Documentation 🚧
Arguments
- _self :
Mat2
- No Documentation 🚧
Returns
- arg0 :
DMat2
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Mat2
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
col
Returns the matrix column for the given
index
.Panics
Panics if
index
is greater than 1.
Arguments
- _self :
Mat2
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
determinant
Returns the determinant of
self
.
Arguments
- _self :
Mat2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
Mat2
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
div_scalar
Divides a 2x2 matrix by a scalar.
Arguments
- _self :
Mat2
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Mat2
- No Documentation 🚧 - rhs :
Mat2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_angle
Creates a 2x2 matrix containing a rotation of
angle
(in radians).
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
from_cols
Creates a 2x2 matrix from two column vectors.
Arguments
- x_axis :
Vec2
- No Documentation 🚧 - y_axis :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
from_diagonal
Creates a 2x2 matrix with its diagonal set to
diagonal
and all other entries set to 0.
Arguments
- diagonal :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
from_mat3
Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column.
Arguments
- m :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
from_mat3_minor
Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the
i
th column andj
th row.Panics
Panics if
i
orj
is greater than 2.
Arguments
- m :
Mat3
- No Documentation 🚧 - i :
usize
- No Documentation 🚧 - j :
usize
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
from_mat3a
Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column.
Arguments
- m :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
from_mat3a_minor
Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the
i
th column andj
th row.Panics
Panics if
i
orj
is greater than 2.
Arguments
- m :
Mat3A
- No Documentation 🚧 - i :
usize
- No Documentation 🚧 - j :
usize
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
from_scale_angle
Creates a 2x2 matrix containing the combining non-uniform
scale
and rotation ofangle
(in radians).
Arguments
- scale :
Vec2
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
inverse
Returns the inverse of
self
. If the matrix is not invertible the returned matrix will be invalid.Panics
Will panic if the determinant of
self
is zero whenglam_assert
is enabled.
Arguments
- _self :
Mat2
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
Mat2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
Mat2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Mat2
- No Documentation 🚧 - rhs :
Mat2
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
Mat2
- No Documentation 🚧 - arg1 :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
Mat2
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
mul_mat2
Multiplies two 2x2 matrices.
Arguments
- _self :
Mat2
- No Documentation 🚧 - rhs :
Mat2
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
mul_scalar
Multiplies a 2x2 matrix by a scalar.
Arguments
- _self :
Mat2
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
mul_vec2
Transforms a 2D vector.
Arguments
- _self :
Mat2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
Mat2
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
row
Returns the matrix row for the given
index
.Panics
Panics if
index
is greater than 1.
Arguments
- _self :
Mat2
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
Mat2
- No Documentation 🚧 - rhs :
Mat2
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
sub_mat2
Subtracts two 2x2 matrices.
Arguments
- _self :
Mat2
- No Documentation 🚧 - rhs :
Mat2
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
to_cols_array
Creates a
[f32; 4]
array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
Mat2
- No Documentation 🚧
Returns
- arg0 :
[f32; 4]
- No Documentation 🚧
to_cols_array_2d
Creates a
[[f32; 2]; 2]
2D array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
Mat2
- No Documentation 🚧
Returns
- arg0 :
[[f32; 2]; 2]
- No Documentation 🚧
transpose
Returns the transpose of
self
.
Arguments
- _self :
Mat2
- No Documentation 🚧
Returns
- arg0 :
Mat2
- No Documentation 🚧
Mat3
Mat3
- x_axis : glam::Vec3
- y_axis : glam::Vec3
- z_axis : glam::Vec3
Description
No Documentation 🚧
Functions
abs
Takes the absolute value of each element in
self
Arguments
- _self :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
Mat3
- No Documentation 🚧 - rhs :
Mat3
- No Documentation 🚧 - max_abs_diff :
f32
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
Mat3
- No Documentation 🚧 - rhs :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
add_mat3
Adds two 3x3 matrices.
Arguments
- _self :
Mat3
- No Documentation 🚧 - rhs :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
as_dmat3
No Documentation 🚧
Arguments
- _self :
Mat3
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
col
Returns the matrix column for the given
index
.Panics
Panics if
index
is greater than 2.
Arguments
- _self :
Mat3
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
determinant
Returns the determinant of
self
.
Arguments
- _self :
Mat3
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
Mat3
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
div_scalar
Divides a 3x3 matrix by a scalar.
Arguments
- _self :
Mat3
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Mat3
- No Documentation 🚧 - rhs :
Mat3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_angle
Creates an affine transformation matrix from the given 2D rotation
angle
(in radians). The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()
] and [Self::transform_vector2()
].
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
from_axis_angle
Creates a 3D rotation matrix from a normalized rotation
axis
andangle
(in radians).Panics
Will panic if
axis
is not normalized whenglam_assert
is enabled.
Arguments
- axis :
Vec3
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
from_cols
Creates a 3x3 matrix from three column vectors.
Arguments
- x_axis :
Vec3
- No Documentation 🚧 - y_axis :
Vec3
- No Documentation 🚧 - z_axis :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
from_diagonal
Creates a 3x3 matrix with its diagonal set to
diagonal
and all other entries set to 0.
Arguments
- diagonal :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
from_euler
Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in radians).
Arguments
- order :
EulerRot
- No Documentation 🚧 - a :
f32
- No Documentation 🚧 - b :
f32
- No Documentation 🚧 - c :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
from_mat2
Creates an affine transformation matrix from the given 2x2 matrix. The resulting matrix can be used to transform 2D points and vectors. See [
Self::transform_point2()
] and [Self::transform_vector2()
].
Arguments
- m :
Mat2
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
from_mat4
Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column.
Arguments
- m :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
from_mat4_minor
Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the
i
th column andj
th row.Panics
Panics if
i
orj
is greater than 3.
Arguments
- m :
Mat4
- No Documentation 🚧 - i :
usize
- No Documentation 🚧 - j :
usize
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
from_quat
Creates a 3D rotation matrix from the given quaternion.
Panics
Will panic if
rotation
is not normalized whenglam_assert
is enabled.
Arguments
- rotation :
Quat
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
from_rotation_x
Creates a 3D rotation matrix from
angle
(in radians) around the x axis.
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
from_rotation_y
Creates a 3D rotation matrix from
angle
(in radians) around the y axis.
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
from_rotation_z
Creates a 3D rotation matrix from
angle
(in radians) around the z axis.
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
from_scale
Creates an affine transformation matrix from the given non-uniform 2D
scale
. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()
] and [Self::transform_vector2()
].Panics
Will panic if all elements of
scale
are zero whenglam_assert
is enabled.
Arguments
- scale :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
from_scale_angle_translation
Creates an affine transformation matrix from the given 2D
scale
, rotationangle
(in radians) andtranslation
. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()
] and [Self::transform_vector2()
].
Arguments
- scale :
Vec2
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧 - translation :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
from_translation
Creates an affine transformation matrix from the given 2D
translation
. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()
] and [Self::transform_vector2()
].
Arguments
- translation :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
inverse
Returns the inverse of
self
. If the matrix is not invertible the returned matrix will be invalid.Panics
Will panic if the determinant of
self
is zero whenglam_assert
is enabled.
Arguments
- _self :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
Mat3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
Mat3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Mat3
- No Documentation 🚧 - rhs :
Affine2
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
Mat3
- No Documentation 🚧 - arg1 :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
Mat3
- No Documentation 🚧 - arg1 :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
mul-3
No Documentation 🚧
Arguments
- arg0 :
Mat3
- No Documentation 🚧 - arg1 :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
mul-4
No Documentation 🚧
Arguments
- arg0 :
Mat3
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
mul_mat3
Multiplies two 3x3 matrices.
Arguments
- _self :
Mat3
- No Documentation 🚧 - rhs :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
mul_scalar
Multiplies a 3x3 matrix by a scalar.
Arguments
- _self :
Mat3
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
mul_vec3
Transforms a 3D vector.
Arguments
- _self :
Mat3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
mul_vec3a
Transforms a [
Vec3A
].
Arguments
- _self :
Mat3
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
row
Returns the matrix row for the given
index
.Panics
Panics if
index
is greater than 2.
Arguments
- _self :
Mat3
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
Mat3
- No Documentation 🚧 - rhs :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
sub_mat3
Subtracts two 3x3 matrices.
Arguments
- _self :
Mat3
- No Documentation 🚧 - rhs :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
to_cols_array
Creates a
[f32; 9]
array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
Mat3
- No Documentation 🚧
Returns
- arg0 :
[f32; 9]
- No Documentation 🚧
to_cols_array_2d
Creates a
[[f32; 3]; 3]
3D array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
Mat3
- No Documentation 🚧
Returns
- arg0 :
[[f32; 3]; 3]
- No Documentation 🚧
to_euler
Extract Euler angles with the given Euler rotation order. Note if the input matrix contains scales, shears, or other non-rotation transformations then the resulting Euler angles will be ill-defined.
Panics
Will panic if any input matrix column is not normalized when
glam_assert
is enabled.
Arguments
- _self :
Mat3
- No Documentation 🚧 - order :
EulerRot
- No Documentation 🚧
Returns
- arg0 :
(f32, f32, f32)
- No Documentation 🚧
transform_point2
Transforms the given 2D vector as a point. This is the equivalent of multiplying
rhs
as a 3D vector wherez
is1
. This method assumes thatself
contains a valid affine transform.Panics
Will panic if the 2nd row of
self
is not(0, 0, 1)
whenglam_assert
is enabled.
Arguments
- _self :
Mat3
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
transform_vector2
Rotates the given 2D vector. This is the equivalent of multiplying
rhs
as a 3D vector wherez
is0
. This method assumes thatself
contains a valid affine transform.Panics
Will panic if the 2nd row of
self
is not(0, 0, 1)
whenglam_assert
is enabled.
Arguments
- _self :
Mat3
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
transpose
Returns the transpose of
self
.
Arguments
- _self :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Mat3
- No Documentation 🚧
Mat3A
Mat3A
- x_axis : glam::Vec3A
- y_axis : glam::Vec3A
- z_axis : glam::Vec3A
Description
No Documentation 🚧
Functions
abs
Takes the absolute value of each element in
self
Arguments
- _self :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
Mat3A
- No Documentation 🚧 - rhs :
Mat3A
- No Documentation 🚧 - max_abs_diff :
f32
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
Mat3A
- No Documentation 🚧 - rhs :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
add_mat3
Adds two 3x3 matrices.
Arguments
- _self :
Mat3A
- No Documentation 🚧 - rhs :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
as_dmat3
No Documentation 🚧
Arguments
- _self :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
DMat3
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
col
Returns the matrix column for the given
index
.Panics
Panics if
index
is greater than 2.
Arguments
- _self :
Mat3A
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
determinant
Returns the determinant of
self
.
Arguments
- _self :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
Mat3A
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
div_scalar
Divides a 3x3 matrix by a scalar.
Arguments
- _self :
Mat3A
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Mat3A
- No Documentation 🚧 - rhs :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_angle
Creates an affine transformation matrix from the given 2D rotation
angle
(in radians). The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()
] and [Self::transform_vector2()
].
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
from_axis_angle
Creates a 3D rotation matrix from a normalized rotation
axis
andangle
(in radians).Panics
Will panic if
axis
is not normalized whenglam_assert
is enabled.
Arguments
- axis :
Vec3
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
from_cols
Creates a 3x3 matrix from three column vectors.
Arguments
- x_axis :
Vec3A
- No Documentation 🚧 - y_axis :
Vec3A
- No Documentation 🚧 - z_axis :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
from_diagonal
Creates a 3x3 matrix with its diagonal set to
diagonal
and all other entries set to 0.
Arguments
- diagonal :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
from_euler
Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in radians).
Arguments
- order :
EulerRot
- No Documentation 🚧 - a :
f32
- No Documentation 🚧 - b :
f32
- No Documentation 🚧 - c :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
from_mat2
Creates an affine transformation matrix from the given 2x2 matrix. The resulting matrix can be used to transform 2D points and vectors. See [
Self::transform_point2()
] and [Self::transform_vector2()
].
Arguments
- m :
Mat2
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
from_mat4
Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column.
Arguments
- m :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
from_mat4_minor
Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the
i
th column andj
th row.Panics
Panics if
i
orj
is greater than 3.
Arguments
- m :
Mat4
- No Documentation 🚧 - i :
usize
- No Documentation 🚧 - j :
usize
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
from_quat
Creates a 3D rotation matrix from the given quaternion.
Panics
Will panic if
rotation
is not normalized whenglam_assert
is enabled.
Arguments
- rotation :
Quat
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
from_rotation_x
Creates a 3D rotation matrix from
angle
(in radians) around the x axis.
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
from_rotation_y
Creates a 3D rotation matrix from
angle
(in radians) around the y axis.
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
from_rotation_z
Creates a 3D rotation matrix from
angle
(in radians) around the z axis.
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
from_scale
Creates an affine transformation matrix from the given non-uniform 2D
scale
. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()
] and [Self::transform_vector2()
].Panics
Will panic if all elements of
scale
are zero whenglam_assert
is enabled.
Arguments
- scale :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
from_scale_angle_translation
Creates an affine transformation matrix from the given 2D
scale
, rotationangle
(in radians) andtranslation
. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()
] and [Self::transform_vector2()
].
Arguments
- scale :
Vec2
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧 - translation :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
from_translation
Creates an affine transformation matrix from the given 2D
translation
. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()
] and [Self::transform_vector2()
].
Arguments
- translation :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
inverse
Returns the inverse of
self
. If the matrix is not invertible the returned matrix will be invalid.Panics
Will panic if the determinant of
self
is zero whenglam_assert
is enabled.
Arguments
- _self :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Mat3A
- No Documentation 🚧 - rhs :
Affine2
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
Mat3A
- No Documentation 🚧 - arg1 :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
Mat3A
- No Documentation 🚧 - arg1 :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
mul-3
No Documentation 🚧
Arguments
- arg0 :
Mat3A
- No Documentation 🚧 - arg1 :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
mul-4
No Documentation 🚧
Arguments
- arg0 :
Mat3A
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
mul_mat3
Multiplies two 3x3 matrices.
Arguments
- _self :
Mat3A
- No Documentation 🚧 - rhs :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
mul_scalar
Multiplies a 3x3 matrix by a scalar.
Arguments
- _self :
Mat3A
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
mul_vec3
Transforms a 3D vector.
Arguments
- _self :
Mat3A
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
mul_vec3a
Transforms a [
Vec3A
].
Arguments
- _self :
Mat3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
row
Returns the matrix row for the given
index
.Panics
Panics if
index
is greater than 2.
Arguments
- _self :
Mat3A
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
Mat3A
- No Documentation 🚧 - rhs :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
sub_mat3
Subtracts two 3x3 matrices.
Arguments
- _self :
Mat3A
- No Documentation 🚧 - rhs :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
to_cols_array
Creates a
[f32; 9]
array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
[f32; 9]
- No Documentation 🚧
to_cols_array_2d
Creates a
[[f32; 3]; 3]
3D array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
[[f32; 3]; 3]
- No Documentation 🚧
to_euler
Extract Euler angles with the given Euler rotation order. Note if the input matrix contains scales, shears, or other non-rotation transformations then the resulting Euler angles will be ill-defined.
Panics
Will panic if any input matrix column is not normalized when
glam_assert
is enabled.
Arguments
- _self :
Mat3A
- No Documentation 🚧 - order :
EulerRot
- No Documentation 🚧
Returns
- arg0 :
(f32, f32, f32)
- No Documentation 🚧
transform_point2
Transforms the given 2D vector as a point. This is the equivalent of multiplying
rhs
as a 3D vector wherez
is1
. This method assumes thatself
contains a valid affine transform.Panics
Will panic if the 2nd row of
self
is not(0, 0, 1)
whenglam_assert
is enabled.
Arguments
- _self :
Mat3A
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
transform_vector2
Rotates the given 2D vector. This is the equivalent of multiplying
rhs
as a 3D vector wherez
is0
. This method assumes thatself
contains a valid affine transform.Panics
Will panic if the 2nd row of
self
is not(0, 0, 1)
whenglam_assert
is enabled.
Arguments
- _self :
Mat3A
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
transpose
Returns the transpose of
self
.
Arguments
- _self :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
Mat3A
- No Documentation 🚧
Mat4
Mat4
- x_axis : glam::Vec4
- y_axis : glam::Vec4
- z_axis : glam::Vec4
- w_axis : glam::Vec4
Description
No Documentation 🚧
Functions
abs
Takes the absolute value of each element in
self
Arguments
- _self :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
Mat4
- No Documentation 🚧 - max_abs_diff :
f32
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
add_mat4
Adds two 4x4 matrices.
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
as_dmat4
No Documentation 🚧
Arguments
- _self :
Mat4
- No Documentation 🚧
Returns
- arg0 :
DMat4
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
col
Returns the matrix column for the given
index
.Panics
Panics if
index
is greater than 3.
Arguments
- _self :
Mat4
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
determinant
Returns the determinant of
self
.
Arguments
- _self :
Mat4
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
div_scalar
Divides a 4x4 matrix by a scalar.
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
Mat4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_axis_angle
Creates an affine transformation matrix containing a 3D rotation around a normalized rotation
axis
ofangle
(in radians). The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].Panics
Will panic if
axis
is not normalized whenglam_assert
is enabled.
Arguments
- axis :
Vec3
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
from_cols
Creates a 4x4 matrix from four column vectors.
Arguments
- x_axis :
Vec4
- No Documentation 🚧 - y_axis :
Vec4
- No Documentation 🚧 - z_axis :
Vec4
- No Documentation 🚧 - w_axis :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
from_diagonal
Creates a 4x4 matrix with its diagonal set to
diagonal
and all other entries set to 0.
Arguments
- diagonal :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
from_euler
Creates a affine transformation matrix containing a rotation from the given euler rotation sequence and angles (in radians). The resulting matrix can be used to transform 3D points and vectors. See [
Self::transform_point3()
] and [Self::transform_vector3()
].
Arguments
- order :
EulerRot
- No Documentation 🚧 - a :
f32
- No Documentation 🚧 - b :
f32
- No Documentation 🚧 - c :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
from_mat3
Creates an affine transformation matrix from the given 3x3 linear transformation matrix. The resulting matrix can be used to transform 3D points and vectors. See [
Self::transform_point3()
] and [Self::transform_vector3()
].
Arguments
- m :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
from_mat3a
Creates an affine transformation matrix from the given 3x3 linear transformation matrix. The resulting matrix can be used to transform 3D points and vectors. See [
Self::transform_point3()
] and [Self::transform_vector3()
].
Arguments
- m :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
from_quat
Creates an affine transformation matrix from the given
rotation
quaternion. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].Panics
Will panic if
rotation
is not normalized whenglam_assert
is enabled.
Arguments
- rotation :
Quat
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
from_rotation_translation
Creates an affine transformation matrix from the given 3D
translation
. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].Panics
Will panic if
rotation
is not normalized whenglam_assert
is enabled.
Arguments
- rotation :
Quat
- No Documentation 🚧 - translation :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
from_rotation_x
Creates an affine transformation matrix containing a 3D rotation around the x axis of
angle
(in radians). The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
from_rotation_y
Creates an affine transformation matrix containing a 3D rotation around the y axis of
angle
(in radians). The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
from_rotation_z
Creates an affine transformation matrix containing a 3D rotation around the z axis of
angle
(in radians). The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
from_scale
Creates an affine transformation matrix containing the given 3D non-uniform
scale
. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].Panics
Will panic if all elements of
scale
are zero whenglam_assert
is enabled.
Arguments
- scale :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
from_scale_rotation_translation
Creates an affine transformation matrix from the given 3D
scale
,rotation
andtranslation
. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].Panics
Will panic if
rotation
is not normalized whenglam_assert
is enabled.
Arguments
- scale :
Vec3
- No Documentation 🚧 - rotation :
Quat
- No Documentation 🚧 - translation :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
from_translation
Creates an affine transformation matrix from the given 3D
translation
. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()
] and [Self::transform_vector3()
].
Arguments
- translation :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
inverse
Returns the inverse of
self
. If the matrix is not invertible the returned matrix will be invalid.Panics
Will panic if the determinant of
self
is zero whenglam_assert
is enabled.
Arguments
- _self :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
Mat4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
Mat4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
look_at_lh
Creates a left-handed view matrix using a camera position, an up direction, and a focal point. For a view coordinate system with
+X=right
,+Y=up
and+Z=forward
.Panics
Will panic if
up
is not normalized whenglam_assert
is enabled.
Arguments
- eye :
Vec3
- No Documentation 🚧 - center :
Vec3
- No Documentation 🚧 - up :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
look_at_rh
Creates a right-handed view matrix using a camera position, an up direction, and a focal point. For a view coordinate system with
+X=right
,+Y=up
and+Z=back
.Panics
Will panic if
up
is not normalized whenglam_assert
is enabled.
Arguments
- eye :
Vec3
- No Documentation 🚧 - center :
Vec3
- No Documentation 🚧 - up :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
look_to_lh
Creates a left-handed view matrix using a camera position, an up direction, and a facing direction. For a view coordinate system with
+X=right
,+Y=up
and+Z=forward
.
Arguments
- eye :
Vec3
- No Documentation 🚧 - dir :
Vec3
- No Documentation 🚧 - up :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
look_to_rh
Creates a right-handed view matrix using a camera position, an up direction, and a facing direction. For a view coordinate system with
+X=right
,+Y=up
and+Z=back
.
Arguments
- eye :
Vec3
- No Documentation 🚧 - dir :
Vec3
- No Documentation 🚧 - up :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
Affine3A
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
Mat4
- No Documentation 🚧 - arg1 :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
Mat4
- No Documentation 🚧 - arg1 :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
mul-3
No Documentation 🚧
Arguments
- arg0 :
Mat4
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
mul_mat4
Multiplies two 4x4 matrices.
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
mul_scalar
Multiplies a 4x4 matrix by a scalar.
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
mul_vec4
Transforms a 4D vector.
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
orthographic_lh
Creates a left-handed orthographic projection matrix with
[0,1]
depth range. Useful to map a left-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect.
Arguments
- left :
f32
- No Documentation 🚧 - right :
f32
- No Documentation 🚧 - bottom :
f32
- No Documentation 🚧 - top :
f32
- No Documentation 🚧 - near :
f32
- No Documentation 🚧 - far :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
orthographic_rh
Creates a right-handed orthographic projection matrix with
[0,1]
depth range. Useful to map a right-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect.
Arguments
- left :
f32
- No Documentation 🚧 - right :
f32
- No Documentation 🚧 - bottom :
f32
- No Documentation 🚧 - top :
f32
- No Documentation 🚧 - near :
f32
- No Documentation 🚧 - far :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
orthographic_rh_gl
Creates a right-handed orthographic projection matrix with
[-1,1]
depth range. This is the same as the OpenGLglOrtho
function in OpenGL. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glOrtho.xml Useful to map a right-handed coordinate system to the normalized device coordinates that OpenGL expects.
Arguments
- left :
f32
- No Documentation 🚧 - right :
f32
- No Documentation 🚧 - bottom :
f32
- No Documentation 🚧 - top :
f32
- No Documentation 🚧 - near :
f32
- No Documentation 🚧 - far :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
perspective_infinite_lh
Creates an infinite left-handed perspective projection matrix with
[0,1]
depth range. Likeperspective_lh
, but with an infinite value forz_far
. The result is that points nearz_near
are mapped to depth0
, and as they move towards infinity the depth approaches1
.Panics
Will panic if
z_near
orz_far
are less than or equal to zero whenglam_assert
is enabled.
Arguments
- fov_y_radians :
f32
- No Documentation 🚧 - aspect_ratio :
f32
- No Documentation 🚧 - z_near :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
perspective_infinite_reverse_lh
Creates an infinite reverse left-handed perspective projection matrix with
[0,1]
depth range. Similar toperspective_infinite_lh
, but mapsZ = z_near
to a depth of1
andZ = infinity
to a depth of0
.Panics
Will panic if
z_near
is less than or equal to zero whenglam_assert
is enabled.
Arguments
- fov_y_radians :
f32
- No Documentation 🚧 - aspect_ratio :
f32
- No Documentation 🚧 - z_near :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
perspective_infinite_reverse_rh
Creates an infinite reverse right-handed perspective projection matrix with
[0,1]
depth range. Similar toperspective_infinite_rh
, but mapsZ = z_near
to a depth of1
andZ = infinity
to a depth of0
.Panics
Will panic if
z_near
is less than or equal to zero whenglam_assert
is enabled.
Arguments
- fov_y_radians :
f32
- No Documentation 🚧 - aspect_ratio :
f32
- No Documentation 🚧 - z_near :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
perspective_infinite_rh
Creates an infinite right-handed perspective projection matrix with
[0,1]
depth range. Likeperspective_rh
, but with an infinite value forz_far
. The result is that points nearz_near
are mapped to depth0
, and as they move towards infinity the depth approaches1
.Panics
Will panic if
z_near
orz_far
are less than or equal to zero whenglam_assert
is enabled.
Arguments
- fov_y_radians :
f32
- No Documentation 🚧 - aspect_ratio :
f32
- No Documentation 🚧 - z_near :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
perspective_lh
Creates a left-handed perspective projection matrix with
[0,1]
depth range. Useful to map the standard left-handed coordinate system into what WebGPU/Metal/Direct3D expect.Panics
Will panic if
z_near
orz_far
are less than or equal to zero whenglam_assert
is enabled.
Arguments
- fov_y_radians :
f32
- No Documentation 🚧 - aspect_ratio :
f32
- No Documentation 🚧 - z_near :
f32
- No Documentation 🚧 - z_far :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
perspective_rh
Creates a right-handed perspective projection matrix with
[0,1]
depth range. Useful to map the standard right-handed coordinate system into what WebGPU/Metal/Direct3D expect.Panics
Will panic if
z_near
orz_far
are less than or equal to zero whenglam_assert
is enabled.
Arguments
- fov_y_radians :
f32
- No Documentation 🚧 - aspect_ratio :
f32
- No Documentation 🚧 - z_near :
f32
- No Documentation 🚧 - z_far :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
perspective_rh_gl
Creates a right-handed perspective projection matrix with
[-1,1]
depth range. Useful to map the standard right-handed coordinate system into what OpenGL expects. This is the same as the OpenGLgluPerspective
function. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluPerspective.xml
Arguments
- fov_y_radians :
f32
- No Documentation 🚧 - aspect_ratio :
f32
- No Documentation 🚧 - z_near :
f32
- No Documentation 🚧 - z_far :
f32
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
project_point3
Transforms the given 3D vector as a point, applying perspective correction. This is the equivalent of multiplying the 3D vector as a 4D vector where
w
is1.0
. The perspective divide is performed meaning the resulting 3D vector is divided byw
. This method assumes thatself
contains a projective transform.
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
project_point3a
Transforms the given [
Vec3A
] as a 3D point, applying perspective correction. This is the equivalent of multiplying the [Vec3A
] as a 4D vector wherew
is1.0
. The perspective divide is performed meaning the resulting 3D vector is divided byw
. This method assumes thatself
contains a projective transform.
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
row
Returns the matrix row for the given
index
.Panics
Panics if
index
is greater than 3.
Arguments
- _self :
Mat4
- No Documentation 🚧 - index :
usize
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
sub_mat4
Subtracts two 4x4 matrices.
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
to_cols_array
Creates a
[f32; 16]
array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
Mat4
- No Documentation 🚧
Returns
- arg0 :
[f32; 16]
- No Documentation 🚧
to_cols_array_2d
Creates a
[[f32; 4]; 4]
4D array storing data in column major order. If you require data in row major ordertranspose
the matrix first.
Arguments
- _self :
Mat4
- No Documentation 🚧
Returns
- arg0 :
[[f32; 4]; 4]
- No Documentation 🚧
to_euler
Extract Euler angles with the given Euler rotation order. Note if the upper 3x3 matrix contain scales, shears, or other non-rotation transformations then the resulting Euler angles will be ill-defined.
Panics
Will panic if any column of the upper 3x3 rotation matrix is not normalized when
glam_assert
is enabled.
Arguments
- _self :
Mat4
- No Documentation 🚧 - order :
EulerRot
- No Documentation 🚧
Returns
- arg0 :
(f32, f32, f32)
- No Documentation 🚧
transform_point3
Transforms the given 3D vector as a point. This is the equivalent of multiplying the 3D vector as a 4D vector where
w
is1.0
. This method assumes thatself
contains a valid affine transform. It does not perform a perspective divide, ifself
contains a perspective transform, or if you are unsure, the [Self::project_point3()
] method should be used instead.Panics
Will panic if the 3rd row of
self
is not(0, 0, 0, 1)
whenglam_assert
is enabled.
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
transform_point3a
Transforms the given [
Vec3A
] as 3D point. This is the equivalent of multiplying the [Vec3A
] as a 4D vector wherew
is1.0
.
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
transform_vector3
Transforms the give 3D vector as a direction. This is the equivalent of multiplying the 3D vector as a 4D vector where
w
is0.0
. This method assumes thatself
contains a valid affine transform.Panics
Will panic if the 3rd row of
self
is not(0, 0, 0, 1)
whenglam_assert
is enabled.
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
transform_vector3a
Transforms the give [
Vec3A
] as 3D vector. This is the equivalent of multiplying the [Vec3A
] as a 4D vector wherew
is0.0
.
Arguments
- _self :
Mat4
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
transpose
Returns the transpose of
self
.
Arguments
- _self :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Mat4
- No Documentation 🚧
Quat
Quat
- x : f32
- y : f32
- z : f32
- w : f32
Description
No Documentation 🚧
Functions
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two quaternions contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
Quat
- No Documentation 🚧 - rhs :
Quat
- No Documentation 🚧 - max_abs_diff :
f32
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
add
Adds two quaternions. The sum is not guaranteed to be normalized. Note that addition is not the same as combining the rotations represented by the two quaternions! That corresponds to multiplication.
Arguments
- _self :
Quat
- No Documentation 🚧 - rhs :
Quat
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
angle_between
Returns the angle (in radians) for the minimal rotation for transforming this quaternion into another. Both quaternions must be normalized.
Panics
Will panic if
self
orrhs
are not normalized whenglam_assert
is enabled.
Arguments
- _self :
Quat
- No Documentation 🚧 - rhs :
Quat
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
as_dquat
No Documentation 🚧
Arguments
- _self :
Quat
- No Documentation 🚧
Returns
- arg0 :
DQuat
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Quat
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
conjugate
Returns the quaternion conjugate of
self
. For a unit quaternion the conjugate is also the inverse.
Arguments
- _self :
Quat
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
div
Divides a quaternion by a scalar value. The quotient is not guaranteed to be normalized.
Arguments
- _self :
Quat
- No Documentation 🚧 - rhs :
f32
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
. The dot product is equal to the cosine of the angle between two quaternion rotations.
Arguments
- _self :
Quat
- No Documentation 🚧 - rhs :
Quat
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Quat
- No Documentation 🚧 - rhs :
Quat
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_affine3
Creates a quaternion from a 3x3 rotation matrix inside a 3D affine transform. Note if the input affine matrix contain scales, shears, or other non-rotation transformations then the resulting quaternion will be ill-defined.
Panics
Will panic if any input affine matrix column is not normalized when
glam_assert
is enabled.
Arguments
- a :
Affine3A
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
from_array
Creates a rotation quaternion from an array.
Preconditions
This function does not check if the input is normalized, it is up to the user to provide normalized input or to normalized the resulting quaternion.
Arguments
- a :
[f32; 4]
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
from_axis_angle
Create a quaternion for a normalized rotation
axis
andangle
(in radians). The axis must be a unit vector.Panics
Will panic if
axis
is not normalized whenglam_assert
is enabled.
Arguments
- axis :
Vec3
- No Documentation 🚧 - angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
from_euler
Creates a quaternion from the given Euler rotation sequence and the angles (in radians).
Arguments
- euler :
EulerRot
- No Documentation 🚧 - a :
f32
- No Documentation 🚧 - b :
f32
- No Documentation 🚧 - c :
f32
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
from_mat3
Creates a quaternion from a 3x3 rotation matrix. Note if the input matrix contain scales, shears, or other non-rotation transformations then the resulting quaternion will be ill-defined.
Panics
Will panic if any input matrix column is not normalized when
glam_assert
is enabled.
Arguments
- mat :
Mat3
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
from_mat3a
Creates a quaternion from a 3x3 SIMD aligned rotation matrix. Note if the input matrix contain scales, shears, or other non-rotation transformations then the resulting quaternion will be ill-defined.
Panics
Will panic if any input matrix column is not normalized when
glam_assert
is enabled.
Arguments
- mat :
Mat3A
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
from_mat4
Creates a quaternion from the upper 3x3 rotation matrix inside a homogeneous 4x4 matrix. Note if the upper 3x3 matrix contain scales, shears, or other non-rotation transformations then the resulting quaternion will be ill-defined.
Panics
Will panic if any column of the upper 3x3 rotation matrix is not normalized when
glam_assert
is enabled.
Arguments
- mat :
Mat4
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
from_rotation_arc
Gets the minimal rotation for transforming
from
toto
. The rotation is in the plane spanned by the two vectors. Will rotate at most 180 degrees. The inputs must be unit vectors.from_rotation_arc(from, to) * from ≈ to
. For near-singular cases (from≈to and from≈-to) the current implementation is only accurate to about 0.001 (forf32
).Panics
Will panic if
from
orto
are not normalized whenglam_assert
is enabled.
Arguments
- from :
Vec3
- No Documentation 🚧 - to :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
from_rotation_arc_2d
Gets the minimal rotation for transforming
from
toto
. The resulting rotation is around the z axis. Will rotate at most 180 degrees. The inputs must be unit vectors.from_rotation_arc_2d(from, to) * from ≈ to
. For near-singular cases (from≈to and from≈-to) the current implementation is only accurate to about 0.001 (forf32
).Panics
Will panic if
from
orto
are not normalized whenglam_assert
is enabled.
Arguments
- from :
Vec2
- No Documentation 🚧 - to :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
from_rotation_arc_colinear
Gets the minimal rotation for transforming
from
to eitherto
or-to
. This means that the resulting quaternion will rotatefrom
so that it is colinear withto
. The rotation is in the plane spanned by the two vectors. Will rotate at most 90 degrees. The inputs must be unit vectors.to.dot(from_rotation_arc_colinear(from, to) * from).abs() ≈ 1
.Panics
Will panic if
from
orto
are not normalized whenglam_assert
is enabled.
Arguments
- from :
Vec3
- No Documentation 🚧 - to :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
from_rotation_x
Creates a quaternion from the
angle
(in radians) around the x axis.
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
from_rotation_y
Creates a quaternion from the
angle
(in radians) around the y axis.
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
from_rotation_z
Creates a quaternion from the
angle
(in radians) around the z axis.
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
from_scaled_axis
Create a quaternion that rotates
v.length()
radians aroundv.normalize()
.from_scaled_axis(Vec3::ZERO)
results in the identity quaternion.
Arguments
- v :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
from_vec4
Creates a new rotation quaternion from a 4D vector.
Preconditions
This function does not check if the input is normalized, it is up to the user to provide normalized input or to normalized the resulting quaternion.
Arguments
- v :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
from_xyzw
Creates a new rotation quaternion. This should generally not be called manually unless you know what you are doing. Use one of the other constructors instead such as
identity
orfrom_axis_angle
.from_xyzw
is mostly used by unit tests andserde
deserialization.Preconditions
This function does not check if the input is normalized, it is up to the user to provide normalized input or to normalized the resulting quaternion.
Arguments
- x :
f32
- No Documentation 🚧 - y :
f32
- No Documentation 🚧 - z :
f32
- No Documentation 🚧 - w :
f32
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
inverse
Returns the inverse of a normalized quaternion. Typically quaternion inverse returns the conjugate of a normalized quaternion. Because
self
is assumed to already be unit length this method does not normalize before returning the conjugate.Panics
Will panic if
self
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Quat
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
Quat
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan
Returns
true
if any elements areNAN
.
Arguments
- _self :
Quat
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_near_identity
No Documentation 🚧
Arguments
- _self :
Quat
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_normalized
Returns whether
self
of length1.0
or not. Uses a precision threshold of1e-6
.
Arguments
- _self :
Quat
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
length
Computes the length of
self
.
Arguments
- _self :
Quat
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
- _self :
Quat
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
length_squared
Computes the squared length of
self
. This is generally faster thanlength()
as it avoids a square root operation.
Arguments
- _self :
Quat
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
lerp
Performs a linear interpolation between
self
andrhs
based on the values
. Whens
is0.0
, the result will be equal toself
. Whens
is1.0
, the result will be equal torhs
.Panics
Will panic if
self
orend
are not normalized whenglam_assert
is enabled.
Arguments
- _self :
Quat
- No Documentation 🚧 - end :
Quat
- No Documentation 🚧 - s :
f32
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
mul
Multiplies two quaternions. If they each represent a rotation, the result will represent the combined rotation. Note that due to floating point rounding the result may not be perfectly normalized.
Panics
Will panic if
self
orrhs
are not normalized whenglam_assert
is enabled.
Arguments
- _self :
Quat
- No Documentation 🚧 - rhs :
Quat
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
Quat
- No Documentation 🚧 - arg1 :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
Quat
- No Documentation 🚧 - arg1 :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
mul-3
No Documentation 🚧
Arguments
- arg0 :
Quat
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
mul_quat
Multiplies two quaternions. If they each represent a rotation, the result will represent the combined rotation. Note that due to floating point rounding the result may not be perfectly normalized.
Panics
Will panic if
self
orrhs
are not normalized whenglam_assert
is enabled.
Arguments
- _self :
Quat
- No Documentation 🚧 - rhs :
Quat
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
mul_vec3
Multiplies a quaternion and a 3D vector, returning the rotated vector.
Panics
Will panic if
self
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Quat
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
mul_vec3a
Multiplies a quaternion and a 3D vector, returning the rotated vector.
Arguments
- _self :
Quat
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
Quat
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
normalize
Returns
self
normalized to length 1.0. For valid results,self
must not be of length zero. Panics Will panic ifself
is zero length whenglam_assert
is enabled.
Arguments
- _self :
Quat
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
rotate_towards
Rotates towards
rhs
up tomax_angle
(in radians). Whenmax_angle
is0.0
, the result will be equal toself
. Whenmax_angle
is equal toself.angle_between(rhs)
, the result will be equal torhs
. Ifmax_angle
is negative, rotates towards the exact opposite ofrhs
. Will not go past the target. Both quaternions must be normalized.Panics
Will panic if
self
orrhs
are not normalized whenglam_assert
is enabled.
Arguments
- _self :
Quat
- No Documentation 🚧 - rhs :
Quat
- No Documentation 🚧 - max_angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
slerp
Performs a spherical linear interpolation between
self
andend
based on the values
. Whens
is0.0
, the result will be equal toself
. Whens
is1.0
, the result will be equal toend
.Panics
Will panic if
self
orend
are not normalized whenglam_assert
is enabled.
Arguments
- _self :
Quat
- No Documentation 🚧 - end :
Quat
- No Documentation 🚧 - s :
f32
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
sub
Subtracts the
rhs
quaternion fromself
. The difference is not guaranteed to be normalized.
Arguments
- _self :
Quat
- No Documentation 🚧 - rhs :
Quat
- No Documentation 🚧
Returns
- arg0 :
Quat
- No Documentation 🚧
to_array
[x, y, z, w]
Arguments
- _self :
Quat
- No Documentation 🚧
Returns
- arg0 :
[f32; 4]
- No Documentation 🚧
to_euler
Returns the rotation angles for the given euler rotation sequence.
Arguments
- _self :
Quat
- No Documentation 🚧 - order :
EulerRot
- No Documentation 🚧
Returns
- arg0 :
(f32, f32, f32)
- No Documentation 🚧
to_scaled_axis
Returns the rotation axis scaled by the rotation in radians.
Arguments
- _self :
Quat
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
xyz
Returns the vector part of the quaternion.
Arguments
- _self :
Quat
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
U64Vec2
U64Vec2
- x : u64
- y : u64
Description
No Documentation 🚧
Functions
add
No Documentation 🚧
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
U64Vec2
- No Documentation 🚧 - arg1 :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
U64Vec2
- No Documentation 🚧 - arg1 :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
as_dvec2
Casts all elements of
self
tof64
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
as_i64vec2
Casts all elements of
self
toi64
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
as_ivec2
Casts all elements of
self
toi32
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
as_uvec2
Casts all elements of
self
tou32
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
as_vec2
Casts all elements of
self
tof32
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
u64::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - min :
U64Vec2
- No Documentation 🚧 - max :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
U64Vec2
- No Documentation 🚧 - arg1 :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
U64Vec2
- No Documentation 🚧 - arg1 :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - other :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
extend
Creates a 3D vector from
self
and the givenz
value.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - z :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[u64; 2]
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
length_squared
Computes the squared length of
self
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
U64Vec2
- No Documentation 🚧 - arg1 :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
U64Vec2
- No Documentation 🚧 - arg1 :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
u64
- No Documentation 🚧 - y :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
U64Vec2
- No Documentation 🚧 - arg1 :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
U64Vec2
- No Documentation 🚧 - arg1 :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
saturating_add
Returns a vector containing the saturating addition of
self
andrhs
. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
saturating_add_signed
Returns a vector containing the saturating addition of
self
and signed vectorrhs
. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
saturating_div
Returns a vector containing the saturating division of
self
andrhs
. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
saturating_mul
Returns a vector containing the saturating multiplication of
self
andrhs
. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
saturating_sub
Returns a vector containing the saturating subtraction of
self
andrhs
. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec2
- No Documentation 🚧 - if_true :
U64Vec2
- No Documentation 🚧 - if_false :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
U64Vec2
- No Documentation 🚧 - arg1 :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
U64Vec2
- No Documentation 🚧 - arg1 :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
to_array
[x, y]
Arguments
- _self :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
[u64; 2]
- No Documentation 🚧
with_x
Creates a 2D vector from
self
with the given value ofx
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - x :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
with_y
Creates a 2D vector from
self
with the given value ofy
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - y :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
wrapping_add
Returns a vector containing the wrapping addition of
self
andrhs
. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
wrapping_add_signed
Returns a vector containing the wrapping addition of
self
and signed vectorrhs
. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..]
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
I64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
wrapping_div
Returns a vector containing the wrapping division of
self
andrhs
. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
wrapping_mul
Returns a vector containing the wrapping multiplication of
self
andrhs
. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
wrapping_sub
Returns a vector containing the wrapping subtraction of
self
andrhs
. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]
.
Arguments
- _self :
U64Vec2
- No Documentation 🚧 - rhs :
U64Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
U64Vec3
U64Vec3
- x : u64
- y : u64
- z : u64
Description
No Documentation 🚧
Functions
add
No Documentation 🚧
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
U64Vec3
- No Documentation 🚧 - arg1 :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
U64Vec3
- No Documentation 🚧 - arg1 :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
as_dvec3
Casts all elements of
self
tof64
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
as_i64vec3
Casts all elements of
self
toi64
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
as_ivec3
Casts all elements of
self
toi32
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
as_uvec3
Casts all elements of
self
tou32
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
as_vec3
Casts all elements of
self
tof32
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
as_vec3a
Casts all elements of
self
tof32
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
u64::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - min :
U64Vec3
- No Documentation 🚧 - max :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cross
Computes the cross product of
self
andrhs
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
U64Vec3
- No Documentation 🚧 - arg1 :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
U64Vec3
- No Documentation 🚧 - arg1 :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - other :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
extend
Creates a 4D vector from
self
and the givenw
value.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - w :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[u64; 3]
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
length_squared
Computes the squared length of
self
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
U64Vec3
- No Documentation 🚧 - arg1 :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
U64Vec3
- No Documentation 🚧 - arg1 :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
u64
- No Documentation 🚧 - y :
u64
- No Documentation 🚧 - z :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
U64Vec3
- No Documentation 🚧 - arg1 :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
U64Vec3
- No Documentation 🚧 - arg1 :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
saturating_add
Returns a vector containing the saturating addition of
self
andrhs
. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
saturating_add_signed
Returns a vector containing the saturating addition of
self
and signed vectorrhs
. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
saturating_div
Returns a vector containing the saturating division of
self
andrhs
. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
saturating_mul
Returns a vector containing the saturating multiplication of
self
andrhs
. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
saturating_sub
Returns a vector containing the saturating subtraction of
self
andrhs
. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec3
- No Documentation 🚧 - if_true :
U64Vec3
- No Documentation 🚧 - if_false :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
U64Vec3
- No Documentation 🚧 - arg1 :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
U64Vec3
- No Documentation 🚧 - arg1 :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
to_array
[x, y, z]
Arguments
- _self :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
[u64; 3]
- No Documentation 🚧
truncate
Creates a 2D vector from the
x
andy
elements ofself
, discardingz
. Truncation may also be performed by using [self.xy()
][crate::swizzles::Vec3Swizzles::xy()].
Arguments
- _self :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
with_x
Creates a 3D vector from
self
with the given value ofx
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - x :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
with_y
Creates a 3D vector from
self
with the given value ofy
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - y :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
with_z
Creates a 3D vector from
self
with the given value ofz
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - z :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
wrapping_add
Returns a vector containing the wrapping addition of
self
andrhs
. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
wrapping_add_signed
Returns a vector containing the wrapping addition of
self
and signed vectorrhs
. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..]
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
I64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
wrapping_div
Returns a vector containing the wrapping division of
self
andrhs
. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
wrapping_mul
Returns a vector containing the wrapping multiplication of
self
andrhs
. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
wrapping_sub
Returns a vector containing the wrapping subtraction of
self
andrhs
. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]
.
Arguments
- _self :
U64Vec3
- No Documentation 🚧 - rhs :
U64Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
U64Vec4
U64Vec4
- x : u64
- y : u64
- z : u64
- w : u64
Description
No Documentation 🚧
Functions
add
No Documentation 🚧
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
U64Vec4
- No Documentation 🚧 - arg1 :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
U64Vec4
- No Documentation 🚧 - arg1 :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
as_dvec4
Casts all elements of
self
tof64
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
as_i64vec4
Casts all elements of
self
toi64
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
as_ivec4
Casts all elements of
self
toi32
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
as_uvec4
Casts all elements of
self
tou32
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
as_vec4
Casts all elements of
self
tof32
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
u64::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - min :
U64Vec4
- No Documentation 🚧 - max :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
U64Vec4
- No Documentation 🚧 - arg1 :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
U64Vec4
- No Documentation 🚧 - arg1 :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - other :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[u64; 4]
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
length_squared
Computes the squared length of
self
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
u64
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
U64Vec4
- No Documentation 🚧 - arg1 :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
U64Vec4
- No Documentation 🚧 - arg1 :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
u64
- No Documentation 🚧 - y :
u64
- No Documentation 🚧 - z :
u64
- No Documentation 🚧 - w :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
U64Vec4
- No Documentation 🚧 - arg1 :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
U64Vec4
- No Documentation 🚧 - arg1 :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
saturating_add
Returns a vector containing the saturating addition of
self
andrhs
. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
saturating_add_signed
Returns a vector containing the saturating addition of
self
and signed vectorrhs
. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
saturating_div
Returns a vector containing the saturating division of
self
andrhs
. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
saturating_mul
Returns a vector containing the saturating multiplication of
self
andrhs
. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
saturating_sub
Returns a vector containing the saturating subtraction of
self
andrhs
. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec4
- No Documentation 🚧 - if_true :
U64Vec4
- No Documentation 🚧 - if_false :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
U64Vec4
- No Documentation 🚧 - arg1 :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
U64Vec4
- No Documentation 🚧 - arg1 :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
to_array
[x, y, z, w]
Arguments
- _self :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
[u64; 4]
- No Documentation 🚧
truncate
Creates a 3D vector from the
x
,y
andz
elements ofself
, discardingw
. Truncation to [U64Vec3
] may also be performed by using [self.xyz()
][crate::swizzles::Vec4Swizzles::xyz()].
Arguments
- _self :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
with_w
Creates a 4D vector from
self
with the given value ofw
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - w :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
with_x
Creates a 4D vector from
self
with the given value ofx
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - x :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
with_y
Creates a 4D vector from
self
with the given value ofy
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - y :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
with_z
Creates a 4D vector from
self
with the given value ofz
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - z :
u64
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
wrapping_add
Returns a vector containing the wrapping addition of
self
andrhs
. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
wrapping_add_signed
Returns a vector containing the wrapping addition of
self
and signed vectorrhs
. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..]
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
I64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
wrapping_div
Returns a vector containing the wrapping division of
self
andrhs
. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
wrapping_mul
Returns a vector containing the wrapping multiplication of
self
andrhs
. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
wrapping_sub
Returns a vector containing the wrapping subtraction of
self
andrhs
. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]
.
Arguments
- _self :
U64Vec4
- No Documentation 🚧 - rhs :
U64Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
UVec2
UVec2
- x : u32
- y : u32
Description
No Documentation 🚧
Functions
add
No Documentation 🚧
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
UVec2
- No Documentation 🚧 - arg1 :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
UVec2
- No Documentation 🚧 - arg1 :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
as_dvec2
Casts all elements of
self
tof64
.
Arguments
- _self :
UVec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
as_i64vec2
Casts all elements of
self
toi64
.
Arguments
- _self :
UVec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
as_ivec2
Casts all elements of
self
toi32
.
Arguments
- _self :
UVec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
as_u64vec2
Casts all elements of
self
tou64
.
Arguments
- _self :
UVec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
as_vec2
Casts all elements of
self
tof32
.
Arguments
- _self :
UVec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
UVec2
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
u32::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
UVec2
- No Documentation 🚧 - min :
UVec2
- No Documentation 🚧 - max :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
UVec2
- No Documentation 🚧 - arg1 :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
UVec2
- No Documentation 🚧 - arg1 :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
UVec2
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
UVec2
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
UVec2
- No Documentation 🚧 - other :
UVec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
extend
Creates a 3D vector from
self
and the givenz
value.
Arguments
- _self :
UVec2
- No Documentation 🚧 - z :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[u32; 2]
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
length_squared
Computes the squared length of
self
.
Arguments
- _self :
UVec2
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
UVec2
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
UVec2
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
UVec2
- No Documentation 🚧 - arg1 :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
UVec2
- No Documentation 🚧 - arg1 :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
u32
- No Documentation 🚧 - y :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
UVec2
- No Documentation 🚧 - arg1 :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
UVec2
- No Documentation 🚧 - arg1 :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
saturating_add
Returns a vector containing the saturating addition of
self
andrhs
. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]
.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
saturating_add_signed
Returns a vector containing the saturating addition of
self
and signed vectorrhs
. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]
.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
saturating_div
Returns a vector containing the saturating division of
self
andrhs
. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]
.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
saturating_mul
Returns a vector containing the saturating multiplication of
self
andrhs
. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]
.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
saturating_sub
Returns a vector containing the saturating subtraction of
self
andrhs
. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]
.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec2
- No Documentation 🚧 - if_true :
UVec2
- No Documentation 🚧 - if_false :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
UVec2
- No Documentation 🚧 - arg1 :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
UVec2
- No Documentation 🚧 - arg1 :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
to_array
[x, y]
Arguments
- _self :
UVec2
- No Documentation 🚧
Returns
- arg0 :
[u32; 2]
- No Documentation 🚧
with_x
Creates a 2D vector from
self
with the given value ofx
.
Arguments
- _self :
UVec2
- No Documentation 🚧 - x :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
with_y
Creates a 2D vector from
self
with the given value ofy
.
Arguments
- _self :
UVec2
- No Documentation 🚧 - y :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
wrapping_add
Returns a vector containing the wrapping addition of
self
andrhs
. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]
.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
wrapping_add_signed
Returns a vector containing the wrapping addition of
self
and signed vectorrhs
. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..]
.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
IVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
wrapping_div
Returns a vector containing the wrapping division of
self
andrhs
. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]
.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
wrapping_mul
Returns a vector containing the wrapping multiplication of
self
andrhs
. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]
.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
wrapping_sub
Returns a vector containing the wrapping subtraction of
self
andrhs
. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]
.
Arguments
- _self :
UVec2
- No Documentation 🚧 - rhs :
UVec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
UVec3
UVec3
- x : u32
- y : u32
- z : u32
Description
No Documentation 🚧
Functions
add
No Documentation 🚧
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
UVec3
- No Documentation 🚧 - arg1 :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
UVec3
- No Documentation 🚧 - arg1 :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
as_dvec3
Casts all elements of
self
tof64
.
Arguments
- _self :
UVec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
as_i64vec3
Casts all elements of
self
toi64
.
Arguments
- _self :
UVec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
as_ivec3
Casts all elements of
self
toi32
.
Arguments
- _self :
UVec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
as_u64vec3
Casts all elements of
self
tou64
.
Arguments
- _self :
UVec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
as_vec3
Casts all elements of
self
tof32
.
Arguments
- _self :
UVec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
as_vec3a
Casts all elements of
self
tof32
.
Arguments
- _self :
UVec3
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
UVec3
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
u32::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
UVec3
- No Documentation 🚧 - min :
UVec3
- No Documentation 🚧 - max :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cross
Computes the cross product of
self
andrhs
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
UVec3
- No Documentation 🚧 - arg1 :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
UVec3
- No Documentation 🚧 - arg1 :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
UVec3
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
UVec3
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
UVec3
- No Documentation 🚧 - other :
UVec3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
extend
Creates a 4D vector from
self
and the givenw
value.
Arguments
- _self :
UVec3
- No Documentation 🚧 - w :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[u32; 3]
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
length_squared
Computes the squared length of
self
.
Arguments
- _self :
UVec3
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
UVec3
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
UVec3
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
UVec3
- No Documentation 🚧 - arg1 :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
UVec3
- No Documentation 🚧 - arg1 :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
u32
- No Documentation 🚧 - y :
u32
- No Documentation 🚧 - z :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
UVec3
- No Documentation 🚧 - arg1 :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
UVec3
- No Documentation 🚧 - arg1 :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
saturating_add
Returns a vector containing the saturating addition of
self
andrhs
. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
saturating_add_signed
Returns a vector containing the saturating addition of
self
and signed vectorrhs
. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
saturating_div
Returns a vector containing the saturating division of
self
andrhs
. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
saturating_mul
Returns a vector containing the saturating multiplication of
self
andrhs
. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
saturating_sub
Returns a vector containing the saturating subtraction of
self
andrhs
. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec3
- No Documentation 🚧 - if_true :
UVec3
- No Documentation 🚧 - if_false :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
UVec3
- No Documentation 🚧 - arg1 :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
UVec3
- No Documentation 🚧 - arg1 :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
to_array
[x, y, z]
Arguments
- _self :
UVec3
- No Documentation 🚧
Returns
- arg0 :
[u32; 3]
- No Documentation 🚧
truncate
Creates a 2D vector from the
x
andy
elements ofself
, discardingz
. Truncation may also be performed by using [self.xy()
][crate::swizzles::Vec3Swizzles::xy()].
Arguments
- _self :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
with_x
Creates a 3D vector from
self
with the given value ofx
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - x :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
with_y
Creates a 3D vector from
self
with the given value ofy
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - y :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
with_z
Creates a 3D vector from
self
with the given value ofz
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - z :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
wrapping_add
Returns a vector containing the wrapping addition of
self
andrhs
. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
wrapping_add_signed
Returns a vector containing the wrapping addition of
self
and signed vectorrhs
. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..]
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
IVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
wrapping_div
Returns a vector containing the wrapping division of
self
andrhs
. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
wrapping_mul
Returns a vector containing the wrapping multiplication of
self
andrhs
. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
wrapping_sub
Returns a vector containing the wrapping subtraction of
self
andrhs
. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]
.
Arguments
- _self :
UVec3
- No Documentation 🚧 - rhs :
UVec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
UVec4
UVec4
- x : u32
- y : u32
- z : u32
- w : u32
Description
No Documentation 🚧
Functions
add
No Documentation 🚧
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
UVec4
- No Documentation 🚧 - arg1 :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
UVec4
- No Documentation 🚧 - arg1 :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
as_dvec4
Casts all elements of
self
tof64
.
Arguments
- _self :
UVec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
as_i64vec4
Casts all elements of
self
toi64
.
Arguments
- _self :
UVec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
as_ivec4
Casts all elements of
self
toi32
.
Arguments
- _self :
UVec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
as_u64vec4
Casts all elements of
self
tou64
.
Arguments
- _self :
UVec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
as_vec4
Casts all elements of
self
tof32
.
Arguments
- _self :
UVec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
UVec4
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
u32::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
UVec4
- No Documentation 🚧 - min :
UVec4
- No Documentation 🚧 - max :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
BVec4
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
UVec4
- No Documentation 🚧 - arg1 :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
UVec4
- No Documentation 🚧 - arg1 :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
UVec4
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
UVec4
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
UVec4
- No Documentation 🚧 - other :
UVec4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[u32; 4]
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
length_squared
Computes the squared length of
self
.
Arguments
- _self :
UVec4
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
UVec4
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
UVec4
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
UVec4
- No Documentation 🚧 - arg1 :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
UVec4
- No Documentation 🚧 - arg1 :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
u32
- No Documentation 🚧 - y :
u32
- No Documentation 🚧 - z :
u32
- No Documentation 🚧 - w :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
UVec4
- No Documentation 🚧 - arg1 :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
UVec4
- No Documentation 🚧 - arg1 :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
saturating_add
Returns a vector containing the saturating addition of
self
andrhs
. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
saturating_add_signed
Returns a vector containing the saturating addition of
self
and signed vectorrhs
. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
saturating_div
Returns a vector containing the saturating division of
self
andrhs
. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
saturating_mul
Returns a vector containing the saturating multiplication of
self
andrhs
. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
saturating_sub
Returns a vector containing the saturating subtraction of
self
andrhs
. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec4
- No Documentation 🚧 - if_true :
UVec4
- No Documentation 🚧 - if_false :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
UVec4
- No Documentation 🚧 - arg1 :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
UVec4
- No Documentation 🚧 - arg1 :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
to_array
[x, y, z, w]
Arguments
- _self :
UVec4
- No Documentation 🚧
Returns
- arg0 :
[u32; 4]
- No Documentation 🚧
truncate
Creates a 3D vector from the
x
,y
andz
elements ofself
, discardingw
. Truncation to [UVec3
] may also be performed by using [self.xyz()
][crate::swizzles::Vec4Swizzles::xyz()].
Arguments
- _self :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
with_w
Creates a 4D vector from
self
with the given value ofw
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - w :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
with_x
Creates a 4D vector from
self
with the given value ofx
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - x :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
with_y
Creates a 4D vector from
self
with the given value ofy
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - y :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
with_z
Creates a 4D vector from
self
with the given value ofz
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - z :
u32
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
wrapping_add
Returns a vector containing the wrapping addition of
self
andrhs
. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
wrapping_add_signed
Returns a vector containing the wrapping addition of
self
and signed vectorrhs
. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..]
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
IVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
wrapping_div
Returns a vector containing the wrapping division of
self
andrhs
. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
wrapping_mul
Returns a vector containing the wrapping multiplication of
self
andrhs
. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
wrapping_sub
Returns a vector containing the wrapping subtraction of
self
andrhs
. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]
.
Arguments
- _self :
UVec4
- No Documentation 🚧 - rhs :
UVec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
Vec2
Vec2
- x : f32
- y : f32
Description
No Documentation 🚧
Functions
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two vectors contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧 - max_abs_diff :
f32
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
Vec2
- No Documentation 🚧 - arg1 :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
Vec2
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
angle_between
No Documentation 🚧
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
angle_to
Returns the angle of rotation (in radians) from
self
torhs
in the range[-π, +π]
. The inputs do not need to be unit vectors however they must be non-zero.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
as_dvec2
Casts all elements of
self
tof64
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
DVec2
- No Documentation 🚧
as_i64vec2
Casts all elements of
self
toi64
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
I64Vec2
- No Documentation 🚧
as_ivec2
Casts all elements of
self
toi32
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
IVec2
- No Documentation 🚧
as_u64vec2
Casts all elements of
self
tou64
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
U64Vec2
- No Documentation 🚧
as_uvec2
Casts all elements of
self
tou32
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
UVec2
- No Documentation 🚧
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
f32::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
Vec2
- No Documentation 🚧 - min :
Vec2
- No Documentation 🚧 - max :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
clamp_length
Returns a vector with a length no less than
min
and no more thanmax
.Panics
Will panic if
min
is greater thanmax
, or if eithermin
ormax
is negative, whenglam_assert
is enabled.
Arguments
- _self :
Vec2
- No Documentation 🚧 - min :
f32
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
clamp_length_max
Returns a vector with a length no more than
max
.Panics
Will panic if
max
is negative whenglam_assert
is enabled.
Arguments
- _self :
Vec2
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
clamp_length_min
Returns a vector with a length no less than
min
.Panics
Will panic if
min
is negative whenglam_assert
is enabled.
Arguments
- _self :
Vec2
- No Documentation 🚧 - min :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
copysign
Returns a vector with signs of
rhs
and the magnitudes ofself
.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
distance
Computes the Euclidean distance between two points in space.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
Vec2
- No Documentation 🚧 - arg1 :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
Vec2
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Vec2
- No Documentation 🚧 - other :
Vec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
exp
Returns a vector containing
e^self
(the exponential function) for each element ofself
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
extend
Creates a 3D vector from
self
and the givenz
value.
Arguments
- _self :
Vec2
- No Documentation 🚧 - z :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
fract
Returns a vector containing the fractional part of the vector as
self - self.trunc()
. Note that this differs from the GLSL implementation offract
which returnsself - self.floor()
. Note that this is fast but not precise for large numbers.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
fract_gl
Returns a vector containing the fractional part of the vector as
self - self.floor()
. Note that this differs from the Rust implementation offract
which returnsself - self.trunc()
. Note that this is fast but not precise for large numbers.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
from_angle
Creates a 2D vector containing
[angle.cos(), angle.sin()]
. This can be used in conjunction with the [rotate()
][Self::rotate()] method, e.g.Vec2::from_angle(PI).rotate(Vec2::Y)
will create the vector[-1, 0]
and rotate [Vec2::Y
] around it returning-Vec2::Y
.
Arguments
- angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[f32; 2]
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_finite_mask
Performs
is_finite
on each element of self, returning a vector mask of the results. In other words, this computes[x.is_finite(), y.is_finite(), ...]
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan_mask
Performs
is_nan
on each element of self, returning a vector mask of the results. In other words, this computes[x.is_nan(), y.is_nan(), ...]
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
BVec2
- No Documentation 🚧
is_negative_bitmask
Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of
self
. A negative element results in a1
bit and a positive element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
is_normalized
Returns whether
self
is length1.0
or not. Uses a precision threshold of approximately1e-4
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
length
Computes the length of
self
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
length_squared
Computes the squared length of
self
. This is faster thanlength()
as it avoids a square root operation.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
lerp
Performs a linear interpolation between
self
andrhs
based on the values
. Whens
is0.0
, the result will be equal toself
. Whens
is1.0
, the result will be equal torhs
. Whens
is outside of range[0, 1]
, the result is linearly extrapolated.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧 - s :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
midpoint
Calculates the midpoint between
self
andrhs
. The midpoint is the average of, or halfway point between, two vectors.a.midpoint(b)
should yield the same result asa.lerp(b, 0.5)
while being slightly cheaper to compute.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
move_towards
Moves towards
rhs
based on the valued
. Whend
is0.0
, the result will be equal toself
. Whend
is equal toself.distance(rhs)
, the result will be equal torhs
. Will not go pastrhs
.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧 - d :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
Vec2
- No Documentation 🚧 - arg1 :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
Vec2
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
mul_add
Fused multiply-add. Computes
(self * a) + b
element-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Usingmul_add
may be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind.
Arguments
- _self :
Vec2
- No Documentation 🚧 - a :
Vec2
- No Documentation 🚧 - b :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
f32
- No Documentation 🚧 - y :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
normalize
Returns
self
normalized to length 1.0. For valid results,self
must be finite and not of length zero, nor very close to zero. See also [Self::try_normalize()
] and [Self::normalize_or_zero()
]. Panics Will panic if the resulting normalized vector is not finite whenglam_assert
is enabled.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
normalize_or
Returns
self
normalized to length 1.0 if possible, else returns a fallback value. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be the fallback value. See also [Self::try_normalize()
].
Arguments
- _self :
Vec2
- No Documentation 🚧 - fallback :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
normalize_or_zero
Returns
self
normalized to length 1.0 if possible, else returns zero. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be zero. See also [Self::try_normalize()
].
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
perp
Returns a vector that is equal to
self
rotated by 90 degrees.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
perp_dot
The perpendicular dot product of
self
andrhs
. Also known as the wedge product, 2D cross product, and determinant.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
powf
Returns a vector containing each element of
self
raised to the power ofn
.
Arguments
- _self :
Vec2
- No Documentation 🚧 - n :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
project_onto
Returns the vector projection of
self
ontorhs
.rhs
must be of non-zero length.Panics
Will panic if
rhs
is zero length whenglam_assert
is enabled.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
project_onto_normalized
Returns the vector projection of
self
ontorhs
.rhs
must be normalized.Panics
Will panic if
rhs
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
recip
Returns a vector containing the reciprocal
1.0/n
of each element ofself
.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
reflect
Returns the reflection vector for a given incident vector
self
and surface normalnormal
.normal
must be normalized.Panics
Will panic if
normal
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec2
- No Documentation 🚧 - normal :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
refract
Returns the refraction direction for a given incident vector
self
, surface normalnormal
and ratio of indices of refraction,eta
. When total internal reflection occurs, a zero vector will be returned.self
andnormal
must be normalized.Panics
Will panic if
self
ornormal
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec2
- No Documentation 🚧 - normal :
Vec2
- No Documentation 🚧 - eta :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
reject_from
Returns the vector rejection of
self
fromrhs
. The vector rejection is the vector perpendicular to the projection ofself
ontorhs
, in rhs words the result ofself - self.project_onto(rhs)
.rhs
must be of non-zero length.Panics
Will panic if
rhs
has a length of zero whenglam_assert
is enabled.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
reject_from_normalized
Returns the vector rejection of
self
fromrhs
. The vector rejection is the vector perpendicular to the projection ofself
ontorhs
, in rhs words the result ofself - self.project_onto(rhs)
.rhs
must be normalized.Panics
Will panic if
rhs
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
Vec2
- No Documentation 🚧 - arg1 :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
Vec2
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
. [Euclidean division]: f32::rem_euclid
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
rotate
Returns
rhs
rotated by the angle ofself
. Ifself
is normalized, then this just rotation. This is what you usually want. Otherwise, it will be like a rotation with a multiplication byself
's length.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
rotate_towards
Rotates towards
rhs
up tomax_angle
(in radians). Whenmax_angle
is0.0
, the result will be equal toself
. Whenmax_angle
is equal toself.angle_between(rhs)
, the result will be equal torhs
. Ifmax_angle
is negative, rotates towards the exact opposite ofrhs
. Will not go past the target.
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧 - max_angle :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
round
Returns a vector containing the nearest integer to a number for each element of
self
. Round half-way cases away from 0.0.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec2
- No Documentation 🚧 - if_true :
Vec2
- No Documentation 🚧 - if_false :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
signum
Returns a vector with elements representing the sign of
self
.
1.0
if the number is positive,+0.0
orINFINITY
-1.0
if the number is negative,-0.0
orNEG_INFINITY
NAN
if the number isNAN
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
Vec2
- No Documentation 🚧 - rhs :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
Vec2
- No Documentation 🚧 - arg1 :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
Vec2
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
to_angle
Returns the angle (in radians) of this vector in the range
[-π, +π]
. The input does not need to be a unit vector however it must be non-zero.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
to_array
[x, y]
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
[f32; 2]
- No Documentation 🚧
trunc
Returns a vector containing the integer part each element of
self
. This means numbers are always truncated towards zero.
Arguments
- _self :
Vec2
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
with_x
Creates a 2D vector from
self
with the given value ofx
.
Arguments
- _self :
Vec2
- No Documentation 🚧 - x :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
with_y
Creates a 2D vector from
self
with the given value ofy
.
Arguments
- _self :
Vec2
- No Documentation 🚧 - y :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
Vec3
Vec3
- x : f32
- y : f32
- z : f32
Description
No Documentation 🚧
Functions
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two vectors contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧 - max_abs_diff :
f32
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
Vec3
- No Documentation 🚧 - arg1 :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
Vec3
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
angle_between
Returns the angle (in radians) between two vectors in the range
[0, +π]
. The inputs do not need to be unit vectors however they must be non-zero.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
any_orthogonal_vector
Returns some vector that is orthogonal to the given one. The input vector must be finite and non-zero. The output vector is not necessarily unit length. For that use [
Self::any_orthonormal_vector()
] instead.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
any_orthonormal_vector
Returns any unit vector that is orthogonal to the given one. The input vector must be unit length.
Panics
Will panic if
self
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
as_dvec3
Casts all elements of
self
tof64
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
as_i64vec3
Casts all elements of
self
toi64
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
as_ivec3
Casts all elements of
self
toi32
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
as_u64vec3
Casts all elements of
self
tou64
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
as_uvec3
Casts all elements of
self
tou32
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
f32::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
Vec3
- No Documentation 🚧 - min :
Vec3
- No Documentation 🚧 - max :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
clamp_length
Returns a vector with a length no less than
min
and no more thanmax
.Panics
Will panic if
min
is greater thanmax
, or if eithermin
ormax
is negative, whenglam_assert
is enabled.
Arguments
- _self :
Vec3
- No Documentation 🚧 - min :
f32
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
clamp_length_max
Returns a vector with a length no more than
max
.Panics
Will panic if
max
is negative whenglam_assert
is enabled.
Arguments
- _self :
Vec3
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
clamp_length_min
Returns a vector with a length no less than
min
.Panics
Will panic if
min
is negative whenglam_assert
is enabled.
Arguments
- _self :
Vec3
- No Documentation 🚧 - min :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
copysign
Returns a vector with signs of
rhs
and the magnitudes ofself
.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
cross
Computes the cross product of
self
andrhs
.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
distance
Computes the Euclidean distance between two points in space.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
Vec3
- No Documentation 🚧 - arg1 :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
Vec3
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Vec3
- No Documentation 🚧 - other :
Vec3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
exp
Returns a vector containing
e^self
(the exponential function) for each element ofself
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
extend
Creates a 4D vector from
self
and the givenw
value.
Arguments
- _self :
Vec3
- No Documentation 🚧 - w :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
fract
Returns a vector containing the fractional part of the vector as
self - self.trunc()
. Note that this differs from the GLSL implementation offract
which returnsself - self.floor()
. Note that this is fast but not precise for large numbers.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
fract_gl
Returns a vector containing the fractional part of the vector as
self - self.floor()
. Note that this differs from the Rust implementation offract
which returnsself - self.trunc()
. Note that this is fast but not precise for large numbers.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[f32; 3]
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_finite_mask
Performs
is_finite
on each element of self, returning a vector mask of the results. In other words, this computes[x.is_finite(), y.is_finite(), ...]
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan_mask
Performs
is_nan
on each element of self, returning a vector mask of the results. In other words, this computes[x.is_nan(), y.is_nan(), ...]
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
BVec3
- No Documentation 🚧
is_negative_bitmask
Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of
self
. A negative element results in a1
bit and a positive element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
is_normalized
Returns whether
self
is length1.0
or not. Uses a precision threshold of approximately1e-4
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
length
Computes the length of
self
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
length_squared
Computes the squared length of
self
. This is faster thanlength()
as it avoids a square root operation.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
lerp
Performs a linear interpolation between
self
andrhs
based on the values
. Whens
is0.0
, the result will be equal toself
. Whens
is1.0
, the result will be equal torhs
. Whens
is outside of range[0, 1]
, the result is linearly extrapolated.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧 - s :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
midpoint
Calculates the midpoint between
self
andrhs
. The midpoint is the average of, or halfway point between, two vectors.a.midpoint(b)
should yield the same result asa.lerp(b, 0.5)
while being slightly cheaper to compute.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
move_towards
Moves towards
rhs
based on the valued
. Whend
is0.0
, the result will be equal toself
. Whend
is equal toself.distance(rhs)
, the result will be equal torhs
. Will not go pastrhs
.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧 - d :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
Vec3
- No Documentation 🚧 - arg1 :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
Vec3
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
mul_add
Fused multiply-add. Computes
(self * a) + b
element-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Usingmul_add
may be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind.
Arguments
- _self :
Vec3
- No Documentation 🚧 - a :
Vec3
- No Documentation 🚧 - b :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
f32
- No Documentation 🚧 - y :
f32
- No Documentation 🚧 - z :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
normalize
Returns
self
normalized to length 1.0. For valid results,self
must be finite and not of length zero, nor very close to zero. See also [Self::try_normalize()
] and [Self::normalize_or_zero()
]. Panics Will panic if the resulting normalized vector is not finite whenglam_assert
is enabled.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
normalize_or
Returns
self
normalized to length 1.0 if possible, else returns a fallback value. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be the fallback value. See also [Self::try_normalize()
].
Arguments
- _self :
Vec3
- No Documentation 🚧 - fallback :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
normalize_or_zero
Returns
self
normalized to length 1.0 if possible, else returns zero. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be zero. See also [Self::try_normalize()
].
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
powf
Returns a vector containing each element of
self
raised to the power ofn
.
Arguments
- _self :
Vec3
- No Documentation 🚧 - n :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
project_onto
Returns the vector projection of
self
ontorhs
.rhs
must be of non-zero length.Panics
Will panic if
rhs
is zero length whenglam_assert
is enabled.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
project_onto_normalized
Returns the vector projection of
self
ontorhs
.rhs
must be normalized.Panics
Will panic if
rhs
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
recip
Returns a vector containing the reciprocal
1.0/n
of each element ofself
.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
reflect
Returns the reflection vector for a given incident vector
self
and surface normalnormal
.normal
must be normalized.Panics
Will panic if
normal
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec3
- No Documentation 🚧 - normal :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
refract
Returns the refraction direction for a given incident vector
self
, surface normalnormal
and ratio of indices of refraction,eta
. When total internal reflection occurs, a zero vector will be returned.self
andnormal
must be normalized.Panics
Will panic if
self
ornormal
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec3
- No Documentation 🚧 - normal :
Vec3
- No Documentation 🚧 - eta :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
reject_from
Returns the vector rejection of
self
fromrhs
. The vector rejection is the vector perpendicular to the projection ofself
ontorhs
, in rhs words the result ofself - self.project_onto(rhs)
.rhs
must be of non-zero length.Panics
Will panic if
rhs
has a length of zero whenglam_assert
is enabled.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
reject_from_normalized
Returns the vector rejection of
self
fromrhs
. The vector rejection is the vector perpendicular to the projection ofself
ontorhs
, in rhs words the result ofself - self.project_onto(rhs)
.rhs
must be normalized.Panics
Will panic if
rhs
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
Vec3
- No Documentation 🚧 - arg1 :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
Vec3
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
. [Euclidean division]: f32::rem_euclid
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
round
Returns a vector containing the nearest integer to a number for each element of
self
. Round half-way cases away from 0.0.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec3
- No Documentation 🚧 - if_true :
Vec3
- No Documentation 🚧 - if_false :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
signum
Returns a vector with elements representing the sign of
self
.
1.0
if the number is positive,+0.0
orINFINITY
-1.0
if the number is negative,-0.0
orNEG_INFINITY
NAN
if the number isNAN
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
Vec3
- No Documentation 🚧 - rhs :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
Vec3
- No Documentation 🚧 - arg1 :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
Vec3
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
to_array
[x, y, z]
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
[f32; 3]
- No Documentation 🚧
trunc
Returns a vector containing the integer part each element of
self
. This means numbers are always truncated towards zero.
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
truncate
Creates a 2D vector from the
x
andy
elements ofself
, discardingz
. Truncation may also be performed by using [self.xy()
][crate::swizzles::Vec3Swizzles::xy()].
Arguments
- _self :
Vec3
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
with_x
Creates a 3D vector from
self
with the given value ofx
.
Arguments
- _self :
Vec3
- No Documentation 🚧 - x :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
with_y
Creates a 3D vector from
self
with the given value ofy
.
Arguments
- _self :
Vec3
- No Documentation 🚧 - y :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
with_z
Creates a 3D vector from
self
with the given value ofz
.
Arguments
- _self :
Vec3
- No Documentation 🚧 - z :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
Vec3A
Vec3A
- x : f32
- y : f32
- z : f32
Description
No Documentation 🚧
Functions
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two vectors contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧 - max_abs_diff :
f32
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
Vec3A
- No Documentation 🚧 - arg1 :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
Vec3A
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
angle_between
Returns the angle (in radians) between two vectors in the range
[0, +π]
. The inputs do not need to be unit vectors however they must be non-zero.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
any_orthogonal_vector
Returns some vector that is orthogonal to the given one. The input vector must be finite and non-zero. The output vector is not necessarily unit length. For that use [
Self::any_orthonormal_vector()
] instead.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
any_orthonormal_vector
Returns any unit vector that is orthogonal to the given one. The input vector must be unit length.
Panics
Will panic if
self
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
as_dvec3
Casts all elements of
self
tof64
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
DVec3
- No Documentation 🚧
as_i64vec3
Casts all elements of
self
toi64
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
I64Vec3
- No Documentation 🚧
as_ivec3
Casts all elements of
self
toi32
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
IVec3
- No Documentation 🚧
as_u64vec3
Casts all elements of
self
tou64
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
U64Vec3
- No Documentation 🚧
as_uvec3
Casts all elements of
self
tou32
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
UVec3
- No Documentation 🚧
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
f32::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - min :
Vec3A
- No Documentation 🚧 - max :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
clamp_length
Returns a vector with a length no less than
min
and no more thanmax
.Panics
Will panic if
min
is greater thanmax
, or if eithermin
ormax
is negative, whenglam_assert
is enabled.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - min :
f32
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
clamp_length_max
Returns a vector with a length no more than
max
.Panics
Will panic if
max
is negative whenglam_assert
is enabled.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
clamp_length_min
Returns a vector with a length no less than
min
.Panics
Will panic if
min
is negative whenglam_assert
is enabled.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - min :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
BVec3A
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
BVec3A
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
BVec3A
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
BVec3A
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
BVec3A
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
BVec3A
- No Documentation 🚧
copysign
Returns a vector with signs of
rhs
and the magnitudes ofself
.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
cross
Computes the cross product of
self
andrhs
.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
distance
Computes the Euclidean distance between two points in space.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
Vec3A
- No Documentation 🚧 - arg1 :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
Vec3A
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
exp
Returns a vector containing
e^self
(the exponential function) for each element ofself
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
extend
Creates a 4D vector from
self
and the givenw
value.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - w :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
fract
Returns a vector containing the fractional part of the vector as
self - self.trunc()
. Note that this differs from the GLSL implementation offract
which returnsself - self.floor()
. Note that this is fast but not precise for large numbers.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
fract_gl
Returns a vector containing the fractional part of the vector as
self - self.floor()
. Note that this differs from the Rust implementation offract
which returnsself - self.trunc()
. Note that this is fast but not precise for large numbers.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[f32; 3]
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
from_vec4
Creates a [
Vec3A
] from thex
,y
andz
elements ofself
discardingw
. On architectures where SIMD is supported such as SSE2 onx86_64
this conversion is a noop.
Arguments
- v :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_finite_mask
Performs
is_finite
on each element of self, returning a vector mask of the results. In other words, this computes[x.is_finite(), y.is_finite(), ...]
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
BVec3A
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan_mask
Performs
is_nan
on each element of self, returning a vector mask of the results. In other words, this computes[x.is_nan(), y.is_nan(), ...]
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
BVec3A
- No Documentation 🚧
is_negative_bitmask
Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of
self
. A negative element results in a1
bit and a positive element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
is_normalized
Returns whether
self
is length1.0
or not. Uses a precision threshold of approximately1e-4
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
length
Computes the length of
self
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
length_squared
Computes the squared length of
self
. This is faster thanlength()
as it avoids a square root operation.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
lerp
Performs a linear interpolation between
self
andrhs
based on the values
. Whens
is0.0
, the result will be equal toself
. Whens
is1.0
, the result will be equal torhs
. Whens
is outside of range[0, 1]
, the result is linearly extrapolated.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧 - s :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
midpoint
Calculates the midpoint between
self
andrhs
. The midpoint is the average of, or halfway point between, two vectors.a.midpoint(b)
should yield the same result asa.lerp(b, 0.5)
while being slightly cheaper to compute.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
move_towards
Moves towards
rhs
based on the valued
. Whend
is0.0
, the result will be equal toself
. Whend
is equal toself.distance(rhs)
, the result will be equal torhs
. Will not go pastrhs
.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧 - d :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
Vec3A
- No Documentation 🚧 - arg1 :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
Vec3A
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
mul_add
Fused multiply-add. Computes
(self * a) + b
element-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Usingmul_add
may be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - a :
Vec3A
- No Documentation 🚧 - b :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
f32
- No Documentation 🚧 - y :
f32
- No Documentation 🚧 - z :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
normalize
Returns
self
normalized to length 1.0. For valid results,self
must be finite and not of length zero, nor very close to zero. See also [Self::try_normalize()
] and [Self::normalize_or_zero()
]. Panics Will panic if the resulting normalized vector is not finite whenglam_assert
is enabled.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
normalize_or
Returns
self
normalized to length 1.0 if possible, else returns a fallback value. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be the fallback value. See also [Self::try_normalize()
].
Arguments
- _self :
Vec3A
- No Documentation 🚧 - fallback :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
normalize_or_zero
Returns
self
normalized to length 1.0 if possible, else returns zero. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be zero. See also [Self::try_normalize()
].
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
powf
Returns a vector containing each element of
self
raised to the power ofn
.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - n :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
project_onto
Returns the vector projection of
self
ontorhs
.rhs
must be of non-zero length.Panics
Will panic if
rhs
is zero length whenglam_assert
is enabled.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
project_onto_normalized
Returns the vector projection of
self
ontorhs
.rhs
must be normalized.Panics
Will panic if
rhs
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
recip
Returns a vector containing the reciprocal
1.0/n
of each element ofself
.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
reflect
Returns the reflection vector for a given incident vector
self
and surface normalnormal
.normal
must be normalized.Panics
Will panic if
normal
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - normal :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
refract
Returns the refraction direction for a given incident vector
self
, surface normalnormal
and ratio of indices of refraction,eta
. When total internal reflection occurs, a zero vector will be returned.self
andnormal
must be normalized.Panics
Will panic if
self
ornormal
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - normal :
Vec3A
- No Documentation 🚧 - eta :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
reject_from
Returns the vector rejection of
self
fromrhs
. The vector rejection is the vector perpendicular to the projection ofself
ontorhs
, in rhs words the result ofself - self.project_onto(rhs)
.rhs
must be of non-zero length.Panics
Will panic if
rhs
has a length of zero whenglam_assert
is enabled.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
reject_from_normalized
Returns the vector rejection of
self
fromrhs
. The vector rejection is the vector perpendicular to the projection ofself
ontorhs
, in rhs words the result ofself - self.project_onto(rhs)
.rhs
must be normalized.Panics
Will panic if
rhs
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
Vec3A
- No Documentation 🚧 - arg1 :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
Vec3A
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
. [Euclidean division]: f32::rem_euclid
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
round
Returns a vector containing the nearest integer to a number for each element of
self
. Round half-way cases away from 0.0.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec3A
- No Documentation 🚧 - if_true :
Vec3A
- No Documentation 🚧 - if_false :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
signum
Returns a vector with elements representing the sign of
self
.
1.0
if the number is positive,+0.0
orINFINITY
-1.0
if the number is negative,-0.0
orNEG_INFINITY
NAN
if the number isNAN
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
Vec3A
- No Documentation 🚧 - rhs :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
Vec3A
- No Documentation 🚧 - arg1 :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
Vec3A
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
to_array
[x, y, z]
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
[f32; 3]
- No Documentation 🚧
trunc
Returns a vector containing the integer part each element of
self
. This means numbers are always truncated towards zero.
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
truncate
Creates a 2D vector from the
x
andy
elements ofself
, discardingz
. Truncation may also be performed by using [self.xy()
][crate::swizzles::Vec3Swizzles::xy()].
Arguments
- _self :
Vec3A
- No Documentation 🚧
Returns
- arg0 :
Vec2
- No Documentation 🚧
with_x
Creates a 3D vector from
self
with the given value ofx
.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - x :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
with_y
Creates a 3D vector from
self
with the given value ofy
.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - y :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
with_z
Creates a 3D vector from
self
with the given value ofz
.
Arguments
- _self :
Vec3A
- No Documentation 🚧 - z :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec3A
- No Documentation 🚧
Vec4
Vec4
- x : f32
- y : f32
- z : f32
- w : f32
Description
No Documentation 🚧
Functions
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
abs_diff_eq
Returns true if the absolute difference of all elements between
self
andrhs
is less than or equal tomax_abs_diff
. This can be used to compare if two vectors contain similar elements. It works best when comparing with a known value. Themax_abs_diff
that should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧 - max_abs_diff :
f32
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
add
No Documentation 🚧
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
add-1
No Documentation 🚧
Arguments
- arg0 :
Vec4
- No Documentation 🚧 - arg1 :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
add-2
No Documentation 🚧
Arguments
- arg0 :
Vec4
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
as_dvec4
Casts all elements of
self
tof64
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
DVec4
- No Documentation 🚧
as_i64vec4
Casts all elements of
self
toi64
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
I64Vec4
- No Documentation 🚧
as_ivec4
Casts all elements of
self
toi32
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
IVec4
- No Documentation 🚧
as_u64vec4
Casts all elements of
self
tou64
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
U64Vec4
- No Documentation 🚧
as_uvec4
Casts all elements of
self
tou32
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
UVec4
- No Documentation 🚧
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
clamp
Component-wise clamping of values, similar to [
f32::clamp
]. Each element inmin
must be less-or-equal to the corresponding element inmax
.Panics
Will panic if
min
is greater thanmax
whenglam_assert
is enabled.
Arguments
- _self :
Vec4
- No Documentation 🚧 - min :
Vec4
- No Documentation 🚧 - max :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
clamp_length
Returns a vector with a length no less than
min
and no more thanmax
.Panics
Will panic if
min
is greater thanmax
, or if eithermin
ormax
is negative, whenglam_assert
is enabled.
Arguments
- _self :
Vec4
- No Documentation 🚧 - min :
f32
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
clamp_length_max
Returns a vector with a length no more than
max
.Panics
Will panic if
max
is negative whenglam_assert
is enabled.
Arguments
- _self :
Vec4
- No Documentation 🚧 - max :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
clamp_length_min
Returns a vector with a length no less than
min
.Panics
Will panic if
min
is negative whenglam_assert
is enabled.
Arguments
- _self :
Vec4
- No Documentation 🚧 - min :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
cmpeq
Returns a vector mask containing the result of a
==
comparison for each element ofself
andrhs
. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]
for all elements.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4A
- No Documentation 🚧
cmpge
Returns a vector mask containing the result of a
>=
comparison for each element ofself
andrhs
. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]
for all elements.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4A
- No Documentation 🚧
cmpgt
Returns a vector mask containing the result of a
>
comparison for each element ofself
andrhs
. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]
for all elements.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4A
- No Documentation 🚧
cmple
Returns a vector mask containing the result of a
<=
comparison for each element ofself
andrhs
. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]
for all elements.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4A
- No Documentation 🚧
cmplt
Returns a vector mask containing the result of a
<
comparison for each element ofself
andrhs
. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]
for all elements.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4A
- No Documentation 🚧
cmpne
Returns a vector mask containing the result of a
!=
comparison for each element ofself
andrhs
. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]
for all elements.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4A
- No Documentation 🚧
copysign
Returns a vector with signs of
rhs
and the magnitudes ofself
.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
distance
Computes the Euclidean distance between two points in space.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
div
No Documentation 🚧
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
div-1
No Documentation 🚧
Arguments
- arg0 :
Vec4
- No Documentation 🚧 - arg1 :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
div-2
No Documentation 🚧
Arguments
- arg0 :
Vec4
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
dot
Computes the dot product of
self
andrhs
.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
exp
Returns a vector containing
e^self
(the exponential function) for each element ofself
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
fract
Returns a vector containing the fractional part of the vector as
self - self.trunc()
. Note that this differs from the GLSL implementation offract
which returnsself - self.floor()
. Note that this is fast but not precise for large numbers.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
fract_gl
Returns a vector containing the fractional part of the vector as
self - self.floor()
. Note that this differs from the Rust implementation offract
which returnsself - self.trunc()
. Note that this is fast but not precise for large numbers.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
from_array
Creates a new vector from an array.
Arguments
- a :
[f32; 4]
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
is_finite
Returns
true
if, and only if, all elements are finite. If any element is eitherNaN
, positive or negative infinity, this will returnfalse
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_finite_mask
Performs
is_finite
on each element of self, returning a vector mask of the results. In other words, this computes[x.is_finite(), y.is_finite(), ...]
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4A
- No Documentation 🚧
is_nan
Returns
true
if any elements areNaN
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nan_mask
Performs
is_nan
on each element of self, returning a vector mask of the results. In other words, this computes[x.is_nan(), y.is_nan(), ...]
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
BVec4A
- No Documentation 🚧
is_negative_bitmask
Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of
self
. A negative element results in a1
bit and a positive element in a0
bit. Elementx
goes into the first lowest bit, elementy
into the second, etc.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
u32
- No Documentation 🚧
is_normalized
Returns whether
self
is length1.0
or not. Uses a precision threshold of approximately1e-4
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
length
Computes the length of
self
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
length_squared
Computes the squared length of
self
. This is faster thanlength()
as it avoids a square root operation.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
lerp
Performs a linear interpolation between
self
andrhs
based on the values
. Whens
is0.0
, the result will be equal toself
. Whens
is1.0
, the result will be equal torhs
. Whens
is outside of range[0, 1]
, the result is linearly extrapolated.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧 - s :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
max
Returns a vector containing the maximum values for each element of
self
andrhs
. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..]
.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
midpoint
Calculates the midpoint between
self
andrhs
. The midpoint is the average of, or halfway point between, two vectors.a.midpoint(b)
should yield the same result asa.lerp(b, 0.5)
while being slightly cheaper to compute.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
min
Returns a vector containing the minimum values for each element of
self
andrhs
. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..]
.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
f32
- No Documentation 🚧
move_towards
Moves towards
rhs
based on the valued
. Whend
is0.0
, the result will be equal toself
. Whend
is equal toself.distance(rhs)
, the result will be equal torhs
. Will not go pastrhs
.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧 - d :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
mul
No Documentation 🚧
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
mul-1
No Documentation 🚧
Arguments
- arg0 :
Vec4
- No Documentation 🚧 - arg1 :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
mul-2
No Documentation 🚧
Arguments
- arg0 :
Vec4
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
mul_add
Fused multiply-add. Computes
(self * a) + b
element-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Usingmul_add
may be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind.
Arguments
- _self :
Vec4
- No Documentation 🚧 - a :
Vec4
- No Documentation 🚧 - b :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
neg
No Documentation 🚧
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
new
Creates a new vector.
Arguments
- x :
f32
- No Documentation 🚧 - y :
f32
- No Documentation 🚧 - z :
f32
- No Documentation 🚧 - w :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
normalize
Returns
self
normalized to length 1.0. For valid results,self
must be finite and not of length zero, nor very close to zero. See also [Self::try_normalize()
] and [Self::normalize_or_zero()
]. Panics Will panic if the resulting normalized vector is not finite whenglam_assert
is enabled.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
normalize_or
Returns
self
normalized to length 1.0 if possible, else returns a fallback value. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be the fallback value. See also [Self::try_normalize()
].
Arguments
- _self :
Vec4
- No Documentation 🚧 - fallback :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
normalize_or_zero
Returns
self
normalized to length 1.0 if possible, else returns zero. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be zero. See also [Self::try_normalize()
].
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
powf
Returns a vector containing each element of
self
raised to the power ofn
.
Arguments
- _self :
Vec4
- No Documentation 🚧 - n :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
project_onto
Returns the vector projection of
self
ontorhs
.rhs
must be of non-zero length.Panics
Will panic if
rhs
is zero length whenglam_assert
is enabled.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
project_onto_normalized
Returns the vector projection of
self
ontorhs
.rhs
must be normalized.Panics
Will panic if
rhs
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
recip
Returns a vector containing the reciprocal
1.0/n
of each element ofself
.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
reflect
Returns the reflection vector for a given incident vector
self
and surface normalnormal
.normal
must be normalized.Panics
Will panic if
normal
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec4
- No Documentation 🚧 - normal :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
refract
Returns the refraction direction for a given incident vector
self
, surface normalnormal
and ratio of indices of refraction,eta
. When total internal reflection occurs, a zero vector will be returned.self
andnormal
must be normalized.Panics
Will panic if
self
ornormal
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec4
- No Documentation 🚧 - normal :
Vec4
- No Documentation 🚧 - eta :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
reject_from
Returns the vector rejection of
self
fromrhs
. The vector rejection is the vector perpendicular to the projection ofself
ontorhs
, in rhs words the result ofself - self.project_onto(rhs)
.rhs
must be of non-zero length.Panics
Will panic if
rhs
has a length of zero whenglam_assert
is enabled.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
reject_from_normalized
Returns the vector rejection of
self
fromrhs
. The vector rejection is the vector perpendicular to the projection ofself
ontorhs
, in rhs words the result ofself - self.project_onto(rhs)
.rhs
must be normalized.Panics
Will panic if
rhs
is not normalized whenglam_assert
is enabled.
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
rem
No Documentation 🚧
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
rem-1
No Documentation 🚧
Arguments
- arg0 :
Vec4
- No Documentation 🚧 - arg1 :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
rem-2
No Documentation 🚧
Arguments
- arg0 :
Vec4
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
. [Euclidean division]: f32::rem_euclid
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
round
Returns a vector containing the nearest integer to a number for each element of
self
. Round half-way cases away from 0.0.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
select
Creates a vector from the elements in
if_true
andif_false
, selecting which to use for each element ofself
. A true element in the mask uses the corresponding element fromif_true
, and false uses the element fromif_false
.
Arguments
- mask :
BVec4A
- No Documentation 🚧 - if_true :
Vec4
- No Documentation 🚧 - if_false :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
signum
Returns a vector with elements representing the sign of
self
.
1.0
if the number is positive,+0.0
orINFINITY
-1.0
if the number is negative,-0.0
orNEG_INFINITY
NAN
if the number isNAN
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
splat
Creates a vector with all elements set to
v
.
Arguments
- v :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
sub
No Documentation 🚧
Arguments
- _self :
Vec4
- No Documentation 🚧 - rhs :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
sub-1
No Documentation 🚧
Arguments
- arg0 :
Vec4
- No Documentation 🚧 - arg1 :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
sub-2
No Documentation 🚧
Arguments
- arg0 :
Vec4
- No Documentation 🚧 - arg1 :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
to_array
[x, y, z, w]
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
[f32; 4]
- No Documentation 🚧
trunc
Returns a vector containing the integer part each element of
self
. This means numbers are always truncated towards zero.
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
truncate
Creates a 3D vector from the
x
,y
andz
elements ofself
, discardingw
. Truncation to [Vec3
] may also be performed by using [self.xyz()
][crate::swizzles::Vec4Swizzles::xyz()]. To truncate to [Vec3A
] use [Vec3A::from()
].
Arguments
- _self :
Vec4
- No Documentation 🚧
Returns
- arg0 :
Vec3
- No Documentation 🚧
with_w
Creates a 4D vector from
self
with the given value ofw
.
Arguments
- _self :
Vec4
- No Documentation 🚧 - w :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
with_x
Creates a 4D vector from
self
with the given value ofx
.
Arguments
- _self :
Vec4
- No Documentation 🚧 - x :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
with_y
Creates a 4D vector from
self
with the given value ofy
.
Arguments
- _self :
Vec4
- No Documentation 🚧 - y :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
with_z
Creates a 4D vector from
self
with the given value ofz
.
Arguments
- _self :
Vec4
- No Documentation 🚧 - z :
f32
- No Documentation 🚧
Returns
- arg0 :
Vec4
- No Documentation 🚧
i128
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
i16
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
i32
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
i64
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
i8
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
isize
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
SmallVec<TypeId(0xa32f79c7827d6d59a66b75c208b19242)>
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
SmolStr
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
Function | Summary |
---|---|
clone(_self) | No Documentation 🚧 |
eq(_self, other) | No Documentation 🚧 |
is_empty(_self) | No Documentation 🚧 |
is_heap_allocated(_self) | No Documentation 🚧 |
len(_self) | No Documentation 🚧 |
to_string(_self) | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
- _self :
SmolStr
- No Documentation 🚧
Returns
- arg0 :
SmolStr
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
SmolStr
- No Documentation 🚧 - other :
SmolStr
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_empty
No Documentation 🚧
Arguments
- _self :
SmolStr
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_heap_allocated
No Documentation 🚧
Arguments
- _self :
SmolStr
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
len
No Documentation 🚧
Arguments
- _self :
SmolStr
- No Documentation 🚧
Returns
- arg0 :
usize
- No Documentation 🚧
to_string
No Documentation 🚧
Arguments
- _self :
SmolStr
- No Documentation 🚧
Returns
- arg0 :
String
- No Documentation 🚧
HashMap<StringScriptValue, >
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
u128
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
u16
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
u32
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
u64
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
u8
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
usize
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
Uuid
Opaque Type. 🔒
Description
No Documentation 🚧
Functions
as_u128
Returns a 128bit value containing the value. The bytes in the UUID will be packed directly into a
u128
.Examples
# use uuid::Uuid; # fn main() -> Result<(), uuid::Error> { let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; assert_eq!( uuid.as_u128(), 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8, ); # Ok(()) # }
Arguments
- _self :
Uuid
- No Documentation 🚧
Returns
- arg0 :
u128
- No Documentation 🚧
as_u64_pair
Returns two 64bit values containing the value. The bytes in the UUID will be split into two
u64
. The first u64 represents the 64 most significant bits, the second one represents the 64 least significant.Examples
# use uuid::Uuid; # fn main() -> Result<(), uuid::Error> { let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; assert_eq!( uuid.as_u64_pair(), (0xa1a2a3a4b1b2c1c2, 0xd1d2d3d4d5d6d7d8), ); # Ok(()) # }
Arguments
- _self :
Uuid
- No Documentation 🚧
Returns
- arg0 :
(u64, u64)
- No Documentation 🚧
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
- _self :
Uuid
- No Documentation 🚧
Returns
- arg0 :
()
- No Documentation 🚧
clone
No Documentation 🚧
Arguments
- _self :
Uuid
- No Documentation 🚧
Returns
- arg0 :
Uuid
- No Documentation 🚧
encode_buffer
A buffer that can be used for
encode_...
calls, that is guaranteed to be long enough for any of the format adapters.Examples
# use uuid::Uuid; let uuid = Uuid::nil(); assert_eq!( uuid.simple().encode_lower(&mut Uuid::encode_buffer()), "00000000000000000000000000000000" ); assert_eq!( uuid.hyphenated() .encode_lower(&mut Uuid::encode_buffer()), "00000000-0000-0000-0000-000000000000" ); assert_eq!( uuid.urn().encode_lower(&mut Uuid::encode_buffer()), "urn:uuid:00000000-0000-0000-0000-000000000000" );
Arguments
Returns
- arg0 :
[u8; 45]
- No Documentation 🚧
eq
No Documentation 🚧
Arguments
- _self :
Uuid
- No Documentation 🚧 - other :
Uuid
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
from_bytes
Creates a UUID using the supplied bytes.
Examples
Basic usage:
# fn main() -> Result<(), uuid::Error> { # use uuid::Uuid; let bytes = [ 0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, ]; let uuid = Uuid::from_bytes(bytes); assert_eq!( uuid.hyphenated().to_string(), "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8" ); # Ok(()) # }
Arguments
- bytes :
[u8; 16]
- No Documentation 🚧
Returns
- arg0 :
Uuid
- No Documentation 🚧
from_bytes_le
Creates a UUID using the supplied bytes in little endian order. The individual fields encoded in the buffer will be flipped.
Examples
Basic usage:
# fn main() -> Result<(), uuid::Error> { # use uuid::Uuid; let bytes = [ 0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, ]; let uuid = Uuid::from_bytes_le(bytes); assert_eq!( "a4a3a2a1-b2b1-c2c1-d1d2-d3d4d5d6d7d8", uuid.hyphenated().to_string(), ); # Ok(()) # }
Arguments
- b :
[u8; 16]
- No Documentation 🚧
Returns
- arg0 :
Uuid
- No Documentation 🚧
from_u128
Creates a UUID from a 128bit value.
Examples
Basic usage:
# use uuid::Uuid; let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; let uuid = Uuid::from_u128(v); assert_eq!( "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", uuid.hyphenated().to_string(), );
Arguments
- v :
u128
- No Documentation 🚧
Returns
- arg0 :
Uuid
- No Documentation 🚧
from_u128_le
Creates a UUID from a 128bit value in little-endian order. The entire value will be flipped to convert into big-endian order. This is based on the endianness of the UUID, rather than the target environment so bytes will be flipped on both big and little endian machines.
Examples
Basic usage:
# use uuid::Uuid; let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; let uuid = Uuid::from_u128_le(v); assert_eq!( "d8d7d6d5-d4d3-d2d1-c2c1-b2b1a4a3a2a1", uuid.hyphenated().to_string(), );
Arguments
- v :
u128
- No Documentation 🚧
Returns
- arg0 :
Uuid
- No Documentation 🚧
from_u64_pair
Creates a UUID from two 64bit values.
Examples
Basic usage:
# use uuid::Uuid; let hi = 0xa1a2a3a4b1b2c1c2u64; let lo = 0xd1d2d3d4d5d6d7d8u64; let uuid = Uuid::from_u64_pair(hi, lo); assert_eq!( "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", uuid.hyphenated().to_string(), );
Arguments
- high_bits :
u64
- No Documentation 🚧 - low_bits :
u64
- No Documentation 🚧
Returns
- arg0 :
Uuid
- No Documentation 🚧
get_node_id
If the UUID is the correct version (v1, or v6) this will return the node value as a 6-byte array. For other versions this will return
None
.
Arguments
- _self :
Uuid
- No Documentation 🚧
Returns
- arg0 :
Optional<[u8; 6]>
- No Documentation 🚧
get_version_num
Returns the version number of the UUID. This represents the algorithm used to generate the value. This method is the future-proof alternative to [
Uuid::get_version
].Examples
Basic usage:
# use uuid::Uuid; # fn main() -> Result<(), uuid::Error> { let my_uuid = Uuid::parse_str("02f09a3f-1624-3b1d-8409-44eff7708208")?; assert_eq!(3, my_uuid.get_version_num()); # Ok(()) # }
References
Arguments
- _self :
Uuid
- No Documentation 🚧
Returns
- arg0 :
usize
- No Documentation 🚧
into_bytes
Consumes self and returns the underlying byte value of the UUID.
Examples
# use uuid::Uuid; let bytes = [ 0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, ]; let uuid = Uuid::from_bytes(bytes); assert_eq!(bytes, uuid.into_bytes());
Arguments
- _self :
Uuid
- No Documentation 🚧
Returns
- arg0 :
[u8; 16]
- No Documentation 🚧
is_max
Tests if the UUID is max (all ones).
Arguments
- _self :
Uuid
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
is_nil
Tests if the UUID is nil (all zeros).
Arguments
- _self :
Uuid
- No Documentation 🚧
Returns
- arg0 :
bool
- No Documentation 🚧
max
The 'max UUID' (all ones). The max UUID is a special form of UUID that is specified to have all 128 bits set to one.
References
Examples
Basic usage:
# use uuid::Uuid; let uuid = Uuid::max(); assert_eq!( "ffffffff-ffff-ffff-ffff-ffffffffffff", uuid.hyphenated().to_string(), );
Arguments
Returns
- arg0 :
Uuid
- No Documentation 🚧
new_v4
Creates a random UUID. This uses the [
getrandom
] crate to utilise the operating system's RNG as the source of random numbers. If you'd like to use a custom generator, don't use this method: generate random bytes using your custom generator and pass them to the [uuid::Builder::from_random_bytes
][from_random_bytes] function instead. Note that usage of this method requires thev4
feature of this crate to be enabled.Examples
Basic usage:
# use uuid::{Uuid, Version}; let uuid = Uuid::new_v4(); assert_eq!(Some(Version::Random), uuid.get_version());
References
- UUID Version 4 in RFC 9562 [
getrandom
]: https://crates.io/crates/getrandom [from_random_bytes]: struct.Builder.html#method.from_random_bytes
Arguments
Returns
- arg0 :
Uuid
- No Documentation 🚧
nil
The 'nil UUID' (all zeros). The nil UUID is a special form of UUID that is specified to have all 128 bits set to zero.
References
Examples
Basic usage:
# use uuid::Uuid; let uuid = Uuid::nil(); assert_eq!( "00000000-0000-0000-0000-000000000000", uuid.hyphenated().to_string(), );
Arguments
Returns
- arg0 :
Uuid
- No Documentation 🚧
to_bytes_le
Returns the bytes of the UUID in little-endian order. The bytes will be flipped to convert into little-endian order. This is based on the endianness of the UUID, rather than the target environment so bytes will be flipped on both big and little endian machines.
Examples
use uuid::Uuid; # fn main() -> Result<(), uuid::Error> { let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; assert_eq!( uuid.to_bytes_le(), ([ 0xa4, 0xa3, 0xa2, 0xa1, 0xb2, 0xb1, 0xc2, 0xc1, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 ]) ); # Ok(()) # }
Arguments
- _self :
Uuid
- No Documentation 🚧
Returns
- arg0 :
[u8; 16]
- No Documentation 🚧
to_u128_le
Returns a 128bit little-endian value containing the value. The bytes in the
u128
will be flipped to convert into big-endian order. This is based on the endianness of the UUID, rather than the target environment so bytes will be flipped on both big and little endian machines. Note that this will produce a different result than [Uuid::to_fields_le
], because the entire UUID is reversed, rather than reversing the individual fields in-place.Examples
# use uuid::Uuid; # fn main() -> Result<(), uuid::Error> { let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; assert_eq!( uuid.to_u128_le(), 0xd8d7d6d5d4d3d2d1c2c1b2b1a4a3a2a1, ); # Ok(()) # }
Arguments
- _self :
Uuid
- No Documentation 🚧
Returns
- arg0 :
u128
- No Documentation 🚧