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.
app.add_plugins(BMSPlugin);
You can modify each of the plugins contained within the plugin group using set(MySubPlugin)
.
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_core_bindings | Enables bindings for the bevy_core module |
bevy_ecs_bindings | Enables bindings for the bevy_ecs module |
bevy_hierarchy_bindings | Enables bindings for the bevy_hierarchy module |
bevy_input_bindings | Enables bindings for the bevy_input module |
bevy_math_bindings | Enables bindings for the bevy_math module |
bevy_reflect_bindings | Enables bindings for the bevy_reflect module |
bevy_time_bindings | Enables bindings for the bevy_time module |
bevy_transform_bindings | Enables bindings for the bevy_transform module |
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.
File Extensions
Normally the set of supported extensions is pre-decided by each language plugin.
I.e. Lua supports ".lua" extensions and Rhai supports ".rhai" extensions.
Scripts are mapped to the corresponding language plugin based on these and so it's important to use them correctly.
If you would like to add more extensions you need to populate them via app.add_supported_script_extensions
.
Advanced
Normally not necessary, but knowing these exist could be useful for more advanced use cases.
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 three methods of making scripts runnable:
- Attaching them to entities via
ScriptComponent
's - Adding static scripts
- Creating dynamic systems ⚗️ (see the script systems section)
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.
Macros
The above is a bit tedious, so instead you can use the script_bindings
macro, which applies to impl blocks like so:
#[script_bindings("test_fn")]
impl TestStruct {
/// My docs !!
///
/// Arguments:
/// * `_self` - the first argument
/// * `arg1` - the second argument
/// Returns:
/// * `return` - nothing
fn test_fn(_self: Ref<TestStruct>, mut arg1: usize) {}
}
pub fn main() {
let mut app = App::new();
register_test_fn(app.world_mut())
}
Note the documentation will automatically be picked up and stored for the purposes of reflection and documentation generation, including argument/return type specific docs.
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.
Note the ReflectReference
namespace is special, in that functions defined on it, act like a fallback and hence apply to ALL references.
Globals
By default, each type registered with the type registry, has the following set:
- a static reference in the global namespace, i.e.:
Vec3
,Mat3
- an entry in the
types
global type cache, i.e.:types.Vec3
,types.Mat3
You can filter the types included by customising the CoreScriptGlobalsPlugin
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.
Script Systems
It's possible within BMS to inject new systems from within scripts themselves.
Systems introduced by scripts can run in parallel to other systems, and can be freely inserted between any other system, including other script systems.
BMS also provides utilities for visualising schedules using dot graphs, allowing low-effort modding frameworks for game authors.
Schedules
Bevy doesn't support reflecting schedules, so BMS rolls it's own schedule registry resource: AppScheduleRegistry
, which can be used to add any custom schedules you want to interact with. The default Bevy schedules will be pre-populated for you.
Once you've registered your schedule you will be able to interact with it in scripts like below:
local update_schedule = world.get_schedule_by_name("Update")
local systems = update:systems()
local system_with_name = update:get_system_by_name("my_system")
Inserting Systems
To insert a system you will need to use the system_builder
global function like below:
local system = system_builder("my_system", script_id)
:exclusive()
:after(some_other_system)
:before(another_system)
This will let you call world.add_system
like so:
world.add_system(update_schedule,system)
If your event handler running the script is running in a certain schedule, that schedule will be temporarilly removed by Bevy. Meaning you won't be able to modify it from within the script in-flight.
Parameters
The system builder allows script authors to parameterise systems, using resource
and query
functions.
The order in which those functions are called, will define the order in which arguments will be provided to the specified script callback.
For example:
system_builder("my_system")
:query(
world.query()
:component(ComponentA)
:component(ComponentB)
:with(ComponentC)
:without(ComponentD)
)
:resource(ResourceA)
will create a system which calls the specified callback my_system
with 2 arguments:
- The
ScriptQueryResult
for the first query- With
components
access to ComponentA and ComponentB
- With
- The
ReflectReference
toResourceA
Exclusive systems
An exclusive system can be created using the exclusive
function call on the system builder.
This allows the system to access everything as in a normal event handler.
Non-exclusive systems, will only be able to access the set of components and resources as parameterized when building the system. This is why we can run the system in parallel to other non-overlapping systems.
Exclusive systems on the other hand, cannot run in parallel.
Callback
The system injected will be similar to an event handler, however it will only trigger the specified script, and without any entity, in the first example you'd see the following lua callback:
function my_system()
print("I am a dynamic system")
end
get triggered every update.
Examples
In the future we hope to embedd live WASM code examples into the documentation, for now the best source of example scripts will be our regression test suite available in all supported languages in our github repository.
For rust examples see this folder.
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 callbacks, and in dynamic system callbacks.script_id
: the ID of the current script
Constructing Arbitrary Types
When interfacing with bevy, we do this via reflection.
While the generated bindings do not cover constructors for every single type that bevy or other libraries provide, reflection allows us to construct some (not all types implement FromReflect
) types from dynamic structs.
BMS exposes this ability to all script writers via the construct
global function.
Structs
The following struct:
pub struct MyStruct {
pub my_field: String
}
can be constructed from lua like so:
local MyStruct = types.MyStruct
local concrete_my_struct = construct(MyStruct, {
my_field = "hello"
})
Tuple Structs
The following tuple struct:
pub struct MyTupleStruct(pub String);
can be constructed like so:
local MyTupleStruct = types.MyTupleStruct
local concrete_my_tuple_struct = construct(MyTupleStruct, {
_1 = "hello"
})
Enums
The following enum:
pub enum MyEnum {
VariantA {
field: String
},
VariantB
}
can be constructed like so:
local MyEnum = types.MyEnum
local variantA = construct(MyEnum, {
variant = "VariantA",
field = "hello"
})
local variantB = construct(MyEnum, {
variant = "VariantB"
})
When working with enums you can also figure out the variant at runtime using variant_name
:
if my_enum:variant_name() == "VariantA" then
print(my_enum.field)
end
Core Bindings
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
Global Values
Global values that are accessible anywhere inside scripts. You should avoid naming conflicts with these and trying to overwrite or edit them.
Instances
Instances containing actual accessible values.
Instance | Type |
---|---|
types | HashMap<String, ScriptTypeRegistration | ScriptComponentRegistration | ScriptResourceRegistration> |
world | World |
entity | Entity |
script_id | String |
Static Instances
Static type references, existing for the purpose of typed static function calls.
Instance | Type |
---|---|
ThreadedAnimationGraphs | ThreadedAnimationGraphs |
WindowClosing | WindowClosing |
WindowRef | WindowRef |
DQuat | DQuat |
UiBoxShadowSamples | UiBoxShadowSamples |
GizmoConfig | GizmoConfig |
HierarchyEvent | HierarchyEvent |
PickingInteraction | PickingInteraction |
PanGesture | PanGesture |
CascadesVisibleEntities | CascadesVisibleEntities |
CircularSegment | CircularSegment |
WindowClosed | WindowClosed |
AccumulatedMouseMotion | AccumulatedMouseMotion |
ImageNode | ImageNode |
AtomicUsize | AtomicUsize |
GltfMaterialExtras | GltfMaterialExtras |
CursorIcon | CursorIcon |
GridAutoFlow | GridAutoFlow |
Dir2 | Dir2 |
CameraRenderGraph | CameraRenderGraph |
LightGizmoColor | LightGizmoColor |
Arc | Arc |
AnimationGraphHandle | AnimationGraphHandle |
ShadowFilteringMethod | ShadowFilteringMethod |
NativeKey | NativeKey |
InternalWindowState | InternalWindowState |
GlyphAtlasLocation | GlyphAtlasLocation |
NodeImageMode | NodeImageMode |
i8 | i8 |
WindowMoved | WindowMoved |
Tonemapping | Tonemapping |
RenderLayers | RenderLayers |
TextLayoutInfo | TextLayoutInfo |
AnimationTarget | AnimationTarget |
Transform | Transform |
WindowCloseRequested | WindowCloseRequested |
RemovedComponentEntity | RemovedComponentEntity |
GizmoLineStyle | GizmoLineStyle |
GridTrack | GridTrack |
ButtonAxisSettings | ButtonAxisSettings |
DynamicScriptFunctionMut | DynamicFunctionMut |
SmolStr | SmolStr |
NonZeroI16 | NonZeroI16 |
Overflow | Overflow |
TextBounds | TextBounds |
Lcha | Lcha |
JustifyContent | JustifyContent |
Rectangle | Rectangle |
Visibility | Visibility |
Uuid | Uuid |
TextColor | TextColor |
CascadesFrusta | CascadesFrusta |
TypeId | TypeId |
FogFalloff | FogFalloff |
PresentMode | PresentMode |
u16 | u16 |
AmbientLight | AmbientLight |
DMat3 | DMat3 |
ScriptResourceRegistration | ScriptResourceRegistration |
RenderTarget | RenderTarget |
BoundingCircle | BoundingCircle |
ContentSize | ContentSize |
Label | Label |
DVec2 | DVec2 |
GamepadButtonChangedEvent | GamepadButtonChangedEvent |
Node | Node |
Annulus | Annulus |
MouseButtonInput | MouseButtonInput |
Sphere | Sphere |
Parent | Parent |
Rect | Rect |
CompassQuadrant | CompassQuadrant |
AtomicI32 | AtomicI32 |
Ray3d | Ray3d |
AssetPath | AssetPath |
String | String |
EaseFunction | EaseFunction |
ScriptTypeRegistration | ScriptTypeRegistration |
Camera2d | Camera2d |
Mesh2d | Mesh2d |
Interval | Interval |
AppLifecycle | AppLifecycle |
AspectRatio | AspectRatio |
TimerMode | TimerMode |
ScriptComponentRegistration | ScriptComponentRegistration |
char | char |
Quat | Quat |
PointerLocation | PointerLocation |
MouseButton | MouseButton |
GamepadConnectionEvent | GamepadConnectionEvent |
TouchPhase | TouchPhase |
GamepadEvent | GamepadEvent |
Plane3d | Plane3d |
WindowResolution | WindowResolution |
NonZeroU32 | NonZeroU32 |
WindowThemeChanged | WindowThemeChanged |
Arc2d | Arc2d |
ComputedTextBlock | ComputedTextBlock |
GamepadButtonStateChangedEvent | GamepadButtonStateChangedEvent |
MeshMorphWeights | MeshMorphWeights |
DirectionalLight | DirectionalLight |
Bloom | Bloom |
GlobalsUniform | GlobalsUniform |
Vec2 | Vec2 |
OpaqueRendererMethod | OpaqueRendererMethod |
ReflectSystem | ReflectSystem |
PointerPress | PointerPress |
VisibleMeshEntities | VisibleMeshEntities |
PointLightShadowMap | PointLightShadowMap |
Line3d | Line3d |
Camera3d | Camera3d |
ScreenSpaceTransmissionQuality | ScreenSpaceTransmissionQuality |
RayId | RayId |
VolumetricFog | VolumetricFog |
RelativeCursorPosition | RelativeCursorPosition |
CircularSector | CircularSector |
Isometry3d | Isometry3d |
ComponentId | ComponentId |
TextFont | TextFont |
Triangle3d | Triangle3d |
UiScale | UiScale |
SmaaPreset | SmaaPreset |
DepthOfFieldMode | DepthOfFieldMode |
BoundingCircleCast | BoundingCircleCast |
u128 | u128 |
WindowLevel | WindowLevel |
Dir3 | Dir3 |
MaxTrackSizingFunction | MaxTrackSizingFunction |
u64 | u64 |
ScreenshotCaptured | ScreenshotCaptured |
WindowCreated | WindowCreated |
AtomicU32 | AtomicU32 |
U64Vec3 | U64Vec3 |
DepthPrepass | DepthPrepass |
GlyphAtlasInfo | GlyphAtlasInfo |
SpatialListener | SpatialListener |
Viewport | Viewport |
RawGamepadButtonChangedEvent | RawGamepadButtonChangedEvent |
PointerInteraction | PointerInteraction |
Capsule2d | Capsule2d |
GamepadRumbleIntensity | GamepadRumbleIntensity |
AabbGizmoConfigGroup | AabbGizmoConfigGroup |
Capsule3d | Capsule3d |
Affine3 | Affine3 |
DefaultSpatialScale | DefaultSpatialScale |
BVec3 | BVec3 |
AtomicU16 | AtomicU16 |
BloomPrefilter | BloomPrefilter |
Cuboid | Cuboid |
GltfSceneExtras | GltfSceneExtras |
Mesh3d | Mesh3d |
TemporalJitter | TemporalJitter |
Vec3A | Vec3A |
ActiveAnimation | ActiveAnimation |
AnimationEvent | AnimationEvent |
AccumulatedMouseScroll | AccumulatedMouseScroll |
Timer | Timer |
BorderRect | BorderRect |
Sensitivity | Sensitivity |
CompositeAlphaMode | CompositeAlphaMode |
AabbCast3d | AabbCast3d |
WindowOccluded | WindowOccluded |
ScreenSpaceReflections | ScreenSpaceReflections |
SpatialScale | SpatialScale |
FocusPolicy | FocusPolicy |
FlexDirection | FlexDirection |
Mat3A | Mat3A |
CubemapVisibleEntities | CubemapVisibleEntities |
Segment3d | Segment3d |
U64Vec4 | U64Vec4 |
AlignContent | AlignContent |
BackgroundColor | BackgroundColor |
Smaa | Smaa |
ButtonSettings | ButtonSettings |
NonZeroU16 | NonZeroU16 |
BVec3A | BVec3A |
AtomicIsize | AtomicIsize |
PathBuf | PathBuf |
Affine3A | Affine3A |
CalculatedClip | CalculatedClip |
Duration | Duration |
NoFrustumCulling | NoFrustumCulling |
AnimationTargetId | AnimationTargetId |
RotationGesture | RotationGesture |
MouseWheel | MouseWheel |
Aabb | Aabb |
RenderAssetUsages | RenderAssetUsages |
DistanceFog | DistanceFog |
SliceScaleMode | SliceScaleMode |
GamepadButton | GamepadButton |
AlignSelf | AlignSelf |
AnimationTransitions | AnimationTransitions |
i128 | i128 |
ScreenSpaceAmbientOcclusionQualityLevel | ScreenSpaceAmbientOcclusionQualityLevel |
KeyCode | KeyCode |
GizmoLineJoint | GizmoLineJoint |
Mat2 | Mat2 |
JustifyText | JustifyText |
IVec2 | IVec2 |
Cylinder | Cylinder |
Mat4 | Mat4 |
isize | isize |
Ellipse | Ellipse |
ScreenSpaceAmbientOcclusion | ScreenSpaceAmbientOcclusion |
EulerRot | EulerRot |
ThreadedAnimationGraph | ThreadedAnimationGraph |
CascadeShadowConfig | CascadeShadowConfig |
I64Vec4 | I64Vec4 |
Ime | Ime |
PrimaryWindow | PrimaryWindow |
ChromaticAberration | ChromaticAberration |
FunctionReturnInfo | FunctionReturnInfo |
RawGamepadAxisChangedEvent | RawGamepadAxisChangedEvent |
Cascades | Cascades |
LinearRgba | LinearRgba |
ReflectReference | ReflectReference |
OrthographicProjection | OrthographicProjection |
Monitor | Monitor |
FunctionCallContext | FunctionCallContext |
ScriptQueryResult | ScriptQueryResult |
ClearColor | ClearColor |
SpriteSource | SpriteSource |
IVec3 | IVec3 |
DepthOfField | DepthOfField |
Color | Color |
ComponentTicks | ComponentTicks |
Cone | Cone |
Vec4 | Vec4 |
Outline | Outline |
NodeIndex | NodeIndex |
DynamicSceneRoot | DynamicSceneRoot |
ScriptSystemBuilder | ScriptSystemBuilder |
GamepadAxis | GamepadAxis |
ColorGradingGlobal | ColorGradingGlobal |
i32 | i32 |
VideoMode | VideoMode |
Xyza | Xyza |
WindowTheme | WindowTheme |
DAffine3 | DAffine3 |
TextLayout | TextLayout |
AtomicBool | AtomicBool |
BVec4A | BVec4A |
ImageNodeSize | ImageNodeSize |
DoubleTapGesture | DoubleTapGesture |
AnimationEventTarget | AnimationEventTarget |
ReflectSchedule | ReflectSchedule |
FileDragAndDrop | FileDragAndDrop |
BoundingSphereCast | BoundingSphereCast |
GlobalVolume | GlobalVolume |
I64Vec3 | I64Vec3 |
DeferredPrepass | DeferredPrepass |
TargetCamera | TargetCamera |
AlphaMode | AlphaMode |
Key | Key |
CompassOctant | CompassOctant |
GamepadSettings | GamepadSettings |
UiRect | UiRect |
Name | Name |
ColorGrading | ColorGrading |
NotShadowReceiver | NotShadowReceiver |
Tetrahedron | Tetrahedron |
ClusterConfig | ClusterConfig |
IVec4 | IVec4 |
TimedAnimationEvent | TimedAnimationEvent |
CursorOptions | CursorOptions |
ClusterFarZMode | ClusterFarZMode |
RequestRedraw | RequestRedraw |
Gamepad | Gamepad |
Mat3 | Mat3 |
Affine2 | Affine2 |
LineBreak | LineBreak |
AlignItems | AlignItems |
Laba | Laba |
Camera | Camera |
ParallaxMappingMethod | ParallaxMappingMethod |
GltfMeshExtras | GltfMeshExtras |
GizmoConfigStore | GizmoConfigStore |
Camera3dDepthTextureUsage | Camera3dDepthTextureUsage |
SubCameraView | SubCameraView |
ColorMaterial | ColorMaterial |
ForceTouch | ForceTouch |
Fxaa | Fxaa |
f64 | f64 |
WindowEvent | WindowEvent |
Stopwatch | Stopwatch |
PickingPlugin | PickingPlugin |
PointerId | PointerId |
WindowBackendScaleFactorChanged | WindowBackendScaleFactorChanged |
ComputedNode | ComputedNode |
CameraMainTextureUsages | CameraMainTextureUsages |
AtomicU8 | AtomicU8 |
UVec3 | UVec3 |
PickingBehavior | PickingBehavior |
AlphaMode2d | AlphaMode2d |
usize | usize |
BorderColor | BorderColor |
RepeatAnimation | RepeatAnimation |
RegularPolygon | RegularPolygon |
UVec2 | UVec2 |
SyncToRenderWorld | SyncToRenderWorld |
Sprite | Sprite |
VisibilityRange | VisibilityRange |
Cow | Cow |
Frustum | Frustum |
CursorMoved | CursorMoved |
DMat4 | DMat4 |
RayCast2d | RayCast2d |
ResolvedBorderRadius | ResolvedBorderRadius |
bool | bool |
ClusterZConfig | ClusterZConfig |
Identifier | Identifier |
Oklaba | Oklaba |
TextureAtlasLayout | TextureAtlasLayout |
ConicalFrustum | ConicalFrustum |
ViewVisibility | ViewVisibility |
InfinitePlane3d | InfinitePlane3d |
CursorGrabMode | CursorGrabMode |
ClearColorConfig | ClearColorConfig |
u8 | u8 |
VisibleEntities | VisibleEntities |
TextSpan | TextSpan |
DirectionalLightShadowMap | DirectionalLightShadowMap |
InheritedVisibility | InheritedVisibility |
WindowPosition | WindowPosition |
OverflowClipMargin | OverflowClipMargin |
AtomicU64 | AtomicU64 |
PlaybackSettings | PlaybackSettings |
DAffine2 | DAffine2 |
PerspectiveProjection | PerspectiveProjection |
BVec4 | BVec4 |
ZIndex | ZIndex |
BoundingSphere | BoundingSphere |
f32 | f32 |
JustifyItems | JustifyItems |
Text | Text |
DMat2 | DMat2 |
PointerInputPlugin | PointerInputPlugin |
Display | Display |
GridPlacement | GridPlacement |
ManualTextureViewHandle | ManualTextureViewHandle |
PositionedGlyph | PositionedGlyph |
Virtual | Virtual |
UiAntiAlias | UiAntiAlias |
Triangle2d | Triangle2d |
CursorLeft | CursorLeft |
CustomCursor | CustomCursor |
WindowFocused | WindowFocused |
TextureAtlas | TextureAtlas |
MouseMotion | MouseMotion |
CursorEntered | CursorEntered |
ButtonState | ButtonState |
Isometry2d | Isometry2d |
OnReplace | OnReplace |
PositionType | PositionType |
AnimationTransition | AnimationTransition |
FontSmoothing | FontSmoothing |
GamepadRumbleRequest | GamepadRumbleRequest |
GamepadInput | GamepadInput |
MouseScrollUnit | MouseScrollUnit |
Srgba | Srgba |
UvChannel | UvChannel |
Exposure | Exposure |
AnimationGraph | AnimationGraph |
Mesh | Mesh |
Dir3A | Dir3A |
FunctionInfo | FunctionInfo |
DVec3 | DVec3 |
InteropError | InteropError |
RangeFull | RangeFull |
Interaction | Interaction |
DiGraph | DiGraph |
BVec2 | BVec2 |
I64Vec2 | I64Vec2 |
TextNodeFlags | TextNodeFlags |
Namespace | Namespace |
EnabledButtons | EnabledButtons |
WindowDestroyed | WindowDestroyed |
Aabb2d | Aabb2d |
Hsva | Hsva |
StandardMaterial | StandardMaterial |
SystemIdMarker | SystemIdMarker |
WindowResizeConstraints | WindowResizeConstraints |
DefaultOpaqueRendererMethod | DefaultOpaqueRendererMethod |
FlexWrap | FlexWrap |
OnRemove | OnRemove |
PlaybackMode | PlaybackMode |
PinchGesture | PinchGesture |
MorphWeights | MorphWeights |
Val | Val |
Rhombus | Rhombus |
GltfExtras | GltfExtras |
ScalingMode | ScalingMode |
AssetIndex | AssetIndex |
MipBias | MipBias |
OnAdd | OnAdd |
BloomCompositeMode | BloomCompositeMode |
SkinnedMesh | SkinnedMesh |
Instant | Instant |
GlobalTransform | GlobalTransform |
Vec3 | Vec3 |
MotionVectorPrepass | MotionVectorPrepass |
NativeKeyCode | NativeKeyCode |
AtomicI16 | AtomicI16 |
Range | Range |
IRect | IRect |
Real | Real |
EnvironmentMapLight | EnvironmentMapLight |
SpriteImageMode | SpriteImageMode |
GridTrackRepetition | GridTrackRepetition |
NormalPrepass | NormalPrepass |
AnimationClip | AnimationClip |
SystemCursorIcon | SystemCursorIcon |
u32 | u32 |
Torus | Torus |
IrradianceVolume | IrradianceVolume |
OnInsert | OnInsert |
AnimationPlayer | AnimationPlayer |
OverflowAxis | OverflowAxis |
MinTrackSizingFunction | MinTrackSizingFunction |
WindowMode | WindowMode |
TextureSlicer | TextureSlicer |
Msaa | Msaa |
URect | URect |
U64Vec2 | U64Vec2 |
ShaderStorageBuffer | ShaderStorageBuffer |
Segment2d | Segment2d |
LightGizmoConfigGroup | LightGizmoConfigGroup |
Anchor | Anchor |
ReflectableScheduleLabel | ReflectableScheduleLabel |
WindowScaleFactorChanged | WindowScaleFactorChanged |
Oklcha | Oklcha |
UVec4 | UVec4 |
RayCast3d | RayCast3d |
Screenshot | Screenshot |
NotShadowCaster | NotShadowCaster |
SceneRoot | SceneRoot |
ColorGradingSection | ColorGradingSection |
Circle | Circle |
Hsla | Hsla |
Aabb3d | Aabb3d |
EntityHash | EntityHash |
WindowResized | WindowResized |
DebandDither | DebandDither |
Focus | Focus |
GltfMaterialName | GltfMaterialName |
AabbCast2d | AabbCast2d |
OrderIndependentTransparencySettings | OrderIndependentTransparencySettings |
TouchInput | TouchInput |
ScriptQueryBuilder | ScriptQueryBuilder |
i64 | i64 |
GamepadConnection | GamepadConnection |
TextEntity | TextEntity |
AtomicI8 | AtomicI8 |
Rot2 | Rot2 |
MonitorSelection | MonitorSelection |
CubemapFrusta | CubemapFrusta |
Plane2d | Plane2d |
FunctionArgInfo | FunctionArgInfo |
Hwba | Hwba |
DVec4 | DVec4 |
JustifySelf | JustifySelf |
Line2d | Line2d |
KeyboardFocusLost | KeyboardFocusLost |
SpotLight | SpotLight |
ScriptValue | ScriptValue |
ContrastAdaptiveSharpening | ContrastAdaptiveSharpening |
AtomicI64 | AtomicI64 |
GamepadAxisChangedEvent | GamepadAxisChangedEvent |
AxisSettings | AxisSettings |
FloatOrd | FloatOrd |
i16 | i16 |
Cascade | Cascade |
RepeatedGridTrack | RepeatedGridTrack |
VolumetricLight | VolumetricLight |
ScrollPosition | ScrollPosition |
BorderRadius | BorderRadius |
Button | Button |
Fixed | Fixed |
Camera3dDepthLoadOp | Camera3dDepthLoadOp |
Volume | Volume |
Window | Window |
LightProbe | LightProbe |
KeyboardInput | KeyboardInput |
Entity | Entity |
Tick | Tick |
HitData | HitData |
Projection | Projection |
Text2d | Text2d |
Children | Children |
PointLight | PointLight |
Image | Image |
Indices | Indices |
Ray2d | Ray2d |
RawGamepadEvent | RawGamepadEvent |
OverflowClipBox | OverflowClipBox |
Functions
Non-Associated Functions
Global functions that are not associated with any type and callable from anywhere in the script.
For function details and documentation, click on the function link.
Function | Summary |
---|---|
construct | Attempts to construct the given type, given an arbitrary map of values. |
system_builder | Creates a new script system builder, which can be used to add new systems to the world. |
construct
Attempts to construct the given type, given an arbitrary map of values.
Arguments
Name | Type | Documentation |
---|---|---|
registration | ScriptTypeRegistration | ScriptComponentRegistration | ScriptResourceRegistration | The type to construct. |
payload | HashMap<String, ScriptValue> | The values to use to construct the type. |
Returns
Name | Type | Documentation |
---|---|---|
reference | ReflectReference | The constructed type. |
system_builder
Creates a new script system builder, which can be used to add new systems to the world.
Arguments
Name | Type | Documentation |
---|---|---|
callback | String | The function name in the script this system should call when run. |
script_id | String | The id of the script this system will execute when run. |
Returns
Name | Type | Documentation |
---|---|---|
builder | ScriptSystemBuilder | The system builder |
Types
Available Types
All registered reflect-able types which can be constructed and directly manipulated by scripts.
Type | Summary |
---|---|
World | The ECS world containing all Components, Resources and Systems. Main point of interaction with a Bev... |
ReflectReference | A reference to an arbitrary reflected instance. The reference can point to either the ECS, or to ... |
ScriptComponentRegistration | A reference to a component type's reflection registration. In general think of this as a handle t... |
ScriptQueryBuilder | The query builder is used to build ECS queries which retrieve spefific components filtered by speci... |
ScriptQueryResult | A result from a query. |
ScriptResourceRegistration | A reference to a resource type's reflection registration. In general think of this as a handle to... |
ScriptTypeRegistration | A reference to a type which is not a `Resource` or `Component`. In general think of this as a han... |
ScriptSystemBuilder | A builder for systems living in scripts |
ReflectSchedule | A reflectable schedule. |
ReflectSystem | A reflectable system. |
Name | Component used to identify an entity. Stores a hash for faster comparisons. The hash is eagerly r... |
ComponentId | A value which uniquely identifies the type of a [`Component`] or [`Resource`] within a [`World`]. Each time a new `Component` type is registered within a `World` using e.g. [`World::register_component`]... |
ComponentTicks | Records when a component or resource was added and when it was last mutably dereferenced (or added)... |
Tick | A value that tracks when a system ran relative to other systems. This is used to power change dete... |
Entity | Lightweight identifier of an [entity](crate::entity). The identifier is implemented using a [gene... |
EntityHash | A [`BuildHasher`] that results in a [`EntityHasher`]. |
Identifier | A unified identifier for all entity and similar IDs. Has the same size as a `u64` integer, but th... |
RemovedComponentEntity | Wrapper around [`Entity`] for [`RemovedComponents`]. Internally, `RemovedComponents` uses these as... |
Children | 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 like [`BuildChildren::with_children`]... |
Parent | Holds a reference to the parent entity of this entity. This component should only be present on en... |
HierarchyEvent | An [`Event`] that is fired whenever there is a change in the world's hierarchy. [`Event`]: bevy_ecs::event::Event |
ButtonState | The current "press" state of an element |
AxisSettings | Settings for a [`GamepadAxis`]. It is used inside the [`GamepadSettings`] to define the sensitivi... |
ButtonAxisSettings | Settings for a [`GamepadButton`]. It is used inside the [`GamepadSettings`] to define the sensiti... |
ButtonSettings | Manages settings for gamepad buttons. It is used inside [`GamepadSettings`] to define the threshold for a [`GamepadButton`]... |
Gamepad | Stores a connected gamepad's metadata such as the name and its [`GamepadButton`] and [`GamepadAxis`... |
GamepadAxis | 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`]... |
GamepadAxisChangedEvent | [`GamepadAxis`] event triggered by an analog state change |
GamepadButton | 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`]... |
GamepadButtonChangedEvent | [`GamepadButton`] event triggered by an analog state change |
GamepadButtonStateChangedEvent | [`GamepadButton`] event triggered by a digital state change |
GamepadConnection | The connection status of a gamepad. |
GamepadConnectionEvent | A Gamepad connection event. Created when a connection to a gamepad is established and when a gamep... |
GamepadEvent | A gamepad event. This event type is used over the [`GamepadConnectionEvent`], [`GamepadButtonChangedEvent`... |
GamepadInput | Encapsulation over [`GamepadAxis`] and [`GamepadButton`] |
GamepadRumbleIntensity | The intensity at which a gamepad's force-feedback motors may rumble. |
GamepadRumbleRequest | An event that controls force-feedback rumbling of a [`Gamepad`] [`entity`](Entity). # Notes Doe... |
GamepadSettings | Gamepad settings component. ## Usage It is used to create a `bevy` component that stores the se... |
RawGamepadAxisChangedEvent | [`GamepadAxis`] changed event unfiltered by [`GamepadSettings`] |
RawGamepadButtonChangedEvent | [`GamepadButton`] changed event unfiltered by [`GamepadSettings`] |
RawGamepadEvent | A raw gamepad event. This event type is used over the [`GamepadConnectionEvent`], [`RawGamepadButtonChangedEvent`... |
DoubleTapGesture | Double tap gesture. ## Platform-specific - Only available on **`macOS`** and **`iOS`**. - On *... |
PanGesture | Pan gesture. ## Platform-specific - On **`iOS`**, must be enabled first |
PinchGesture | Two-finger pinch gesture, often used for magnifications. Positive delta values indicate magnifica... |
RotationGesture | Two-finger rotation gesture. Positive delta values indicate rotation counterclockwise and negati... |
Key | The logical key code of a [`KeyboardInput`]. ## Technical Its values map 1 to 1 to winit's Key. |
KeyCode | The key code of a [`KeyboardInput`]. ## Usage It is used as the generic `T` value of an [`ButtonInput`... |
KeyboardFocusLost | Gets generated from `bevy_winit::winit_runner` Used for clearing all cached states to avoid havin... |
KeyboardInput | A keyboard input event. This event is the translated version of the `WindowEvent::KeyboardInput` ... |
NativeKey | Contains the platform-native logical key identifier, known as keysym. Exactly what that means dif... |
NativeKeyCode | Contains the platform-native physical key identifier The exact values vary from platform to platf... |
AccumulatedMouseMotion | Tracks how much the mouse has moved every frame. This resource is reset to zero every frame. Th... |
AccumulatedMouseScroll | Tracks how much the mouse has scrolled every frame. This resource is reset to zero every frame. ... |
MouseButton | A button on a mouse device. ## Usage It is used as the generic `T` value of an [`ButtonInput`] to create a `bevy` resource. ## Updating The resource is updated inside of the [`mouse_button_input_system`]... |
MouseButtonInput | A mouse button input event. This event is the translated version of the `WindowEvent::MouseInput`... |
MouseMotion | An event reporting the change in physical position of a pointing device. This represents raw, unf... |
MouseScrollUnit | 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. |
MouseWheel | A mouse wheel event. This event is the translated version of the `WindowEvent::MouseWheel` from t... |
ForceTouch | A force description of a [`Touch`] input. |
TouchInput | A touch input event. ## Logic Every time the user touches the screen, a new [`TouchPhase::Started`]... |
TouchPhase | 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. |
AspectRatio | An `AspectRatio` is the ratio of width to height. |
Aabb2d | A 2D axis-aligned bounding box, or bounding rectangle |
BoundingCircle | A bounding circle |
Aabb3d | A 3D axis-aligned bounding box |
BoundingSphere | A bounding sphere |
AabbCast2d | An intersection test that casts an [`Aabb2d`] along a ray. |
BoundingCircleCast | An intersection test that casts a [`BoundingCircle`] along a ray. |
RayCast2d | A raycast intersection test for 2D bounding volumes |
AabbCast3d | An intersection test that casts an [`Aabb3d`] along a ray. |
BoundingSphereCast | An intersection test that casts a [`BoundingSphere`] along a ray. |
RayCast3d | A raycast intersection test for 3D bounding volumes |
CompassOctant | A compass enum with 8 directions. ```text N (North) ▲ NW │ NE ╲ │ ╱ W (West) ┼─────► E (East) ╱ │ ╲ SW │ SE ▼ S (South) `... |
CompassQuadrant | A compass enum with 4 directions. ```text N (North) ▲ │ │ W (West) ┼─────► E (East) │ │ ▼ S (South) `... |
EaseFunction | Curve functions over the [unit interval], commonly used for easing transitions. [unit interval]: `Interval::UNIT`... |
Interval | A nonempty closed interval, possibly unbounded in either direction. In other words, the interval ... |
Dir2 | A normalized vector pointing in a direction in 2D space |
Dir3 | A normalized vector pointing in a direction in 3D space |
Dir3A | A normalized SIMD vector pointing in a direction in 3D space. This type stores a 16 byte aligned [`Vec3A`]... |
FloatOrd | 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`]... |
Isometry2d | An isometry in two dimensions, representing a rotation followed by a translation. This can often b... |
Isometry3d | An isometry in three dimensions, representing a rotation followed by a translation. This can often... |
Annulus | A primitive shape formed by the region between two circles, also known as a ring. |
Arc2d | A primitive representing an arc between two points on a circle. An arc has no area. If you want ... |
Capsule2d | A 2D capsule primitive, also known as a stadium or pill shape. A two-dimensional capsule is defin... |
Circle | A circle primitive, representing the set of points some distance from the origin |
CircularSector | A primitive representing a circular sector: a pie slice of a circle. The segment is positioned so... |
CircularSegment | A primitive representing a circular segment: the area enclosed by the arc of a circle and its chor... |
Ellipse | An ellipse primitive, which is like a circle, but the width and height can be different |
Line2d | An infinite line going through the origin along a direction in 2D space. For a finite line: [`Segment2d`]... |
Plane2d | An unbounded plane in 2D space. It forms a separating surface through the origin, stretching infin... |
Rectangle | A rectangle primitive, which is like a square, except that the width and height can be different |
RegularPolygon | A polygon centered on the origin where all vertices lie on a circle, equally far apart. |
Rhombus | A rhombus primitive, also known as a diamond shape. A four sided polygon, centered on the origin, ... |
Segment2d | A segment of a line going through the origin along a direction in 2D space. |
Triangle2d | A triangle in 2D space |
Capsule3d | A 3D capsule primitive centered on the origin A three-dimensional capsule is defined as a surface ... |
Cone | A cone primitive centered on the midpoint between the tip of the cone and the center of its base. ... |
ConicalFrustum | A conical frustum primitive. A conical frustum can be created by slicing off a section of a cone. |
Cuboid | A cuboid primitive, which is like a cube, except that the x, y, and z dimensions are not required ... |
Cylinder | A cylinder primitive centered on the origin |
InfinitePlane3d | An unbounded plane in 3D space. It forms a separating surface through the origin, stretching infin... |
Line3d | An infinite line going through the origin along a direction in 3D space. For a finite line: [`Segment3d`]... |
Plane3d | A bounded plane in 3D space. It forms a surface starting from the origin with a defined height and ... |
Segment3d | A segment of a line going through the origin along a direction in 3D space. |
Sphere | A sphere primitive, representing the set of all points some distance from the origin |
Tetrahedron | A tetrahedron primitive. |
Torus | A torus primitive, often representing a ring or donut shape The set of points some distance from a... |
Triangle3d | A 3D triangle primitive. |
Ray2d | An infinite half-line starting at `origin` and going in `direction` in 2D space. |
Ray3d | An infinite half-line starting at `origin` and going in `direction` in 3D space. |
IRect | A rectangle defined by two opposite corners. The rectangle is axis aligned, and defined by its mi... |
Rect | A rectangle defined by two opposite corners. The rectangle is axis aligned, and defined by its mi... |
URect | A rectangle defined by two opposite corners. The rectangle is axis aligned, and defined by its mi... |
Rot2 | 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_... |
Fixed | The fixed timestep game clock following virtual time. A specialization of the [`Time`] structure. **For method documentation, see [`Time |
Real | Real time clock representing elapsed wall clock time. A specialization of the [`Time`] structure. **For method documentation, see [`Time |
Stopwatch | A Stopwatch is a struct that tracks elapsed time when started. Note that in order to advance the ... |
Timer | Tracks elapsed time. Enters the finished state once `duration` is reached. Non repeating timers w... |
TimerMode | Specifies [`Timer`] behavior. |
Virtual | The virtual game clock representing game time. A specialization of the [`Time`] structure. **For method documentation, see [`Time |
GlobalTransform | [`GlobalTransform`] is an affine transformation from entity-local coordinates to worldspace coordinates. You cannot directly mutate [`GlobalTransform`]... |
Transform | Describe the position of an entity. If the entity has a parent, the position is relative to its pa... |
Duration | No Documentation 🚧 |
Instant | No Documentation 🚧 |
RangeFull | No Documentation 🚧 |
AtomicBool | No Documentation 🚧 |
AtomicI16 | No Documentation 🚧 |
AtomicI32 | No Documentation 🚧 |
AtomicI64 | No Documentation 🚧 |
AtomicI8 | No Documentation 🚧 |
AtomicIsize | No Documentation 🚧 |
AtomicU16 | No Documentation 🚧 |
AtomicU32 | No Documentation 🚧 |
AtomicU64 | No Documentation 🚧 |
AtomicU8 | No Documentation 🚧 |
AtomicUsize | No Documentation 🚧 |
Affine2 | No Documentation 🚧 |
Affine3A | No Documentation 🚧 |
BVec2 | No Documentation 🚧 |
BVec3 | No Documentation 🚧 |
BVec3A | No Documentation 🚧 |
BVec4 | No Documentation 🚧 |
BVec4A | No Documentation 🚧 |
DAffine2 | No Documentation 🚧 |
DAffine3 | No Documentation 🚧 |
DMat2 | No Documentation 🚧 |
DMat3 | No Documentation 🚧 |
DMat4 | No Documentation 🚧 |
DQuat | No Documentation 🚧 |
DVec2 | No Documentation 🚧 |
DVec3 | No Documentation 🚧 |
DVec4 | No Documentation 🚧 |
EulerRot | No Documentation 🚧 |
I64Vec2 | No Documentation 🚧 |
I64Vec3 | No Documentation 🚧 |
I64Vec4 | No Documentation 🚧 |
IVec2 | No Documentation 🚧 |
IVec3 | No Documentation 🚧 |
IVec4 | No Documentation 🚧 |
Mat2 | No Documentation 🚧 |
Mat3 | No Documentation 🚧 |
Mat3A | No Documentation 🚧 |
Mat4 | No Documentation 🚧 |
Quat | No Documentation 🚧 |
U64Vec2 | No Documentation 🚧 |
U64Vec3 | No Documentation 🚧 |
U64Vec4 | No Documentation 🚧 |
UVec2 | No Documentation 🚧 |
UVec3 | No Documentation 🚧 |
UVec4 | No Documentation 🚧 |
Vec2 | No Documentation 🚧 |
Vec3 | No Documentation 🚧 |
Vec3A | No Documentation 🚧 |
Vec4 | No Documentation 🚧 |
SmolStr | No Documentation 🚧 |
Uuid | No Documentation 🚧 |
DynamicFunctionMut | A dynamic mutable script function. |
FunctionCallContext | The caller context when calling a script function. Functions can choose to react to caller prefere... |
PathBuf | A heap allocated file path |
String | A heap allocated string |
Focus | Resource representing which entity has keyboard focus, if any. |
ActiveAnimation | An animation that an [`AnimationPlayer`] is currently either playing or was playing, but is presently paused. An stopped animation is considered no longer active. |
AnimationClip | A list of [`VariableCurve`]s and the [`AnimationTargetId`]s to which they apply. Because animati... |
AnimationEvent | No Documentation 🚧 |
AnimationEventTarget | No Documentation 🚧 |
AnimationPlayer | Animation controls. Automatically added to any root animations of a scene when it is spawned. |
AnimationTarget | An entity that can be animated by an [`AnimationPlayer`]. These are frequently referred to as *bones* or *joints*, because they often refer to individually-animatable parts of an armature. Asset loaders for armatures are responsible for adding these as necessary. Typically, they're generated from hashed versions of the entire name path from the root of the armature to the bone. See the [`AnimationTargetId`]... |
AnimationTargetId | A unique [UUID] for an animation target (e.g. bone in a skinned mesh). The [`AnimationClip`] asse... |
RepeatAnimation | Repetition behavior of an animation. |
TimedAnimationEvent | No Documentation 🚧 |
AnimationGraph | A graph structure that describes how animation clips are to be blended together. Applications fr... |
AnimationGraphHandle | A [`Handle`] to the [`AnimationGraph`] to be used by the [`AnimationPlayer`](crate::AnimationPlayer) on the same entity. |
ThreadedAnimationGraph | An acceleration structure for an animation graph that allows Bevy to evaluate it quickly. This i... |
ThreadedAnimationGraphs | Acceleration structures for animation graphs that allows Bevy to evaluate them quickly. These ar... |
AnimationTransition | An animation that is being faded out as part of a transition |
AnimationTransitions | Manages fade-out of animation blend factors, allowing for smooth transitions between animations. ... |
AssetIndex | A generational runtime-only identifier for a specific [`Asset`] stored in [`Assets`]. This is optim... |
AssetPath | Represents a path to an asset in a "virtual filesystem". Asset paths consist of three main parts:... |
RenderAssetUsages | Defines where the asset will be used. If an asset is set to the `RENDER_WORLD` but not the `MAIN_WORLD`... |
DefaultSpatialScale | The default scale factor applied to the positions of audio sources and listeners for spatial audio... |
GlobalVolume | Use this [`Resource`] to control the global volume of all audio. Note: changing this value will not affect already playing audio. |
PlaybackMode | The way Bevy manages the sound playback. |
PlaybackSettings | Initial settings to be used when audio starts playing. If you would like to control the audio whi... |
SpatialListener | Settings for the listener for spatial audio sources. This must be accompanied by `Transform` and `GlobalTransform`... |
SpatialScale | A scale factor applied to the positions of audio sources and listeners for spatial audio. Defaul... |
Volume | A volume level equivalent to a non-negative float. |
Color | An enumerated type that can represent any of the color types in this crate. This is useful when y... |
Hsla | Color in Hue-Saturation-Lightness (HSL) color space with alpha. Further information on this color ... |
Hsva | Color in Hue-Saturation-Value (HSV) color space with alpha. Further information on this color mode... |
Hwba | Color in Hue-Whiteness-Blackness (HWB) color space with alpha. Further information on this color m... |
Laba | Color in LAB color space, with alpha |
Lcha | Color in LCH color space, with alpha |
LinearRgba | Linear RGB color with alpha. |
Oklaba | Color in Oklab color space, with alpha |
Oklcha | Color in Oklch color space, with alpha |
Srgba | Non-linear standard RGB with alpha. |
Xyza | [CIE 1931](https://en.wikipedia.org/wiki/CIE_1931_color_space) color space, also known as XYZ, with an alpha channel. |
Bloom | Applies a bloom effect to an HDR-enabled 2d or 3d camera. Bloom emulates an effect found in real ... |
BloomCompositeMode | No Documentation 🚧 |
BloomPrefilter | Applies a threshold filter to the input image to extract the brightest regions before blurring the... |
ContrastAdaptiveSharpening | Applies a contrast adaptive sharpening (CAS) filter to the camera. CAS is usually used in combina... |
Camera2d | A 2D camera component. Enables the 2D render graph for a [`Camera`]. |
Camera3d | A 3D camera component. Enables the main 3D render graph for a [`Camera`]. The camera coordinate space is right-handed X-right, Y-up, Z-back. This means "forward" is -Z. |
Camera3dDepthLoadOp | The depth clear operation to perform for the main 3d pass. |
Camera3dDepthTextureUsage | No Documentation 🚧 |
ScreenSpaceTransmissionQuality | The quality of the screen space transmission blur effect, applied to whatever's “behind” transm... |
DepthOfField | A component that enables a [depth of field] postprocessing effect when attached to a [`Camera3d`], ... |
DepthOfFieldMode | Controls the appearance of the effect. |
Fxaa | A component for enabling Fast Approximate Anti-Aliasing (FXAA) for a [`bevy_render::camera::Camera`]. |
Sensitivity | No Documentation 🚧 |
OrderIndependentTransparencySettings | Used to identify which camera will use OIT to render transparent meshes and to configure OIT. |
ChromaticAberration | Adds colored fringes to the edges of objects in the scene. [Chromatic aberration] simulates the effect when lenses fail to focus all colors of light toward a single point. It causes rainbow-colored streaks to appear, which are especially apparent on the edges of objects. Chromatic aberration is commonly used for collision effects, especially in horror games. Bevy's implementation is based on that of *Inside* ([Gjøl & Svendsen 2016]... |
DeferredPrepass | If added to a [`crate::prelude::Camera3d`] then deferred materials will be rendered to the deferred gbuffer texture and will be available to subsequent passes. Note the default deferred lighting plugin also requires `DepthPrepass` to work correctly. |
DepthPrepass | If added to a [`crate::prelude::Camera3d`] then depth values will be copied to a separate texture available to the main pass. |
MotionVectorPrepass | If added to a [`crate::prelude::Camera3d`] then screen space motion vectors will be copied to a separate texture available to the main pass. |
NormalPrepass | If added to a [`crate::prelude::Camera3d`] then vertex world normals will be copied to a separate texture available to the main pass. Normals will have normal map textures already applied. |
Smaa | A component for enabling Subpixel Morphological Anti-Aliasing (SMAA) for a [`bevy_render::camera::Camera`]. |
SmaaPreset | A preset quality level for SMAA. Higher values are slower but result in a higher-quality image. ... |
DebandDither | Enables a debanding shader that applies dithering to mitigate color banding in the final image for ... |
Tonemapping | Optionally enables a tonemapping shader that attempts to map linear input stimulus into a perceptua... |
SystemIdMarker | Marker [`Component`](bevy_ecs::component::Component) for identifying [`SystemId`] [`Entity`]s. |
OnAdd | Trigger emitted when a component is added to an entity. See [`crate::component::ComponentHooks::on_add`] for more information. |
OnInsert | Trigger emitted when a component is inserted onto an entity. See [`crate::component::ComponentHooks::on_insert`] for more information. |
OnRemove | Trigger emitted when a component is removed from an entity. See [`crate::component::ComponentHooks::on_remove`] for more information. |
OnReplace | Trigger emitted when a component is replaced on an entity. See [`crate::component::ComponentHooks::on_replace`] for more information. |
AabbGizmoConfigGroup | The [`GizmoConfigGroup`] used for debug visualizations of [`Aabb`] components on entities |
GizmoConfig | A struct that stores configuration for gizmos. |
GizmoConfigStore | A [`Resource`] storing [`GizmoConfig`] and [`GizmoConfigGroup`] structs Use `app.init_gizmo_group:: |
GizmoLineJoint | An enum configuring how line joints will be drawn. |
GizmoLineStyle | An enum used to configure the style of gizmo lines, similar to CSS line-style |
LightGizmoColor | Configures how a color is attributed to a light gizmo. |
LightGizmoConfigGroup | The [`GizmoConfigGroup`] used to configure the visualization of lights. |
GltfExtras | Additional untyped data that can be present on most glTF types at the primitive level. See [the relevant glTF specification section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-extras)... |
GltfMaterialExtras | Additional untyped data that can be present on most glTF types at the material level. See [the relevant glTF specification section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-extras)... |
GltfMaterialName | The material name of a glTF primitive. See [the relevant glTF specification section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-material). |
GltfMeshExtras | Additional untyped data that can be present on most glTF types at the mesh level. See [the relevant glTF specification section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-extras)... |
GltfSceneExtras | Additional untyped data that can be present on most glTF types at the scene level. See [the relevant glTF specification section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-extras)... |
Image | No Documentation 🚧 |
Affine3 | Reduced-size version of `glam::Affine3A` for use when storage has significant performance impact. ... |
Indices | An array of indices into the [`VertexAttributeValues`](super::VertexAttributeValues) for a mesh. It describes the order in which the vertex attributes should be joined into faces. |
Mesh | A 3D object made out of vertices representing triangles, lines, or points, with "attribute" values... |
MeshMorphWeights | Control a specific [`Mesh`] instance's [morph targets]. These control the weights of specific "mes... |
MorphWeights | Controls the [morph targets] for all child `Mesh3d` entities. In most cases, [`MorphWeights`] shoul... |
SkinnedMesh | No Documentation 🚧 |
Namespace | A namespace for functions |
ScriptValue | An abstraction of values that can be passed to and from scripts. This allows us to re-use logic be... |
FunctionArgInfo | Information about a function argument. |
FunctionInfo | Information about a function. |
FunctionReturnInfo | Information about a function return value. |
InteropError | An error thrown when interoperating with scripting languages. |
CascadesVisibleEntities | No Documentation 🚧 |
CubemapVisibleEntities | No Documentation 🚧 |
VisibleMeshEntities | Collection of mesh entities visible for 3D lighting. This component contains all mesh entities vi... |
ClusterConfig | Configuration of the clustering strategy for clustered forward rendering |
ClusterFarZMode | Configure the far z-plane mode used for the furthest depth slice for clustered forward rendering |
ClusterZConfig | Configure the depth-slicing strategy for clustered forward rendering |
DistanceFog | Configures the “classic” computer graphics [distance fog](https://en.wikipedia.org/wiki/Distance_fog) effect, in which objects appear progressively more covered in atmospheric haze the further away they are from the camera. Affects meshes rendered via the PBR [`StandardMaterial`](crate::StandardMaterial)... |
FogFalloff | Allows switching between different fog falloff modes, and configuring their parameters. ## Conven... |
Cascade | No Documentation 🚧 |
CascadeShadowConfig | Controls how cascaded shadow mapping works. Prefer using [`CascadeShadowConfigBuilder`] to construct an instance. ``` # use bevy_pbr::CascadeShadowConfig; # use bevy_pbr::CascadeShadowConfigBuilder; # use bevy_utils::default; # let config: CascadeShadowConfig = CascadeShadowConfigBuilder { maximum_distance: 100.0, ..default() }.into(); ``` |
Cascades | No Documentation 🚧 |
DirectionalLightShadowMap | Controls the resolution of [`DirectionalLight`] shadow maps. |
NotShadowCaster | Add this component to make a [`Mesh3d`] not cast shadows. |
NotShadowReceiver | Add this component to make a [`Mesh3d`] not receive shadows. **Note:** If you're using diffuse transmission, setting [`NotShadowReceiver`]... |
PointLightShadowMap | No Documentation 🚧 |
ShadowFilteringMethod | Add this component to a [`Camera3d`](bevy_core_pipeline::core_3d::Camera3d) to control how to anti-alias shadow edges. The different modes use different approaches to [Percentage Closer Filtering](https://developer.nvidia.com/gpugems/gpugems/part-ii-lighting-and-shadows/chapter-11-shadow-map-antialiasing). |
AmbientLight | An ambient light, which lights the entire scene equally. This resource is inserted by the [`PbrPlugin`]... |
DirectionalLight | A Directional light. Directional lights don't exist in reality but they are a good approximation... |
PointLight | A light that emits light in all directions from a central point. Real-world values for `intensity... |
SpotLight | A light that emits light in a given direction from a central point. Behaves like a point light in... |
LightProbe | A marker component for a light probe, which is a cuboid region that provides global illumination t... |
EnvironmentMapLight | A pair of cubemap textures that represent the surroundings of a specific area in space. See [`crate::environment_map`] for detailed information. |
IrradianceVolume | The component that defines an irradiance volume. See [`crate::irradiance_volume`] for detailed information. |
DefaultOpaqueRendererMethod | Default render method used for opaque materials. |
OpaqueRendererMethod | Render method used for opaque materials. The forward rendering main pass draws each mesh entity a... |
ParallaxMappingMethod | The [parallax mapping] method to use to compute depth based on the material's [`depth_map`]. Parallax Mapping uses a depth map texture to give the illusion of depth variation on a mesh surface that is geometrically flat. See the `parallax_... |
StandardMaterial | A material with "standard" properties used in PBR lighting Standard property values with pictures ... |
UvChannel | An enum to define which UV attribute to use for a texture. It is used for every texture in the [`StandardMaterial`]... |
ScreenSpaceAmbientOcclusion | Component to apply screen space ambient occlusion to a 3d camera. Screen space ambient occlusion ... |
ScreenSpaceAmbientOcclusionQualityLevel | No Documentation 🚧 |
ScreenSpaceReflections | Add this component to a camera to enable *screen-space reflections* (SSR). Screen-space reflectio... |
VolumetricFog | When placed on a [`bevy_core_pipeline::core_3d::Camera3d`], enables volumetric fog and volumetric lighting, also known as light shafts or god rays. |
VolumetricLight | Add this component to a [`DirectionalLight`](crate::DirectionalLight) with a shadow map (`shadows_enabled: true`) to make volumetric fog interact with it. This allows the light to generate light shafts/god rays. |
PickingBehavior | An optional component that overrides default picking behavior for an entity, allowing you to make ... |
PickingPlugin | This plugin sets up the core picking infrastructure. It receives input events, and provides the sha... |
HitData | Holds data from a successful pointer hit test. See [`HitData::depth`] for important details. |
RayId | Identifies a ray constructed from some (pointer, camera) combination. A pointer can be over multip... |
PickingInteraction | A component that aggregates picking interaction state of this entity across all pointers. Unlike ... |
PointerInputPlugin | Adds mouse and touch inputs for picking pointers to your app. This is a default input plugin, that... |
PointerId | Identifies a unique pointer entity. `Mouse` and `Touch` pointers are automatically spawned. This ... |
PointerInteraction | Holds a list of entities this pointer is currently interacting with, sorted from nearest to farthe... |
PointerLocation | Component that tracks a pointer's current [`Location`]. |
PointerPress | Tracks the state of the pointer's buttons in response to [`PointerInput`] events. |
AlphaMode | Sets how a material's base color alpha channel is used for transparency. |
Camera | The defining [`Component`] for camera entities, storing information about how and what to render through this camera. The [`Camera`]... |
CameraMainTextureUsages | This component lets you control the [`TextureUsages`] field of the main texture generated for the camera |
CameraRenderGraph | Configures the [`RenderGraph`](crate::render_graph::RenderGraph) name assigned to be run for a given [`Camera`] entity. |
Exposure | How much energy a `Camera3d` absorbs from incoming light. https://en\.wikipedia\.org/wiki/Exposure\_\(photography\) |
MipBias | Camera component specifying a mip bias to apply when sampling from material textures. Often used ... |
RenderTarget | The "target" that a [`Camera`] will render to. For example, this could be a [`Window`] swapchain o... |
SubCameraView | Settings to define a camera sub view. When [`Camera::sub_camera_view`] is `Some`, only the sub-section of the image defined by `size` and `offset` (relative to the `full_size` of the whole image) is projected to the cameras viewport. Take the example of the following multi-monitor setup: ```css ┌───┬───┐ │ A │ B │ ├───┼───┤ │ C │ D │ └───┴───┘ ``` If each monitor is 1920x1080, the whole image will have a resolution of 3840x2160. For each monitor we can use a single camera with a viewport of the same size as the monitor it corresponds to. To ensure that the image is cohesive, we can use a different sub view on each camera: - Camera A: `full_size` = 3840x2160, `size` = 1920x1080, `offset` = 0,0 - Camera B: `full_size` = 3840x2160, `size` = 1920x1080, `offset` = 1920,0 - Camera C: `full_size` = 3840x2160, `size` = 1920x1080, `offset` = 0,1080 - Camera D: `full_size` = 3840x2160, `size` = 1920x1080, `offset` = 1920,1080 However since only the ratio between the values is important, they could all be divided by 120 and still produce the same image. Camera D would for example have the following values: `full_size` = 32x18, `size` = 16x9, `offset` = 16,9 |
TemporalJitter | A subpixel offset to jitter a perspective camera's frustum by. Useful for temporal rendering tech... |
Viewport | Render viewport configuration for the [`Camera`] component. The viewport defines the area on the render target to which the camera renders its image. You can overlay multiple cameras in a single window using viewports to create effects like split screen, minimaps, and character viewers. |
ClearColor | A [`Resource`] that stores the color that is used to clear the screen between frames. This color appears as the "background" color for simple apps, when there are portions of the screen with nothing rendered. |
ClearColorConfig | For a camera, specifies the color used to clear the viewport before rendering. |
ManualTextureViewHandle | A unique id that corresponds to a specific [`ManualTextureView`] in the [`ManualTextureViews`] coll... |
OrthographicProjection | Project a 3D space onto a 2D surface using parallel lines, i.e., unlike [`PerspectiveProjection`], the size of objects remains the same regardless of their distance to the camera. The volume contained in the projection is called the *view frustum*. Since the viewport is rectangular and projection lines are parallel, the view frustum takes the shape of a cuboid. Note that the scale of the projection and the apparent size of objects are inversely proportional. As the size of the projection increases, the size of objects decreases. # Examples Configure the orthographic projection to one world unit per 100 window pixels: ``` # use bevy_render::camera::{OrthographicProjection, Projection, ScalingMode}; let projection = Projection::Orthographic(OrthographicProjection { scaling_mode: ScalingMode::WindowSize, scale: 0.01, ..OrthographicProjection::default_2d() }); ``` |
PerspectiveProjection | A 3D camera projection in which distant objects appear smaller than close objects. |
Projection | A configurable [`CameraProjection`] that can select its projection type at runtime. |
ScalingMode | Scaling mode for [`OrthographicProjection`]. The effect of these scaling modes are combined with the [`OrthographicProjection::scale`]... |
GlobalsUniform | Contains global values useful when writing shaders. Currently only contains values related to time... |
Mesh2d | A component for 2D meshes. Requires a [`MeshMaterial2d`] to be rendered, commonly using a [`ColorMaterial`... |
Mesh3d | A component for 3D meshes. Requires a [`MeshMaterial3d`] to be rendered, commonly using a [`StandardMaterial`... |
Aabb | An axis-aligned bounding box, defined by: - a center, - the distances from the center to each fac... |
CascadesFrusta | No Documentation 🚧 |
CubemapFrusta | No Documentation 🚧 |
Frustum | A region of 3D space defined by the intersection of 6 [`HalfSpace`]s. Frustums are typically an apex-truncated square pyramid (a pyramid without the top) or a cuboid. Half spaces are ordered left, right, top, bottom, near, far. The normal vectors of the half-spaces point towards the interior of the frustum. A frustum component is used on an entity with a [`Camera`]... |
ShaderStorageBuffer | A storage buffer that is prepared as a [`RenderAsset`] and uploaded to the GPU. |
SyncToRenderWorld | Marker component that indicates that its entity needs to be synchronized to the render world. Thi... |
ColorGrading | Configures filmic color grading parameters to adjust the image appearance. Color grading is appli... |
ColorGradingGlobal | Filmic color grading values applied to the image as a whole (as opposed to individual sections, li... |
ColorGradingSection | A section of color grading values that can be selectively applied to shadows, midtones, and highli... |
Msaa | Component for configuring the number of samples for [Multi-Sample Anti-Aliasing](https://en.wikipedia.org/wiki/Multisample_anti-aliasing) for a [`Camera`](crate::camera::Camera)... |
InheritedVisibility | Whether or not an entity is visible in the hierarchy. This will not be accurate until [`VisibilityPropagate`]... |
NoFrustumCulling | Use this component to opt-out of built-in frustum culling for entities, see [`Frustum`]. It can be used for example: - when a [`Mesh`]... |
ViewVisibility | Algorithmically-computed indication of whether an entity is visible and should be extracted for ren... |
Visibility | User indication of whether an entity is visible. Propagates down the entity hierarchy. If an enti... |
VisibleEntities | Collection of entities visible from the current view. This component contains all entities which ... |
VisibilityRange | Specifies the range of distances that this entity must be from the camera in order to be rendered.... |
RenderLayers | Describes which rendering layers an entity belongs to. Cameras with this component will only rend... |
Screenshot | A component that signals to the renderer to capture a screenshot this frame. This component shoul... |
ScreenshotCaptured | No Documentation 🚧 |
DynamicSceneRoot | Adding this component will spawn the scene as a child of that entity. Once it's spawned, the entit... |
SceneRoot | Adding this component will spawn the scene as a child of that entity. Once it's spawned, the entit... |
SpriteSource | A component that marks entities that aren't themselves sprites but become sprites during rendering... |
ColorMaterial | A [2d material](Material2d) that renders [2d meshes](crate::Mesh2d) with a texture tinted by a unif... |
AlphaMode2d | Sets how a 2d material's base color alpha channel is used for transparency. Currently, this only w... |
Anchor | How a sprite is positioned relative to its [`Transform`]. It defaults to `Anchor::Center`. |
Sprite | Describes a sprite to be rendered to a 2D camera |
SpriteImageMode | Controls how the image is altered when scaled. |
TextureAtlas | An index into a [`TextureAtlasLayout`], which corresponds to a specific section of a texture. It stores a handle to [`TextureAtlasLayout`]... |
TextureAtlasLayout | Stores a map used to lookup the position of a texture in a [`TextureAtlas`]. This can be used to either use and look up a specific section of a texture, or animate frame-by-frame as a sprite sheet. Optionally it can store a mapping from sub texture handles to the related area index (see [`TextureAtlasBuilder`]... |
BorderRect | Struct defining a [`Sprite`](crate::Sprite) border with padding values |
SliceScaleMode | Defines how a texture slice scales when resized |
TextureSlicer | Slices a texture using the **9-slicing** technique. This allows to reuse an image at various sizes ... |
ReflectableScheduleLabel | No Documentation 🚧 |
TextBounds | The maximum width and height of text. The text will wrap according to the specified size. Charact... |
GlyphAtlasInfo | Information about a glyph in an atlas. Rasterized glyphs are stored as rectangles in one or more... |
GlyphAtlasLocation | The location of a glyph in an atlas, and how it should be positioned when placed. Used in [`GlyphAtlasInfo`]... |
PositionedGlyph | A glyph of a font, typically representing a single character, positioned in screen space. Contain... |
TextLayoutInfo | Render information for a corresponding text block. Contains scaled glyphs and their size. Generat... |
Text2d | The top-level 2D text component. Adding `Text2d` to an entity will pull in required components fo... |
ComputedTextBlock | Computed information for a text block. See [`TextLayout`]. Automatically updated by 2d and UI text systems. |
FontSmoothing | Determines which antialiasing method to use when rendering text. By default, text is rendered with... |
JustifyText | Describes the horizontal alignment of multiple lines of text relative to each other. This only af... |
LineBreak | Determines how lines will be broken when preventing text from running out of bounds. |
TextColor | The color of the text for this section. |
TextEntity | A sub-entity of a [`ComputedTextBlock`]. Returned by [`ComputedTextBlock::entities`]. |
TextFont | `TextFont` determines the style of a text span within a [`ComputedTextBlock`], specifically the font face, the font size, and the color. |
TextLayout | Component with text format settings for a block of text. A block of text is composed of text span... |
TextSpan | A span of UI text in a tree of spans under an entity with [`TextLayout`] and `Text` or `Text2d`. Spans are collected in hierarchy traversal order into a [`ComputedTextBlock`]... |
UiScale | The current scale of the UI. A multiplier to fixed-sized ui values. **Note:** This will only aff... |
FocusPolicy | Describes whether the node should block interactions with lower nodes |
Interaction | Describes what type of input interaction has occurred for a UI node. This is commonly queried wit... |
RelativeCursorPosition | A component storing the position of the mouse relative to the node, (0., 0.) being the top-left cor... |
UiRect | A type which is commonly used to define margins, paddings and borders. # Examples ## Margin A... |
Val | Represents the possible value types for layout properties. This enum allows specifying values for... |
ContentSize | A node with a `ContentSize` component is a node where its size is based on its content. |
AlignContent | Used to control how items are distributed. - For Flexbox containers, controls alignment of lines i... |
AlignItems | Used to control how each individual item is aligned by default within the space they're given. - F... |
AlignSelf | Used to control how the specified item is aligned within the space it's given. - For Flexbox items... |
BackgroundColor | The background color of the node This serves as the "fill" color. |
BorderColor | The border color of the UI node. |
BorderRadius | Used to add rounded corners to a UI node. You can set a UI node to have uniformly rounded corners ... |
CalculatedClip | The calculated clip of the node |
ComputedNode | Provides the computed size and layout properties of the node. |
Display | Defines the layout model used by this node. Part of the [`Node`] component. |
FlexDirection | Defines how flexbox items are ordered within a flexbox |
FlexWrap | Defines if flexbox items appear on a single line or on multiple lines |
GridAutoFlow | Controls whether grid items are placed row-wise or column-wise as well as whether the sparse or den... |
GridPlacement | Represents the position of a grid item in a single axis. There are 3 fields which may be set: ... |
GridTrack | A [`GridTrack`] is a Row or Column of a CSS Grid. This struct specifies what size the track should be. See below for the different "track sizing functions" you can specify. |
GridTrackRepetition | How many times to repeat a repeated grid track <https://developer.mozilla.org/en-US/docs/Web/CSS/... |
JustifyContent | Used to control how items are distributed. - For Flexbox containers, controls alignment of items i... |
JustifyItems | Used to control how each individual item is aligned by default within the space they're given. - F... |
JustifySelf | Used to control how the specified item is aligned within the space it's given. - For Flexbox items... |
MaxTrackSizingFunction | No Documentation 🚧 |
MinTrackSizingFunction | No Documentation 🚧 |
Node | The base component for UI entities. It describes UI layout and style properties. When defining ne... |
Outline | The [`Outline`] component adds an outline outside the edge of a UI node. Outlines do not take up space in the layout. To add an [`Outline`]... |
Overflow | Whether to show or hide overflowing items |
OverflowAxis | Whether to show or hide overflowing items |
OverflowClipBox | Used to determine the bounds of the visible area when a UI node is clipped. |
OverflowClipMargin | The bounds of the visible area when a UI node is clipped. |
PositionType | The strategy used to position this node |
RepeatedGridTrack | Represents a *possibly* repeated [`GridTrack`]. The repetition parameter can either be: - The integer `1`, in which case the track is non-repeated. - a `u16` count to repeat the track N times. - A `GridTrackRepetition::AutoFit` or `GridTrackRepetition::AutoFill`. Note: that in the common case you want a non-repeating track (repetition count 1), you may use the constructor methods on [`GridTrack`]... |
ResolvedBorderRadius | Represents the resolved border radius values for a UI node. The values are in physical pixels. |
ScrollPosition | The scroll position of the node. Updating the values of `ScrollPosition` will reposition the chil... |
TargetCamera | Indicates that this root [`Node`] entity should be rendered to a specific camera. UI then will be laid out respecting the camera's viewport and scale factor, and rendered to this camera's [`bevy_render::camera::RenderTarget`]... |
UiAntiAlias | Marker for controlling whether Ui is rendered with or without anti-aliasing in a camera. By defaul... |
UiBoxShadowSamples | Number of shadow samples. A larger value will result in higher quality shadows. Default is 4, val... |
ZIndex | Indicates that this [`Node`] entity's front-to-back ordering is not controlled solely by its location in the UI hierarchy. A node with a higher z-index will appear on top of sibling nodes with a lower z-index. UI nodes that have the same z-index will appear according to the order in which they appear in the UI hierarchy. In such a case, the last node to be added to its parent will appear in front of its siblings. Nodes without this component will be treated as if they had a value of [`ZIndex(0)`]... |
Button | Marker struct for buttons |
ImageNode | A UI Node that renders an image. |
ImageNodeSize | The size of the image's texture This component is updated automatically by [`update_image_content_size_system`]... |
NodeImageMode | Controls how the image is altered to fit within the layout and how the layout algorithm determines ... |
Label | Marker struct for labels |
Text | The top-level UI text component. Adding [`Text`] to an entity will pull in required components for setting up a UI text node. The string in this component is the first 'text span' in a hierarchy of text spans that are collected into a [`ComputedTextBlock`]... |
TextNodeFlags | UI text system flags. Used internally by [`measure_text_system`] and [`text_system`] to schedule text for processing. |
AppLifecycle | Application lifetime events |
CursorEntered | An event that is sent whenever the user's cursor enters a window. |
CursorLeft | An event that is sent whenever the user's cursor leaves a window. |
CursorMoved | An event reporting that the mouse cursor has moved inside a window. The event is sent only if the... |
FileDragAndDrop | Events related to files being dragged and dropped on a window. |
Ime | A Input Method Editor event. This event is the translated version of the `WindowEvent::Ime` from ... |
RequestRedraw | An event that indicates all of the application's windows should be redrawn, even if their control ... |
WindowBackendScaleFactorChanged | An event that indicates a window's OS-reported scale factor has changed. |
WindowCloseRequested | An event that is sent whenever the operating systems requests that a window be closed. This will b... |
WindowClosed | An event that is sent whenever a window is closed. This will be sent when the window entity loses ... |
WindowClosing | An event that is sent whenever a window is closing. This will be sent when after a [`WindowCloseRequested`]... |
WindowCreated | An event that is sent whenever a new window is created. To create a new window, spawn an entity w... |
WindowDestroyed | An event that is sent whenever a window is destroyed by the underlying window system. Note that i... |
WindowEvent | Wraps all `bevy_window` and `bevy_input` events in a common enum. Read these events with `EventReader |
WindowFocused | An event that indicates a window has received or lost focus. |
WindowMoved | An event that is sent when a window is repositioned in physical pixels. |
WindowOccluded | The window has been occluded (completely hidden from view). This is different to window visibilit... |
WindowResized | A window event that is sent whenever a window's logical size has changed. |
WindowScaleFactorChanged | An event that indicates a window's scale factor has changed. |
WindowThemeChanged | An event sent when the system theme changes for a window. This event is only sent when the window... |
Monitor | Represents an available monitor as reported by the user's operating system, which can be used to q... |
VideoMode | Represents a video mode that a monitor supports |
SystemCursorIcon | The icon to display for a window. Examples of all of these cursors can be found [here](https://www.w3schools.com/cssref/playit.php?filename=playcss_cursor&preval=crosshair). This `enum` is simply a copy of a similar `enum` found in [`winit`](https://docs.rs/winit/latest/winit/window/enum.CursorIcon.html)... |
CompositeAlphaMode | Specifies how the alpha channel of the textures should be handled during compositing, for a [`Window`]... |
CursorGrabMode | Defines if and how the cursor is grabbed by a [`Window`]. ## Platform-specific - **`Windows`** doesn't support [`CursorGrabMode::Locked`]... |
CursorOptions | Cursor data for a [`Window`]. |
EnabledButtons | Specifies which [`Window`] control buttons should be enabled. ## Platform-specific **`iOS`**, **`Android`**, and the **`Web`** do not have window control buttons. On some **`Linux`** environments these values have no effect. |
InternalWindowState | Stores internal [`Window`] state that isn't directly accessible. |
MonitorSelection | References a screen monitor. Used when centering a [`Window`] on a monitor. |
PresentMode | Presentation mode for a [`Window`]. The presentation mode specifies when a frame is presented to the window. The [`Fifo`]... |
PrimaryWindow | Marker [`Component`] for the window considered the primary window. Currently this is assumed to only exist on 1 entity at a time. [`WindowPlugin`](crate::WindowPlugin)... |
Window | The defining [`Component`] for window entities, storing information about how it should appear and behave. Each window corresponds to an entity, and is uniquely identified by the value of their [`Entity`]... |
WindowLevel | Specifies where a [`Window`] should appear relative to other overlapping windows (on top or under) . Levels are groups of windows with respect to their z-position. The relative ordering between windows in different window levels is fixed. The z-order of windows within the same window level may change dynamically on user interaction. ## Platform-specific - **iOS / Android / Web / Wayland:** Unsupported. |
WindowMode | Defines the way a [`Window`] is displayed. |
WindowPosition | Defines where a [`Window`] should be placed on the screen. |
WindowRef | Reference to a [`Window`], whether it be a direct link to a specific entity or a more vague defaulting choice. |
WindowResizeConstraints | The size limits on a [`Window`]. These values are measured in logical pixels (see [`WindowResolution`... |
WindowResolution | Controls the size of a [`Window`] ## Physical, logical and requested sizes There are three sizes associated with a window: - the physical size, which represents the actual height and width in physical pixels the window occupies on the monitor, - the logical size, which represents the size that should be used to scale elements inside the window, measured in logical pixels, - the requested size, measured in logical pixels, which is the value submitted to the API when creating the window, or requesting that it be resized. ## Scale factor The reason logical size and physical size are separated and can be different is to account for the cases where: - several monitors have different pixel densities, - the user has set up a pixel density preference in its operating system, - the Bevy `App` has specified a specific scale factor between both. The factor between physical size and logical size can be retrieved with [`WindowResolution::scale_factor`]... |
WindowTheme | The [`Window`] theme variant to use. |
CursorIcon | Insert into a window entity to set the cursor for that window. |
CustomCursor | Custom cursor image data. |
bool | A boolean value |
char | An 8-bit character |
TypeId | No Documentation 🚧 |
NonZeroI16 | No Documentation 🚧 |
NonZeroU16 | No Documentation 🚧 |
NonZeroU32 | No Documentation 🚧 |
f32 | A 32-bit floating point number |
f64 | A 64-bit floating point number |
i128 | A signed 128-bit integer |
i16 | A signed 16-bit integer |
i32 | A signed 32-bit integer |
i64 | A signed 64-bit integer |
i8 | A signed 8-bit integer |
isize | A signed pointer-sized integer |
NodeIndex | No Documentation 🚧 |
u128 | An unsigned 128-bit integer |
u16 | An unsigned 16-bit integer |
u32 | An unsigned 32-bit integer |
u64 | An unsigned 64-bit integer |
u8 | An unsigned 8-bit integer |
usize | An unsigned pointer-sized integer |
Cow | No Documentation 🚧 |
Arc | No Documentation 🚧 |
Vec<String> | No Documentation 🚧 |
Vec<TimedAnimationEvent> | No Documentation 🚧 |
Vec<AnimationTransition> | No Documentation 🚧 |
Vec<Entity> | No Documentation 🚧 |
Vec<URect> | No Documentation 🚧 |
Vec<ScriptQueryResult> | No Documentation 🚧 |
Vec<ReflectReference> | No Documentation 🚧 |
Vec<FunctionArgInfo> | No Documentation 🚧 |
Vec<FunctionInfo> | No Documentation 🚧 |
Vec<Cascade> | No Documentation 🚧 |
Vec<ReflectSystem> | No Documentation 🚧 |
Vec<PositionedGlyph> | No Documentation 🚧 |
Vec<GridTrack> | No Documentation 🚧 |
Vec<RepeatedGridTrack> | No Documentation 🚧 |
Vec<VideoMode> | No Documentation 🚧 |
Vec<f32> | No Documentation 🚧 |
Vec<NodeIndex> | No Documentation 🚧 |
Vec<u16> | No Documentation 🚧 |
Vec<u32> | No Documentation 🚧 |
Vec<u64> | No Documentation 🚧 |
Handle<Unknown> | A strong or weak handle to a specific [`Asset`]. If a [`Handle`] is [`Handle::Strong`], the [`Asset... |
Handle<AnimationClip> | A strong or weak handle to a specific [`Asset`]. If a [`Handle`] is [`Handle::Strong`], the [`Asset... |
Handle<AnimationGraph> | A strong or weak handle to a specific [`Asset`]. If a [`Handle`] is [`Handle::Strong`], the [`Asset... |
Handle<Image> | A strong or weak handle to a specific [`Asset`]. If a [`Handle`] is [`Handle::Strong`], the [`Asset... |
Handle<Mesh> | A strong or weak handle to a specific [`Asset`]. If a [`Handle`] is [`Handle::Strong`], the [`Asset... |
Handle<StandardMaterial> | A strong or weak handle to a specific [`Asset`]. If a [`Handle`] is [`Handle::Strong`], the [`Asset... |
Handle<ShaderStorageBuffer> | A strong or weak handle to a specific [`Asset`]. If a [`Handle`] is [`Handle::Strong`], the [`Asset... |
Handle<ColorMaterial> | A strong or weak handle to a specific [`Asset`]. If a [`Handle`] is [`Handle::Strong`], the [`Asset... |
Handle<TextureAtlasLayout> | A strong or weak handle to a specific [`Asset`]. If a [`Handle`] is [`Handle::Strong`], the [`Asset... |
AssetId<Unknown> | 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`]... |
AssetId<AnimationClip> | 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`]... |
AssetId<AnimationGraph> | 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`]... |
AssetId<Image> | 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`]... |
AssetId<Mesh> | 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`]... |
AssetId<StandardMaterial> | 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`]... |
AssetId<ShaderStorageBuffer> | 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`]... |
AssetId<ColorMaterial> | 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`]... |
AssetId<TextureAtlasLayout> | 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`]... |
Axis<GamepadInput> | Stores the position data of the input devices of type `T`. The values are stored as `f32`s, using... |
ButtonInput<GamepadButton> | A "press-able" input of type `T`. ## Usage This type can be used as a resource to keep the curr... |
MeshMaterial3d<StandardMaterial> | A [material](Material) used for rendering a [`Mesh3d`]. See [`Material`] for general information about 3D materials and how to implement your own materials. [`Mesh3d`]... |
MeshMaterial2d<ColorMaterial> | A [material](Material2d) used for rendering a [`Mesh2d`]. See [`Material2d`] for general information about 2D materials and how to implement your own materials. # Example ``` # use bevy_sprite::{ColorMaterial, MeshMaterial2d}; # use bevy_ecs::prelude::*; # use bevy_render::mesh::{Mesh, Mesh2d}; # use bevy_color::palettes::basic::RED; # use bevy_asset::Assets; # use bevy_math::primitives::Circle; # // Spawn an entity with a mesh using `ColorMaterial`. fn setup( mut commands: Commands, mut meshes: ResMut<Assets |
Time<Unknown> | A generic clock resource that tracks how much it has advanced since its previous update and since ... |
Time<Fixed> | A generic clock resource that tracks how much it has advanced since its previous update and since ... |
Time<Real> | A generic clock resource that tracks how much it has advanced since its previous update and since ... |
Time<Virtual> | A generic clock resource that tracks how much it has advanced since its previous update and since ... |
Range | No Documentation 🚧 |
Range | No Documentation 🚧 |
Option<Unknown> | No Documentation 🚧 |
Option<String> | No Documentation 🚧 |
Option<SpatialScale> | No Documentation 🚧 |
Option<Color> | No Documentation 🚧 |
Option<Entity> | No Documentation 🚧 |
Option<ForceTouch> | No Documentation 🚧 |
Option<CompassOctant> | No Documentation 🚧 |
Option<Rect> | No Documentation 🚧 |
Option<Indices> | No Documentation 🚧 |
Option<ReflectReference> | No Documentation 🚧 |
Option<ScriptValue> | No Documentation 🚧 |
Option<SubCameraView> | No Documentation 🚧 |
Option<Viewport> | No Documentation 🚧 |
Option<TextureAtlas> | No Documentation 🚧 |
Option<ReflectSchedule> | No Documentation 🚧 |
Option<ReflectSystem> | No Documentation 🚧 |
Option<Instant> | No Documentation 🚧 |
Option<WindowTheme> | No Documentation 🚧 |
Option<bool> | No Documentation 🚧 |
Option<char> | No Documentation 🚧 |
Option<NonZeroI16> | No Documentation 🚧 |
Option<NonZeroU16> | No Documentation 🚧 |
Option<NonZeroU32> | No Documentation 🚧 |
Option<f32> | No Documentation 🚧 |
Option<f64> | No Documentation 🚧 |
Option<DVec2> | No Documentation 🚧 |
Option<Vec2> | No Documentation 🚧 |
Option<Vec3> | No Documentation 🚧 |
Option<NodeIndex> | No Documentation 🚧 |
Option<u16> | No Documentation 🚧 |
Option<u32> | No Documentation 🚧 |
Option<usize> | No Documentation 🚧 |
SmallVec<Unknown> | No Documentation 🚧 |
SmallVec<Unknown> | No Documentation 🚧 |
SmallVec<Unknown> | No Documentation 🚧 |
SmallVec<Unknown> | No Documentation 🚧 |
Vec<Unknown> | No Documentation 🚧 |
Vec<Range> | No Documentation 🚧 |
HashSet<GamepadButton> | No Documentation 🚧 |
Option<Unknown> | No Documentation 🚧 |
Option<Unknown> | No Documentation 🚧 |
Option<Cow> | No Documentation 🚧 |
Option<Vec<String>> | No Documentation 🚧 |
Option<Handle<Image>> | No Documentation 🚧 |
Option<Handle<Mesh>> | No Documentation 🚧 |
Result<Unknown, InteropError> | No Documentation 🚧 |
Result<String, InteropError> | No Documentation 🚧 |
Result<Entity, InteropError> | No Documentation 🚧 |
Result<DynamicFunctionMut, InteropError> | No Documentation 🚧 |
Result<ScriptComponentRegistration, ScriptResourceRegistration> | No Documentation 🚧 |
Result<ScriptComponentRegistration, InteropError> | No Documentation 🚧 |
Result<ScriptQueryBuilder, InteropError> | No Documentation 🚧 |
Result<ReflectReference, InteropError> | No Documentation 🚧 |
Result<ScriptSystemBuilder, InteropError> | No Documentation 🚧 |
Result<ScriptValue, InteropError> | No Documentation 🚧 |
Result<ReflectSystem, InteropError> | No Documentation 🚧 |
Result<bool, InteropError> | No Documentation 🚧 |
HashMap<AnimationTargetId, u64> | No Documentation 🚧 |
HashMap<GamepadAxis, AxisSettings> | No Documentation 🚧 |
HashMap<GamepadButton, ButtonAxisSettings> | No Documentation 🚧 |
HashMap<GamepadButton, ButtonSettings> | No Documentation 🚧 |
HashMap<GamepadInput, f32> | No Documentation 🚧 |
HashMap<NodeIndex, ActiveAnimation> | No Documentation 🚧 |
HashMap<NodeIndex, f32> | No Documentation 🚧 |
Result<Vec<Entity>, InteropError> | No Documentation 🚧 |
Result<Vec<ScriptQueryResult>, InteropError> | No Documentation 🚧 |
Result<Vec<FunctionInfo>, InteropError> | No Documentation 🚧 |
Result<Vec<ReflectSystem>, InteropError> | No Documentation 🚧 |
Result<Option<String>, InteropError> | No Documentation 🚧 |
Result<Option<Entity>, InteropError> | No Documentation 🚧 |
Result<Option<ReflectReference>, InteropError> | No Documentation 🚧 |
Result<Option<ScriptValue>, InteropError> | No Documentation 🚧 |
Result<Option<ReflectSchedule>, InteropError> | No Documentation 🚧 |
Result<Option<ReflectSystem>, InteropError> | No Documentation 🚧 |
Result<Option<usize>, InteropError> | No Documentation 🚧 |
DiGraph | No Documentation 🚧 |
HashMap<String, ScriptValue> | No Documentation 🚧 |
HashMap<AnimationEventTarget, Vec<TimedAnimationEvent>> | No Documentation 🚧 |
HashMap<AssetId<AnimationGraph>, ThreadedAnimationGraph> | No Documentation 🚧 |
HashMap<Entity, Vec<Cascade>> | No Documentation 🚧 |
Result<ScriptTypeRegistration, Result<ScriptComponentRegistration, ScriptResourceRegistration>> | No Documentation 🚧 |
Option<Result<ScriptTypeRegistration, Result<ScriptComponentRegistration, ScriptResourceRegistration>>> | No Documentation 🚧 |
Result<Option<Result<ScriptTypeRegistration, Result<ScriptComponentRegistration, ScriptResourceRegistration>>>, InteropError> | No Documentation 🚧 |
World
Opaque Type. 🔒
Description
The ECS world containing all Components, Resources and Systems. Main point of interaction with a Bevy App.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
add_system | Adds the given system to the world. |
despawn | Despawns the given entity. |
has_resource | Checks if the world has the given resource. |
exit | Quits the program. |
despawn_recursive | Despawns the entity and all its descendants. |
remove_component | Removes the given component from the entity. |
push_children | Pushes the given children entities into the provided parent entity. |
has_entity | Checks if the given entity exists. |
get_type_by_name | Returns either a `ScriptComponentRegistration` or `ScriptResourceRegistration` depending on the type... |
spawn | Spawns a new entity and returns it |
add_default_component | Adds the given resource to the world. |
get_component | Tries to retrieve the given component type on an entity. |
get_parent | Retrieves the parent of the given entity. |
insert_children | Inserts the given children entities into the provided parent entity. |
query | Creates a new `ScriptQueryBuilder` which can be used to query the ECS. Returns: * `query`: The new query builder. |
remove_resource | Removes the given resource from the world. |
register_new_component | Registers a new component type with the world. The component will behave like any other native comp... |
insert_component | Inserts the given component value into the provided entity |
get_resource | Retrieves the resource with the given registration. |
has_component | Checks if the given entity has the given component. |
get_children | Retrieves the children of the given entity. |
despawn_descendants | Despawn the descendants of the given entity. |
get_schedule_by_name | Retrieves the schedule with the given name, Also ensures the schedule is initialized before returnin... |
add_system
Adds the given system to the world.
Arguments
Name | Type | Documentation |
---|---|---|
schedule | ReflectSchedule | The schedule to add the system to. |
builder | ScriptSystemBuilder | The system builder specifying the system and its dependencies. |
Returns
Name | Type | Documentation |
---|---|---|
system | ReflectSystem | The system that was added. |
despawn
Despawns the given entity.
Arguments
Name | Type | Documentation |
---|---|---|
entity | Entity | The entity to despawn. |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
has_resource
Checks if the world has the given resource.
Arguments
Name | Type | Documentation |
---|---|---|
registration | ScriptResourceRegistration | The registration of the resource to check for. |
Returns
Name | Type | Documentation |
---|---|---|
has_resource | bool | Whether the world has the resource. |
exit
Quits the program.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
result | () | Nothing if the program was exited successfully. |
despawn_recursive
Despawns the entity and all its descendants.
Arguments
Name | Type | Documentation |
---|---|---|
entity | Entity | The entity to despawn recursively. |
Returns
Name | Type | Documentation |
---|---|---|
result | () | Nothing if the entity and its descendants were despawned successfully. |
remove_component
Removes the given component from the entity.
Arguments
Name | Type | Documentation |
---|---|---|
entity | Entity | The entity to remove the component from. |
registration | ScriptComponentRegistration | The component to remove. |
Returns
Name | Type | Documentation |
---|---|---|
result | () | Nothing if the component was removed successfully or didn't exist in the first place. |
push_children
Pushes the given children entities into the provided parent entity.
Arguments
Name | Type | Documentation |
---|---|---|
entity | Entity | The parent entity to receive children |
children | Vec<Entity> | The children entities to push |
Returns
Name | Type | Documentation |
---|---|---|
result | () | Nothing if the children were pushed successfully. |
has_entity
Checks if the given entity exists.
Arguments
Name | Type | Documentation |
---|---|---|
e | Entity | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
has_entity | bool | Whether the entity exists. |
get_type_by_name
Returns either a
ScriptComponentRegistration
orScriptResourceRegistration
depending on the type of the type requested. If the type is neither returns aScriptTypeRegistration
.
Arguments
Name | Type | Documentation |
---|---|---|
type_name | String | The name of the type to retrieve. |
Returns
Name | Type | Documentation |
---|---|---|
type | Optional<ScriptTypeRegistration | ScriptComponentRegistration | ScriptResourceRegistration> | The registration of the type, if it exists. |
spawn
Spawns a new entity and returns it
Arguments
Returns
Name | Type | Documentation |
---|---|---|
entity | Entity | The newly spawned entity |
add_default_component
Adds the given resource to the world.
Arguments
Name | Type | Documentation |
---|---|---|
entity | Entity | No Documentation 🚧 |
registration | ScriptComponentRegistration | The resource to add. |
Returns
Name | Type | Documentation |
---|---|---|
result | () | Nothing if the resource was added successfully. |
get_component
Tries to retrieve the given component type on an entity.
Arguments
Name | Type | Documentation |
---|---|---|
entity | Entity | The entity to retrieve the component from. |
registration | ScriptComponentRegistration | The component to retrieve. |
Returns
Name | Type | Documentation |
---|---|---|
component | Optional<ReflectReference> | The component on the entity, if it exists. |
get_parent
Retrieves the parent of the given entity.
Arguments
Name | Type | Documentation |
---|---|---|
entity | Entity | The entity to retrieve the parent of. |
Returns
Name | Type | Documentation |
---|---|---|
parent | Optional<Entity> | The parent of the entity |
insert_children
Inserts the given children entities into the provided parent entity.
Arguments
Name | Type | Documentation |
---|---|---|
entity | Entity | The parent entity to receive children |
index | usize | The index to insert the children at |
children | Vec<Entity> | The children entities to insert |
Returns
Name | Type | Documentation |
---|---|---|
result | () | Nothing if the children were inserted successfully. |
query
Creates a new
ScriptQueryBuilder
which can be used to query the ECS.Returns:
query
: The new query builder.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | ScriptQueryBuilder | No Documentation 🚧 |
remove_resource
Removes the given resource from the world.
Arguments
Name | Type | Documentation |
---|---|---|
registration | ScriptResourceRegistration | The resource to remove. |
Returns
Name | Type | Documentation |
---|---|---|
result | () | Nothing if the resource was removed successfully or didn't exist in the first place. |
register_new_component
Registers a new component type with the world.
The component will behave like any other native component for all intents and purposes. The type that will be instantiated to back this component will be
DynamicComponent
which contains just one field:
data
This field can be set to any value and modified freely.
Arguments
Name | Type | Documentation |
---|---|---|
name | String | The name of the component type |
Returns
Name | Type | Documentation |
---|---|---|
registration | ScriptComponentRegistration | The registration of the new component type if successful. |
insert_component
Inserts the given component value into the provided entity
Arguments
Name | Type | Documentation |
---|---|---|
entity | Entity | The entity to insert the component into. |
registration | ScriptComponentRegistration | The component registration of the component to insert. |
value | ReflectReference | The value of the component to insert. Can be constructed using construct |
Returns
Name | Type | Documentation |
---|---|---|
result | () | Nothing if the component was inserted successfully. |
get_resource
Retrieves the resource with the given registration.
Arguments
Name | Type | Documentation |
---|---|---|
registration | ScriptResourceRegistration | The registration of the resource to retrieve. |
Returns
Name | Type | Documentation |
---|---|---|
resource | Optional<ReflectReference> | The resource, if it exists. |
has_component
Checks if the given entity has the given component.
Arguments
Name | Type | Documentation |
---|---|---|
entity | Entity | The entity to check. |
registration | ScriptComponentRegistration | The component to check for. |
Returns
Name | Type | Documentation |
---|---|---|
has_component | bool | Whether the entity has the component. |
get_children
Retrieves the children of the given entity.
Arguments
Name | Type | Documentation |
---|---|---|
entity | Entity | The entity to retrieve the children of. |
Returns
Name | Type | Documentation |
---|---|---|
children | Vec<Entity> | The children of the entity. |
despawn_descendants
Despawn the descendants of the given entity.
Arguments
Name | Type | Documentation |
---|---|---|
entity | Entity | The entity to despawn the descendants of. |
Returns
Name | Type | Documentation |
---|---|---|
result | () | Nothing if the descendants were despawned successfully. |
get_schedule_by_name
Retrieves the schedule with the given name, Also ensures the schedule is initialized before returning it.
Schedules in bevy are "containers" for systems, each schedule runs separately and contains different systems.
By default among others bevy contains the following schedules:
Update
: Runs every frame.PostUpdate
: Runs after theUpdate
schedule.FixedUpdate
: Runs at a fixed rate.
Arguments
Name | Type | Documentation |
---|---|---|
name | String | The name of the schedule to retrieve. |
Returns
Name | Type | Documentation |
---|---|---|
schedule | Optional<ReflectSchedule> | The schedule with the given name, if it exists |
ReflectReference
Opaque Type. 🔒
Description
A reference to an arbitrary reflected instance.
The reference can point to either the ECS, or to the allocator.
References are composed of two parts:
- The base kind, which specifies where the reference points to
- The path, which specifies how to access the value from the base.
Bindings defined on this type, apply to ALL references.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
iter | Iterates over the reference, if the reference is an appropriate container type. Returns an "next" i... |
remove | Removes the value at the specified key from the reference, if the reference is an appropriate contai... |
insert | Inserts the value into the reference at the specified index, if the reference is an appropriate cont... |
functions | Lists the functions available on the reference. |
variant_name | If this type is an enum, will return the name of the variant it represents on the type. |
pop | Pops the value from the reference, if the reference is an appropriate container type. |
len | Retrieves the length of the reference, if the reference is an appropriate container type. |
display_value | Displays the "value" of this reference This is useful for debugging and logging. |
clear | Clears the container, if the reference is an appropriate container type. |
display_ref | Displays this reference without printing the exact contents. This is useful for debugging and loggi... |
push | Pushes the value into the reference, if the reference is an appropriate container type. |
map_get | Gets and clones the value under the specified key if the underlying type is a map type. |
iter
Iterates over the reference, if the reference is an appropriate container type.
Returns an "next" iterator function.
The iterator function should be called until it returns
nil
to signal the end of the iteration.
Arguments
Name | Type | Documentation |
---|---|---|
reference | ReflectReference | The reference to iterate over. |
Returns
Name | Type | Documentation |
---|---|---|
iter | DynamicFunctionMut | The iterator function. |
remove
Removes the value at the specified key from the reference, if the reference is an appropriate container type.
Arguments
Name | Type | Documentation |
---|---|---|
reference | ReflectReference | The reference to remove the value from. |
key | ScriptValue | The key to remove the value at. |
Returns
Name | Type | Documentation |
---|---|---|
result | ScriptValue | The removed value if any |
insert
Inserts the value into the reference at the specified index, if the reference is an appropriate container type.
Arguments
Name | Type | Documentation |
---|---|---|
reference | ReflectReference | The reference to insert the value into. |
key | ScriptValue | The index to insert the value at. |
value | ScriptValue | The value to insert. |
Returns
Name | Type | Documentation |
---|---|---|
result | () | Nothing if the value was inserted successfully. |
functions
Lists the functions available on the reference.
Arguments
Name | Type | Documentation |
---|---|---|
reference | ReflectReference | The reference to list the functions of. |
Returns
Name | Type | Documentation |
---|---|---|
functions | Vec<FunctionInfo> | The functions available on the reference. |
variant_name
If this type is an enum, will return the name of the variant it represents on the type.
Arguments
Name | Type | Documentation |
---|---|---|
reference | ReflectReference | The reference to get the variant name of. |
Returns
Name | Type | Documentation |
---|---|---|
variant_name | Optional<String> | The name of the variant, if the reference is an enum. |
pop
Pops the value from the reference, if the reference is an appropriate container type.
Arguments
Name | Type | Documentation |
---|---|---|
reference | ReflectReference | The reference to pop the value from. |
Returns
Name | Type | Documentation |
---|---|---|
value | ScriptValue | The value that was popped, if the reference supports popping. |
len
Retrieves the length of the reference, if the reference is an appropriate container type.
Arguments
Name | Type | Documentation |
---|---|---|
reference | ReflectReference | The reference to get the length of. |
Returns
Name | Type | Documentation |
---|---|---|
len | Optional<usize> | The length of the reference, if the reference is a container. |
display_value
Displays the "value" of this reference
This is useful for debugging and logging.
Arguments
Name | Type | Documentation |
---|---|---|
reference | ReflectReference | The reference to display. |
Returns
Name | Type | Documentation |
---|---|---|
display | String | The display string. |
clear
Clears the container, if the reference is an appropriate container type.
Arguments
Name | Type | Documentation |
---|---|---|
reference | ReflectReference | The reference to clear. |
Returns
Name | Type | Documentation |
---|---|---|
result | () | Nothing if the reference was cleared |
display_ref
Displays this reference without printing the exact contents.
This is useful for debugging and logging.
Arguments
Name | Type | Documentation |
---|---|---|
reference | ReflectReference | The reference to display. |
Returns
Name | Type | Documentation |
---|---|---|
display | String | The display string. |
push
Pushes the value into the reference, if the reference is an appropriate container type.
Arguments
Name | Type | Documentation |
---|---|---|
reference | ReflectReference | The reference to push the value into. |
value | ScriptValue | The value to push. |
Returns
Name | Type | Documentation |
---|---|---|
result | () | Nothing if the value was pushed successfully. |
map_get
Gets and clones the value under the specified key if the underlying type is a map type.
Arguments
Name | Type | Documentation |
---|---|---|
reference | ReflectReference | The reference to index into. |
key | ScriptValue | The key to index with. |
Returns
Name | Type | Documentation |
---|---|---|
value | Optional<ScriptValue> | The value at the key, if the reference is a map. |
ScriptComponentRegistration
ScriptComponentRegistration
- registration:bevy_mod_scripting_core::bindings::query::ScriptTypeRegistration
- component_id:bevy_ecs::component::ComponentId
- is_dynamic_script_component:bool
Description
A reference to a component type's reflection registration.
In general think of this as a handle to a type.
Not to be confused with script registered dynamic components, although this can point to a script registered component.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
short_name | Retrieves the short name of the type. The short name is a more human-readable version of the type na... |
type_name | Retrieves the name of the type. |
short_name
Retrieves the short name of the type. The short name is a more human-readable version of the type name.
Arguments
Name | Type | Documentation |
---|---|---|
registration | ScriptComponentRegistration | The type registration. |
Returns
Name | Type | Documentation |
---|---|---|
short_name | str | The short name of the |
type_name
Retrieves the name of the type.
Arguments
Name | Type | Documentation |
---|---|---|
registration | ScriptComponentRegistration | The type registration. |
Returns
Name | Type | Documentation |
---|---|---|
type_name | str | The name of the type. |
ScriptQueryBuilder
Opaque Type. 🔒
Description
The query builder is used to build ECS queries which retrieve spefific components filtered by specific conditions.
For example:
builder.component(componentA) .component(componentB) .with(componentC) .without(componentD)
Will retrieve entities which:
- Have componentA
- Have componentB
- Have componentC
- Do not have componentD
As well as references to components:
- componentA
- componentB
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
without | Adds a component to filter the query by. This component will NOT be retrieved. |
with | Adds a component to filter the query by. This component will NOT be retrieved. |
build | Builds the query and retrieves the entities and component references. |
component | Adds a component to be retrieved by the query |
without
Adds a component to filter the query by. This component will NOT be retrieved.
Arguments
Name | Type | Documentation |
---|---|---|
query | ScriptQueryBuilder | The query to add the component to |
without | ScriptComponentRegistration | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
query | ScriptQueryBuilder | The query with the component added |
with
Adds a component to filter the query by. This component will NOT be retrieved.
Arguments
Name | Type | Documentation |
---|---|---|
query | ScriptQueryBuilder | The query to add the component to |
with | ScriptComponentRegistration | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
query | ScriptQueryBuilder | The query with the component added |
build
Builds the query and retrieves the entities and component references.
Arguments
Name | Type | Documentation |
---|---|---|
query | ScriptQueryBuilder | The query to build. |
Returns
Name | Type | Documentation |
---|---|---|
result | Vec<ScriptQueryResult> | The entities and component references that match the query. |
component
Adds a component to be retrieved by the query
Arguments
Name | Type | Documentation |
---|---|---|
query | ScriptQueryBuilder | The query to add the component to |
components | ScriptComponentRegistration | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
query | ScriptQueryBuilder | The query with the component added |
ScriptQueryResult
Opaque Type. 🔒
Description
A result from a query.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
entity | Retrieves the entity from the query result. |
components | Retrieves the components from the query result. These are ordered by the order they were added to t... |
entity
Retrieves the entity from the query result.
Arguments
Name | Type | Documentation |
---|---|---|
query | ScriptQueryResult | The query result to retrieve the entity from. |
Returns
Name | Type | Documentation |
---|---|---|
entity | Entity | The entity from the query result. |
components
Retrieves the components from the query result.
These are ordered by the order they were added to the query.
Arguments
Name | Type | Documentation |
---|---|---|
query | ScriptQueryResult | The query result to retrieve the components from. |
Returns
Name | Type | Documentation |
---|---|---|
components | Vec<ReflectReference> | The components from the query result. |
ScriptResourceRegistration
ScriptResourceRegistration
- registration:bevy_mod_scripting_core::bindings::query::ScriptTypeRegistration
- resource_id:bevy_ecs::component::ComponentId
Description
A reference to a resource type's reflection registration.
In general think of this as a handle to a type.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
short_name | Retrieves the short name of the type. The short name is a more human-readable version of the type na... |
type_name | Retrieves the name of the type. |
short_name
Retrieves the short name of the type. The short name is a more human-readable version of the type name.
Arguments
Name | Type | Documentation |
---|---|---|
registration | ScriptResourceRegistration | The type registration. |
Returns
Name | Type | Documentation |
---|---|---|
short_name | str | The short name of the |
type_name
Retrieves the name of the type.
Arguments
Name | Type | Documentation |
---|---|---|
registration | ScriptResourceRegistration | The type registration. |
Returns
Name | Type | Documentation |
---|---|---|
type_name | str | The name of the type. |
ScriptTypeRegistration
Opaque Type. 🔒
Description
A reference to a type which is not a
Resource
orComponent
.In general think of this as a handle to a type.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
short_name | Retrieves the short name of the type. The short name is a more human-readable version of the type na... |
type_name | Retrieves the name of the type. |
short_name
Retrieves the short name of the type. The short name is a more human-readable version of the type name.
Arguments
Name | Type | Documentation |
---|---|---|
registration | ScriptTypeRegistration | The type registration. |
Returns
Name | Type | Documentation |
---|---|---|
short_name | String | The short name of the |
type_name
Retrieves the name of the type.
Arguments
Name | Type | Documentation |
---|---|---|
registration | ScriptTypeRegistration | The type registration. |
Returns
Name | Type | Documentation |
---|---|---|
type_name | String | The name of the type. |
ScriptSystemBuilder
Opaque Type. 🔒
Description
A builder for systems living in scripts
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
after | Specifies the system is to run *after* the given system Note: this is an experimental feature, and ... |
query | Adds a query to the system builder. |
resource | Requests the system have access to the given resource. The resource will be added to the list of arg... |
before | Specifies the system is to run *before* the given system. Note: this is an experimental feature, an... |
exclusive | Specifies the system is to run exclusively, meaning it can access anything, but will not run in para... |
after
Specifies the system is to run after the given system
Note: this is an experimental feature, and the ordering might not work correctly for script initialized systems
Arguments
Name | Type | Documentation |
---|---|---|
builder | ScriptSystemBuilder | The system builder to add the dependency to. |
system | ReflectSystem | The system to run after. |
Returns
Name | Type | Documentation |
---|---|---|
builder | ScriptSystemBuilder | The system builder with the dependency added. |
query
Adds a query to the system builder.
Arguments
Name | Type | Documentation |
---|---|---|
builder | ScriptSystemBuilder | The system builder to add the query to. |
query | ScriptQueryBuilder | The query to add. |
Returns
Name | Type | Documentation |
---|---|---|
builder | ScriptSystemBuilder | The system builder with the query added. |
resource
Requests the system have access to the given resource. The resource will be added to the list of arguments of the callback in the order they're provided.
Arguments
Name | Type | Documentation |
---|---|---|
builder | ScriptSystemBuilder | The system builder to add the resource to. |
resource | ScriptResourceRegistration | The resource to add. |
Returns
Name | Type | Documentation |
---|---|---|
builder | ScriptSystemBuilder | The system builder with the resource added. |
before
Specifies the system is to run before the given system.
Note: this is an experimental feature, and the ordering might not work correctly for script initialized systems
Arguments
Name | Type | Documentation |
---|---|---|
builder | ScriptSystemBuilder | The system builder to add the dependency to. |
system | ReflectSystem | The system to run before. |
Returns
Name | Type | Documentation |
---|---|---|
builder | ScriptSystemBuilder | The system builder with the dependency added. |
exclusive
Specifies the system is to run exclusively, meaning it can access anything, but will not run in parallel with other systems.
Arguments
Name | Type | Documentation |
---|---|---|
builder | ScriptSystemBuilder | The system builder to make exclusive. |
Returns
Name | Type | Documentation |
---|---|---|
builder | ScriptSystemBuilder | The system builder that is now exclusive. |
ReflectSchedule
ReflectSchedule
- type_path:str
- label:bevy_system_reflection::ReflectableScheduleLabel
Description
A reflectable schedule.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
get_system_by_name | Retrieves the system with the given name in the schedule |
systems | Retrieves all the systems in the schedule. |
render_dot | Renders the schedule as a dot graph string. Useful for debugging scheduling. |
get_system_by_name
Retrieves the system with the given name in the schedule
Arguments
Name | Type | Documentation |
---|---|---|
schedule | ReflectSchedule | The schedule to retrieve the system from. |
name | String | The identifier or full path of the system to retrieve. |
Returns
Name | Type | Documentation |
---|---|---|
system | Optional<ReflectSystem> | The system with the given name, if it exists. |
systems
Retrieves all the systems in the schedule.
Arguments
Name | Type | Documentation |
---|---|---|
schedule | ReflectSchedule | The schedule to retrieve the systems from. |
Returns
Name | Type | Documentation |
---|---|---|
systems | Vec<ReflectSystem> | The systems in the schedule. |
render_dot
Renders the schedule as a dot graph string.
Useful for debugging scheduling.
Arguments
Name | Type | Documentation |
---|---|---|
schedule | ReflectSchedule | The schedule to render. |
Returns
Name | Type | Documentation |
---|---|---|
dot | String | The dot graph string. |
ReflectSystem
Opaque Type. 🔒
Description
A reflectable system.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
path | Retrieves the full path of the system |
identifier | Retrieves the identifier of the system |
path
Retrieves the full path of the system
Arguments
Name | Type | Documentation |
---|---|---|
system | ReflectSystem | The system to retrieve the path from. |
Returns
Name | Type | Documentation |
---|---|---|
path | String | The full path of the system, e.g. my_crate::systems::my_system<T> |
identifier
Retrieves the identifier of the system
Arguments
Name | Type | Documentation |
---|---|---|
system | ReflectSystem | The system to retrieve the identifier from. |
Returns
Name | Type | Documentation |
---|---|---|
identifier | String | The identifier of the system, e.g. my_system |
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.
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Name | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Name | 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()
].
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
index | Returns the index of the current component. |
eq | No Documentation 🚧 |
new | 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 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | ComponentId | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | ComponentId | No Documentation 🚧 |
index
Returns the index of the current component.
Arguments
Name | Type | Documentation |
---|---|---|
_self | ComponentId | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | usize | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | ComponentId | No Documentation 🚧 |
other | ComponentId | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
index | usize | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | ComponentId | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | ComponentId | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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).
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
is_changed | Returns `true` if the component or resource was added or mutably dereferenced after the system last... |
is_added | Returns `true` if the component or resource was added after the system last ran (or the system is ... |
set_changed | Manually sets the change tick. This is normally done automatically via the [`DerefMut`](std::ops::DerefMut) implementation on [`Mut |
new | Creates a new instance with the same change tick for `added` and `changed`. |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | ComponentTicks | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | ComponentTicks | 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
Name | Type | Documentation |
---|---|---|
_self | ComponentTicks | No Documentation 🚧 |
last_run | Tick | No Documentation 🚧 |
this_run | Tick | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | ComponentTicks | No Documentation 🚧 |
last_run | Tick | No Documentation 🚧 |
this_run | Tick | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | ComponentTicks | No Documentation 🚧 |
change_tick | Tick | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
new
Creates a new instance with the same change tick for
added
andchanged
.
Arguments
Name | Type | Documentation |
---|---|---|
change_tick | Tick | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | ComponentTicks | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
get | Gets the value of this change tick. |
assert_receiver_is_total_eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
new | Creates a new [`Tick`] wrapping the given value. |
is_newer_than | Returns `true` if this `Tick` occurred since the system's `last_run`. `this_run` is the current ti... |
set | Sets the value of this change tick. |
eq | No Documentation 🚧 |
get
Gets the value of this change tick.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Tick | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Tick | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Tick | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Tick | No Documentation 🚧 |
new
Creates a new [
Tick
] wrapping the given value.
Arguments
Name | Type | Documentation |
---|---|---|
tick | u32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Tick | 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
Name | Type | Documentation |
---|---|---|
_self | Tick | No Documentation 🚧 |
last_run | Tick | No Documentation 🚧 |
this_run | Tick | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
set
Sets the value of this change tick.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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);
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
to_bits | Convert to a form convenient for passing outside of rust. Only useful for identifying entities wit... |
from_bits | Reconstruct an `Entity` previously destructured with [`Entity::to_bits`]. Only useful when applied to results from `to_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`]... |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
generation | Returns the generation of this Entity's index. The generation is incremented each time an entity w... |
index | Return a transiently unique identifier. No two simultaneously-live entities share the same index, ... |
from_raw | Creates a new entity ID with the specified `index` and a generation of 1. # Note Spawning a speci... |
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
Name | Type | Documentation |
---|---|---|
_self | Entity | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | 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
Name | Type | Documentation |
---|---|---|
bits | u64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Entity | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Entity | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Entity | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Entity | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | 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
Name | Type | Documentation |
---|---|---|
index | u32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Entity | No Documentation 🚧 |
EntityHash
EntityHash
Description
A [
BuildHasher
] that results in a [EntityHasher
].
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | EntityHash | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
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`]... |
eq | No Documentation 🚧 |
masked_high | Returns the masked value of the high segment of the [`Identifier`]. Does not include the flag bits. |
clone | No Documentation 🚧 |
low | Returns the value of the low segment of the [`Identifier`]. |
to_bits | Convert the [`Identifier`] into a `u64`. |
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
Name | Type | Documentation |
---|---|---|
value | u64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Identifier | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Identifier | No Documentation 🚧 |
other | Identifier | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
masked_high
Returns the masked value of the high segment of the [
Identifier
]. Does not include the flag bits.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Identifier | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Identifier | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Identifier | No Documentation 🚧 |
low
Returns the value of the low segment of the [
Identifier
].
Arguments
Name | Type | Documentation |
---|---|---|
_self | Identifier | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
to_bits
Convert the [
Identifier
] into au64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Identifier | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | No Documentation 🚧 |
RemovedComponentEntity
RemovedComponentEntity
- bevy_ecs::entity::Entity
Description
Wrapper around [
Entity
] for [RemovedComponents
]. Internally,RemovedComponents
uses these as anEvents<RemovedComponentEntity>
.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | RemovedComponentEntity | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | RemovedComponentEntity | No Documentation 🚧 |
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
.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
swap | 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
Name | Type | Documentation |
---|---|---|
_self | Children | No Documentation 🚧 |
a_index | usize | No Documentation 🚧 |
b_index | usize | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
get | Gets the [`Entity`] ID of the parent. |
assert_receiver_is_total_eq | No Documentation 🚧 |
eq | No Documentation 🚧 |
get
Gets the [
Entity
] ID of the parent.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Parent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Entity | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Parent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
assert_receiver_is_total_eq | No Documentation 🚧 |
eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | HierarchyEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | HierarchyEvent | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | HierarchyEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | HierarchyEvent | No Documentation 🚧 |
other | HierarchyEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
ButtonState
Pressed
Released
Description
The current "press" state of an element
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
is_pressed | Is this button pressed? |
assert_receiver_is_total_eq | No Documentation 🚧 |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
is_pressed
Is this button pressed?
Arguments
Name | Type | Documentation |
---|---|---|
_self | ButtonState | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | ButtonState | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | ButtonState | No Documentation 🚧 |
other | ButtonState | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | ButtonState | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | ButtonState | No Documentation 🚧 |
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]
.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
threshold | Get the minimum value by which input must change before the change is registered. |
livezone_lowerbound | Get the value below which negative inputs will be rounded down to -1.0. |
deadzone_lowerbound | Get the value above which inputs will be rounded up to 0.0. |
set_livezone_lowerbound | Try to set the value below which negative inputs will be rounded down to -1.0. If the value passed... |
clone | 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 tha... |
set_threshold | Try to set the minimum value by which input must change before the changes will be applied. If the... |
set_livezone_upperbound | Try to set the value above which inputs will be rounded up to 1.0. If the value passed is negative... |
set_deadzone_upperbound | Try to set the value below which positive inputs will be rounded down to 0.0. If the value passed ... |
filter | Filters the `new_value` based on the `old_value`, according to the [`AxisSettings`]. Returns the clamped `new_value` if the change exceeds the settings threshold, and `None` otherwise. |
livezone_upperbound | Get the value above which inputs will be rounded up to 1.0. |
clamp | Clamps the `raw_value` according to the `AxisSettings`. |
eq | No Documentation 🚧 |
deadzone_upperbound | Get the value below which positive inputs will be rounded down to 0.0. |
threshold
Get the minimum value by which input must change before the change is registered.
Arguments
Name | Type | Documentation |
---|---|---|
_self | AxisSettings | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
livezone_lowerbound
Get the value below which negative inputs will be rounded down to -1.0.
Arguments
Name | Type | Documentation |
---|---|---|
_self | AxisSettings | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
deadzone_lowerbound
Get the value above which inputs will be rounded up to 0.0.
Arguments
Name | Type | Documentation |
---|---|---|
_self | AxisSettings | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | AxisSettings | No Documentation 🚧 |
value | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | AxisSettings | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AxisSettings | 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
Name | Type | Documentation |
---|---|---|
_self | AxisSettings | No Documentation 🚧 |
value | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | AxisSettings | No Documentation 🚧 |
value | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | AxisSettings | No Documentation 🚧 |
value | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | AxisSettings | No Documentation 🚧 |
value | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Name | Type | Documentation |
---|---|---|
_self | AxisSettings | No Documentation 🚧 |
new_value | f32 | No Documentation 🚧 |
old_value | Optional<f32> | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Optional<f32> | No Documentation 🚧 |
livezone_upperbound
Get the value above which inputs will be rounded up to 1.0.
Arguments
Name | Type | Documentation |
---|---|---|
_self | AxisSettings | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
clamp
Clamps the
raw_value
according to theAxisSettings
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | AxisSettings | No Documentation 🚧 |
new_value | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | AxisSettings | No Documentation 🚧 |
other | AxisSettings | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
deadzone_upperbound
Get the value below which positive inputs will be rounded down to 0.0.
Arguments
Name | Type | Documentation |
---|---|---|
_self | AxisSettings | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
filter | 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
Name | Type | Documentation |
---|---|---|
_self | ButtonAxisSettings | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | ButtonAxisSettings | No Documentation 🚧 |
new_value | f32 | No Documentation 🚧 |
old_value | Optional<f32> | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
press_threshold | Get the button input threshold above which the button is considered pressed. |
eq | No Documentation 🚧 |
is_released | Returns `true` if the button is released. A button is considered released if the `value` passed is... |
is_pressed | Returns `true` if the button is pressed. A button is considered pressed if the `value` passed is g... |
release_threshold | Get the button input threshold below which the button is considered released. |
set_press_threshold | Try to set the button input threshold above which the button is considered pressed. If the value p... |
set_release_threshold | Try to set the button input threshold below which the button is considered released. If the value ... |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | ButtonSettings | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | ButtonSettings | No Documentation 🚧 |
press_threshold
Get the button input threshold above which the button is considered pressed.
Arguments
Name | Type | Documentation |
---|---|---|
_self | ButtonSettings | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | ButtonSettings | No Documentation 🚧 |
other | ButtonSettings | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | ButtonSettings | No Documentation 🚧 |
value | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | ButtonSettings | No Documentation 🚧 |
value | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
release_threshold
Get the button input threshold below which the button is considered released.
Arguments
Name | Type | Documentation |
---|---|---|
_self | ButtonSettings | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | ButtonSettings | No Documentation 🚧 |
value | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | ButtonSettings | No Documentation 🚧 |
value | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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) } } }
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
product_id | Returns the USB product ID as assigned by the [vendor], if available. [vendor]: Self::vendor_id |
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`]... |
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`]... |
dpad | Returns the directional pad as a [`Vec2`] |
right_stick | Returns the right stick as a [`Vec2`] |
pressed | Returns `true` if the [`GamepadButton`] has been pressed. |
left_stick | Returns the left stick as a [`Vec2`] |
vendor_id | Returns the USB vendor ID as assigned by the USB-IF, if available. |
product_id
Returns the USB product ID as assigned by the [vendor], if available. [vendor]: Self::vendor_id
Arguments
Name | Type | Documentation |
---|---|---|
_self | Gamepad | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Optional<u16> | 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
Name | Type | Documentation |
---|---|---|
_self | Gamepad | No Documentation 🚧 |
button_type | GamepadButton | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Gamepad | No Documentation 🚧 |
button_type | GamepadButton | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
dpad
Returns the directional pad as a [
Vec2
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Gamepad | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
right_stick
Returns the right stick as a [
Vec2
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Gamepad | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
pressed
Returns
true
if the [GamepadButton
] has been pressed.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Gamepad | No Documentation 🚧 |
button_type | GamepadButton | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
left_stick
Returns the left stick as a [
Vec2
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Gamepad | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
vendor_id
Returns the USB vendor ID as assigned by the USB-IF, if available.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Gamepad | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
assert_receiver_is_total_eq | No Documentation 🚧 |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadAxis | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadAxis | No Documentation 🚧 |
other | GamepadAxis | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadAxis | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GamepadAxis | 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
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
eq | No Documentation 🚧 |
new | Creates a new [`GamepadAxisChangedEvent`] |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadAxisChangedEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GamepadAxisChangedEvent | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadAxisChangedEvent | No Documentation 🚧 |
other | GamepadAxisChangedEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
new
Creates a new [
GamepadAxisChangedEvent
]
Arguments
Name | Type | Documentation |
---|---|---|
entity | Entity | No Documentation 🚧 |
axis | GamepadAxis | No Documentation 🚧 |
value | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
assert_receiver_is_total_eq | No Documentation 🚧 |
eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadButton | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GamepadButton | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadButton | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadButton | No Documentation 🚧 |
other | GamepadButton | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
eq | No Documentation 🚧 |
new | Creates a new [`GamepadButtonChangedEvent`] |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadButtonChangedEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GamepadButtonChangedEvent | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadButtonChangedEvent | No Documentation 🚧 |
other | GamepadButtonChangedEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
new
Creates a new [
GamepadButtonChangedEvent
]
Arguments
Name | Type | Documentation |
---|---|---|
entity | Entity | No Documentation 🚧 |
button | GamepadButton | No Documentation 🚧 |
state | ButtonState | No Documentation 🚧 |
value | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
new | Creates a new [`GamepadButtonStateChangedEvent`] |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
assert_receiver_is_total_eq | No Documentation 🚧 |
new
Creates a new [
GamepadButtonStateChangedEvent
]
Arguments
Name | Type | Documentation |
---|---|---|
entity | Entity | No Documentation 🚧 |
button | GamepadButton | No Documentation 🚧 |
state | ButtonState | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GamepadButtonStateChangedEvent | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadButtonStateChangedEvent | No Documentation 🚧 |
other | GamepadButtonStateChangedEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadButtonStateChangedEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GamepadButtonStateChangedEvent | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadButtonStateChangedEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
GamepadConnection
Connected
- name:String
- vendor_id:core::option::Option
- product_id:core::option::Option
Disconnected
Description
The connection status of a gamepad.
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadConnection | No Documentation 🚧 |
other | GamepadConnection | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadConnection | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GamepadConnection | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
eq | No Documentation 🚧 |
connected | Is the gamepad connected? |
new | Creates a [`GamepadConnectionEvent`]. |
disconnected | Is the gamepad disconnected? |
clone | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadConnectionEvent | No Documentation 🚧 |
other | GamepadConnectionEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
connected
Is the gamepad connected?
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadConnectionEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
new
Creates a [
GamepadConnectionEvent
].
Arguments
Name | Type | Documentation |
---|---|---|
gamepad | Entity | No Documentation 🚧 |
connection | GamepadConnection | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GamepadConnectionEvent | No Documentation 🚧 |
disconnected
Is the gamepad disconnected?
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadConnectionEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadConnectionEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadEvent | No Documentation 🚧 |
other | GamepadEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GamepadEvent | No Documentation 🚧 |
GamepadInput
Axis
- bevy_input::gamepad::GamepadAxis
Button
- bevy_input::gamepad::GamepadButton
Description
Encapsulation over [
GamepadAxis
] and [GamepadButton
]
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
assert_receiver_is_total_eq | No Documentation 🚧 |
eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadInput | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GamepadInput | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadInput | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadInput | No Documentation 🚧 |
other | GamepadInput | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
weak_motor | Creates a new rumble intensity with weak motor intensity set to the given value. Clamped within th... |
strong_motor | Creates a new rumble intensity with strong motor intensity set to the given value. Clamped within ... |
eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadRumbleIntensity | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
intensity | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GamepadRumbleIntensity | 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
Name | Type | Documentation |
---|---|---|
intensity | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GamepadRumbleIntensity | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadRumbleIntensity | No Documentation 🚧 |
other | GamepadRumbleIntensity | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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), }); } }
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadRumbleRequest | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GamepadRumbleRequest | No Documentation 🚧 |
gamepad
Get the [
Entity
] associated with this request.
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadRumbleRequest | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GamepadSettings | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
]
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
new | Creates a [`RawGamepadAxisChangedEvent`]. |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | RawGamepadAxisChangedEvent | No Documentation 🚧 |
other | RawGamepadAxisChangedEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | RawGamepadAxisChangedEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | RawGamepadAxisChangedEvent | No Documentation 🚧 |
new
Creates a [
RawGamepadAxisChangedEvent
].
Arguments
Name | Type | Documentation |
---|---|---|
gamepad | Entity | No Documentation 🚧 |
axis_type | GamepadAxis | No Documentation 🚧 |
value | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
]
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
new | Creates a [`RawGamepadButtonChangedEvent`]. |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
new
Creates a [
RawGamepadButtonChangedEvent
].
Arguments
Name | Type | Documentation |
---|---|---|
gamepad | Entity | No Documentation 🚧 |
button_type | GamepadButton | No Documentation 🚧 |
value | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | RawGamepadButtonChangedEvent | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | RawGamepadButtonChangedEvent | No Documentation 🚧 |
other | RawGamepadButtonChangedEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | RawGamepadButtonChangedEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | RawGamepadEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | RawGamepadEvent | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | RawGamepadEvent | No Documentation 🚧 |
other | RawGamepadEvent | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
DoubleTapGesture
DoubleTapGesture
Description
Double tap gesture.
Platform-specific
- Only available on
macOS
andiOS
.- On
iOS
, must be enabled first
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DoubleTapGesture | No Documentation 🚧 |
other | DoubleTapGesture | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DoubleTapGesture | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DoubleTapGesture | No Documentation 🚧 |
PanGesture
PanGesture
- glam::Vec2
Description
Pan gesture.
Platform-specific
- On
iOS
, must be enabled first
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | PanGesture | No Documentation 🚧 |
other | PanGesture | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | PanGesture | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | PanGesture | 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
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | PinchGesture | No Documentation 🚧 |
other | PinchGesture | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | PinchGesture | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | PinchGesture | 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
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | RotationGesture | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | RotationGesture | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | RotationGesture | No Documentation 🚧 |
other | RotationGesture | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
assert_receiver_is_total_eq | No Documentation 🚧 |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Key | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Key | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Key | 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
].
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
assert_receiver_is_total_eq | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | KeyCode | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | KeyCode | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | KeyCode | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
assert_receiver_is_total_eq | No Documentation 🚧 |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | KeyboardFocusLost | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | KeyboardFocusLost | No Documentation 🚧 |
other | KeyboardFocusLost | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | KeyboardFocusLost | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | KeyboardFocusLost | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
assert_receiver_is_total_eq | No Documentation 🚧 |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | KeyboardInput | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | KeyboardInput | No Documentation 🚧 |
other | KeyboardInput | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | KeyboardInput | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | KeyboardInput | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
eq | No Documentation 🚧 |
assert_receiver_is_total_eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | NativeKey | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | NativeKey | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | NativeKey | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
assert_receiver_is_total_eq | No Documentation 🚧 |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | NativeKeyCode | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | NativeKeyCode | No Documentation 🚧 |
other | NativeKeyCode | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | NativeKeyCode | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | NativeKeyCode | 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.
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | AccumulatedMouseMotion | No Documentation 🚧 |
other | AccumulatedMouseMotion | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | AccumulatedMouseMotion | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AccumulatedMouseMotion | 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.
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | AccumulatedMouseScroll | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AccumulatedMouseScroll | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | AccumulatedMouseScroll | No Documentation 🚧 |
other | AccumulatedMouseScroll | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
].
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
assert_receiver_is_total_eq | No Documentation 🚧 |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | MouseButton | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | MouseButton | No Documentation 🚧 |
other | MouseButton | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | MouseButton | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | MouseButton | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
assert_receiver_is_total_eq | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | MouseButtonInput | No Documentation 🚧 |
other | MouseButtonInput | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | MouseButtonInput | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | MouseButtonInput | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | MouseButtonInput | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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.
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | MouseMotion | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | MouseMotion | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | MouseMotion | No Documentation 🚧 |
other | MouseMotion | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
assert_receiver_is_total_eq | No Documentation 🚧 |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | MouseScrollUnit | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | MouseScrollUnit | No Documentation 🚧 |
other | MouseScrollUnit | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | MouseScrollUnit | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | MouseScrollUnit | 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.
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | MouseWheel | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | MouseWheel | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | MouseWheel | No Documentation 🚧 |
other | MouseWheel | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | ForceTouch | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | ForceTouch | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | ForceTouch | No Documentation 🚧 |
other | ForceTouch | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | TouchInput | No Documentation 🚧 |
other | TouchInput | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | TouchInput | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | TouchInput | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
assert_receiver_is_total_eq | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | TouchPhase | No Documentation 🚧 |
other | TouchPhase | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | TouchPhase | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | TouchPhase | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | TouchPhase | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
AspectRatio
AspectRatio
- f32
Description
An
AspectRatio
is the ratio of width to height.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
ratio | Returns the aspect ratio as a f32 value. |
eq | No Documentation 🚧 |
is_square | Returns true if the aspect ratio is exactly square. |
inverse | Returns the inverse of this aspect ratio (height/width). |
is_landscape | Returns true if the aspect ratio represents a landscape orientation. |
is_portrait | Returns true if the aspect ratio represents a portrait orientation. |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | AspectRatio | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AspectRatio | No Documentation 🚧 |
ratio
Returns the aspect ratio as a f32 value.
Arguments
Name | Type | Documentation |
---|---|---|
_self | AspectRatio | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | AspectRatio | No Documentation 🚧 |
other | AspectRatio | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
is_square
Returns true if the aspect ratio is exactly square.
Arguments
Name | Type | Documentation |
---|---|---|
_self | AspectRatio | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
inverse
Returns the inverse of this aspect ratio (height/width).
Arguments
Name | Type | Documentation |
---|---|---|
_self | AspectRatio | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AspectRatio | No Documentation 🚧 |
is_landscape
Returns true if the aspect ratio represents a landscape orientation.
Arguments
Name | Type | Documentation |
---|---|---|
_self | AspectRatio | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
is_portrait
Returns true if the aspect ratio represents a portrait orientation.
Arguments
Name | Type | Documentation |
---|---|---|
_self | AspectRatio | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
Aabb2d
Aabb2d
- min:glam::Vec2
- max:glam::Vec2
Description
A 2D axis-aligned bounding box, or bounding rectangle
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
closest_point | Finds the point on the AABB that is closest to the given `point`. If the point is outside the AABB... |
new | Constructs an AABB from its center and half-size. |
bounding_circle | Computes the smallest [`BoundingCircle`] containing this [`Aabb2d`]. |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Aabb2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
new
Constructs an AABB from its center and half-size.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Aabb2d | No Documentation 🚧 |
bounding_circle
Computes the smallest [
BoundingCircle
] containing this [Aabb2d
].
Arguments
Name | Type | Documentation |
---|---|---|
_self | Aabb2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BoundingCircle | No Documentation 🚧 |
BoundingCircle
BoundingCircle
- center:glam::Vec2
- circle:bevy_math::primitives::dim2::Circle
Description
A bounding circle
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
closest_point | Finds the point on the bounding circle that is closest to the given `point`. If the point is outsi... |
new | Constructs a bounding circle from its center and radius. |
clone | No Documentation 🚧 |
aabb_2d | Computes the smallest [`Aabb2d`] containing this [`BoundingCircle`]. |
radius | Get the radius of the bounding circle |
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
Name | Type | Documentation |
---|---|---|
_self | BoundingCircle | No Documentation 🚧 |
point | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
new
Constructs a bounding circle from its center and radius.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BoundingCircle | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | BoundingCircle | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BoundingCircle | No Documentation 🚧 |
aabb_2d
Computes the smallest [
Aabb2d
] containing this [BoundingCircle
].
Arguments
Name | Type | Documentation |
---|---|---|
_self | BoundingCircle | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Aabb2d | No Documentation 🚧 |
radius
Get the radius of the bounding circle
Arguments
Name | Type | Documentation |
---|---|---|
_self | BoundingCircle | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
Aabb3d
Aabb3d
- min:glam::Vec3A
- max:glam::Vec3A
Description
A 3D axis-aligned bounding box
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
bounding_sphere | Computes the smallest [`BoundingSphere`] containing this [`Aabb3d`]. |
clone | No Documentation 🚧 |
bounding_sphere
Computes the smallest [
BoundingSphere
] containing this [Aabb3d
].
Arguments
Name | Type | Documentation |
---|---|---|
_self | Aabb3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BoundingSphere | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Aabb3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Aabb3d | No Documentation 🚧 |
BoundingSphere
BoundingSphere
- center:glam::Vec3A
- sphere:bevy_math::primitives::dim3::Sphere
Description
A bounding sphere
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
radius | Get the radius of the bounding sphere |
aabb_3d | Computes the smallest [`Aabb3d`] containing this [`BoundingSphere`]. |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | BoundingSphere | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BoundingSphere | No Documentation 🚧 |
radius
Get the radius of the bounding sphere
Arguments
Name | Type | Documentation |
---|---|---|
_self | BoundingSphere | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
aabb_3d
Computes the smallest [
Aabb3d
] containing this [BoundingSphere
].
Arguments
Name | Type | Documentation |
---|---|---|
_self | BoundingSphere | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Aabb3d | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
aabb_collision_at | Get the distance at which the [`Aabb2d`]s collide, if at all. |
from_ray | Construct an [`AabbCast2d`] from an [`Aabb2d`], [`Ray2d`], and max distance. |
new | Construct an [`AabbCast2d`] from an [`Aabb2d`], origin, [`Dir2`], and max distance. |
clone | No Documentation 🚧 |
aabb_collision_at
Get the distance at which the [
Aabb2d
]s collide, if at all.
Arguments
Name | Type | Documentation |
---|---|---|
_self | AabbCast2d | No Documentation 🚧 |
aabb | Aabb2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Optional<f32> | No Documentation 🚧 |
from_ray
Construct an [
AabbCast2d
] from an [Aabb2d
], [Ray2d
], and max distance.
Arguments
Name | Type | Documentation |
---|---|---|
aabb | Aabb2d | No Documentation 🚧 |
ray | Ray2d | No Documentation 🚧 |
max | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AabbCast2d | No Documentation 🚧 |
new
Construct an [
AabbCast2d
] from an [Aabb2d
], origin, [Dir2
], and max distance.
Arguments
Name | Type | Documentation |
---|---|---|
aabb | Aabb2d | No Documentation 🚧 |
origin | Vec2 | No Documentation 🚧 |
direction | Dir2 | No Documentation 🚧 |
max | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AabbCast2d | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | AabbCast2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
new | 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. |
clone | No Documentation 🚧 |
from_ray | Construct a [`BoundingCircleCast`] from a [`BoundingCircle`], [`Ray2d`], and max distance. |
new
Construct a [
BoundingCircleCast
] from a [BoundingCircle
], origin, [Dir2
], and max distance.
Arguments
Name | Type | Documentation |
---|---|---|
circle | BoundingCircle | No Documentation 🚧 |
origin | Vec2 | No Documentation 🚧 |
direction | Dir2 | No Documentation 🚧 |
max | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BoundingCircleCast | No Documentation 🚧 |
circle_collision_at
Get the distance at which the [
BoundingCircle
]s collide, if at all.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BoundingCircleCast | No Documentation 🚧 |
circle | BoundingCircle | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Optional<f32> | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | BoundingCircleCast | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BoundingCircleCast | No Documentation 🚧 |
from_ray
Construct a [
BoundingCircleCast
] from a [BoundingCircle
], [Ray2d
], and max distance.
Arguments
Name | Type | Documentation |
---|---|---|
circle | BoundingCircle | No Documentation 🚧 |
ray | Ray2d | No Documentation 🚧 |
max | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
aabb_intersection_at | Get the distance of an intersection with an [`Aabb2d`], if any. |
clone | No Documentation 🚧 |
direction_recip | Get the cached multiplicative inverse of the direction of the ray. |
new | Construct a [`RayCast2d`] from an origin, [`Dir2`], and max distance. |
from_ray | Construct a [`RayCast2d`] from a [`Ray2d`] and max distance. |
circle_intersection_at | Get the distance of an intersection with a [`BoundingCircle`], if any. |
aabb_intersection_at
Get the distance of an intersection with an [
Aabb2d
], if any.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Optional<f32> | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | RayCast2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | RayCast2d | No Documentation 🚧 |
direction_recip
Get the cached multiplicative inverse of the direction of the ray.
Arguments
Name | Type | Documentation |
---|---|---|
_self | RayCast2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
new
Construct a [
RayCast2d
] from an origin, [Dir2
], and max distance.
Arguments
Name | Type | Documentation |
---|---|---|
origin | Vec2 | No Documentation 🚧 |
direction | Dir2 | No Documentation 🚧 |
max | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | RayCast2d | No Documentation 🚧 |
from_ray
Construct a [
RayCast2d
] from a [Ray2d
] and max distance.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | RayCast2d | No Documentation 🚧 |
circle_intersection_at
Get the distance of an intersection with a [
BoundingCircle
], if any.
Arguments
Name | Type | Documentation |
---|---|---|
_self | RayCast2d | No Documentation 🚧 |
circle | BoundingCircle | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Optional<f32> | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
from_ray | 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. |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | AabbCast3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AabbCast3d | No Documentation 🚧 |
from_ray
Construct an [
AabbCast3d
] from an [Aabb3d
], [Ray3d
], and max distance.
Arguments
Name | Type | Documentation |
---|---|---|
aabb | Aabb3d | No Documentation 🚧 |
ray | Ray3d | No Documentation 🚧 |
max | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AabbCast3d | No Documentation 🚧 |
aabb_collision_at
Get the distance at which the [
Aabb3d
]s collide, if at all.
Arguments
Name | Type | Documentation |
---|---|---|
_self | AabbCast3d | No Documentation 🚧 |
aabb | Aabb3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Optional<f32> | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
sphere_collision_at | Get the distance at which the [`BoundingSphere`]s collide, if at all. |
clone | No Documentation 🚧 |
from_ray | Construct a [`BoundingSphereCast`] from a [`BoundingSphere`], [`Ray3d`], and max distance. |
sphere_collision_at
Get the distance at which the [
BoundingSphere
]s collide, if at all.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BoundingSphereCast | No Documentation 🚧 |
sphere | BoundingSphere | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Optional<f32> | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | BoundingSphereCast | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BoundingSphereCast | No Documentation 🚧 |
from_ray
Construct a [
BoundingSphereCast
] from a [BoundingSphere
], [Ray3d
], and max distance.
Arguments
Name | Type | Documentation |
---|---|---|
sphere | BoundingSphere | No Documentation 🚧 |
ray | Ray3d | No Documentation 🚧 |
max | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BoundingSphereCast | 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
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
from_ray | Construct a [`RayCast3d`] from a [`Ray3d`] and max distance. |
clone | No Documentation 🚧 |
aabb_intersection_at | Get the distance of an intersection with an [`Aabb3d`], if any. |
direction_recip | Get the cached multiplicative inverse of the direction of the ray. |
sphere_intersection_at | Get the distance of an intersection with a [`BoundingSphere`], if any. |
from_ray
Construct a [
RayCast3d
] from a [Ray3d
] and max distance.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | RayCast3d | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | RayCast3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | RayCast3d | No Documentation 🚧 |
aabb_intersection_at
Get the distance of an intersection with an [
Aabb3d
], if any.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Optional<f32> | No Documentation 🚧 |
direction_recip
Get the cached multiplicative inverse of the direction of the ray.
Arguments
Name | Type | Documentation |
---|---|---|
_self | RayCast3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
sphere_intersection_at
Get the distance of an intersection with a [
BoundingSphere
], if any.
Arguments
Name | Type | Documentation |
---|---|---|
_self | RayCast3d | No Documentation 🚧 |
sphere | BoundingSphere | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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)
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
eq | No Documentation 🚧 |
assert_receiver_is_total_eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | CompassOctant | No Documentation 🚧 |
other | CompassOctant | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | CompassOctant | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | CompassOctant | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | CompassOctant | No Documentation 🚧 |
CompassQuadrant
North
East
South
West
Description
A compass enum with 4 directions.
N (North) ▲ │ │ W (West) ┼─────► E (East) │ │ ▼ S (South)
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
assert_receiver_is_total_eq | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | CompassQuadrant | No Documentation 🚧 |
other | CompassQuadrant | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | CompassQuadrant | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | CompassQuadrant | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | CompassQuadrant | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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.
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | EaseFunction | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | EaseFunction | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | EaseFunction | No Documentation 🚧 |
other | EaseFunction | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
start | Get the start of this interval. |
has_finite_start | Returns `true` if this interval has a finite start. |
length | Get the length of this interval. Note that the result may be infinite (`f32::INFINITY`). |
end | Get the end of this interval. |
is_bounded | Returns `true` if this interval is bounded — that is, if both its start and end are finite. Equi... |
clamp | Clamp the given `value` to lie within this interval. |
eq | No Documentation 🚧 |
contains | Returns `true` if `item` is contained in this interval. |
contains_interval | Returns `true` if the other interval is contained in this interval. This is non-strict: each inter... |
has_finite_end | Returns `true` if this interval has a finite end. |
clone | No Documentation 🚧 |
start
Get the start of this interval.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Interval | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
has_finite_start
Returns
true
if this interval has a finite start.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Interval | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
length
Get the length of this interval. Note that the result may be infinite (
f32::INFINITY
).
Arguments
Name | Type | Documentation |
---|---|---|
_self | Interval | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
end
Get the end of this interval.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Interval | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Name | Type | Documentation |
---|---|---|
_self | Interval | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clamp
Clamp the given
value
to lie within this interval.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
contains
Returns
true
ifitem
is contained in this interval.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
has_finite_end
Returns
true
if this interval has a finite end.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Interval | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Interval | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Interval | No Documentation 🚧 |
Dir2
Dir2
- glam::Vec2
Description
A normalized vector pointing in a direction in 2D space
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
rotation_from_y | Get the rotation that rotates the Y-axis to this direction. |
neg | No Documentation 🚧 |
rotation_to_y | Get the rotation that rotates this direction to the Y-axis. |
slerp | Performs a spherical linear interpolation between `self` and `rhs` based on the value `s`. This c... |
new_unchecked | Create a [`Dir2`] from a [`Vec2`] that is already normalized. # Warning `value` must be normalize... |
fast_renormalize | Returns `self` after an approximate normalization, assuming the value is already nearly normalized.... |
eq | No Documentation 🚧 |
rotation_to | Get the rotation that rotates this direction to `other`. |
mul | No Documentation 🚧 |
as_vec2 | Returns the inner [`Vec2`] |
rotation_from_x | Get the rotation that rotates the X-axis to this direction. |
rotation_from | Get the rotation that rotates `other` to this direction. |
clone | No Documentation 🚧 |
from_xy_unchecked | Create a direction from its `x` and `y` components, assuming the resulting vector is normalized. #... |
rotation_to_x | Get the rotation that rotates this direction to the X-axis. |
rotation_from_y
Get the rotation that rotates the Y-axis to this direction.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Dir2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rot2 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Dir2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir2 | No Documentation 🚧 |
rotation_to_y
Get the rotation that rotates this direction to the Y-axis.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Dir2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
value | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir2 | 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
Name | Type | Documentation |
---|---|---|
_self | Dir2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
rotation_to
Get the rotation that rotates this direction to
other
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rot2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
as_vec2
Returns the inner [
Vec2
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Dir2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
rotation_from_x
Get the rotation that rotates the X-axis to this direction.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Dir2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rot2 | No Documentation 🚧 |
rotation_from
Get the rotation that rotates
other
to this direction.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rot2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Dir2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir2 | No Documentation 🚧 |
rotation_to_x
Get the rotation that rotates this direction to the X-axis.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Dir2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rot2 | No Documentation 🚧 |
Dir3
Dir3
- glam::Vec3
Description
A normalized vector pointing in a direction in 3D space
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
eq | No Documentation 🚧 |
fast_renormalize | Returns `self` after an approximate normalization, assuming the value is already nearly normalized.... |
from_xyz_unchecked | Create a direction from its `x`, `y`, and `z` components, assuming the resulting vector is normaliz... |
neg | No Documentation 🚧 |
clone | No Documentation 🚧 |
as_vec3 | Returns the inner [`Vec3`] |
mul | No Documentation 🚧 |
new_unchecked | Create a [`Dir3`] from a [`Vec3`] that is already normalized. # Warning `value` must be normalize... |
slerp | Performs a spherical linear interpolation between `self` and `rhs` based on the value `s`. This c... |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Dir3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Dir3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Dir3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | No Documentation 🚧 |
as_vec3
Returns the inner [
Vec3
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Dir3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | 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
Name | Type | Documentation |
---|---|---|
value | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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!
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
from_xyz_unchecked | Create a direction from its `x`, `y`, and `z` components, assuming the resulting vector is normaliz... |
clone | No Documentation 🚧 |
mul | No Documentation 🚧 |
slerp | Performs a spherical linear interpolation between `self` and `rhs` based on the value `s`. This c... |
neg | No Documentation 🚧 |
fast_renormalize | Returns `self` after an approximate normalization, assuming the value is already nearly normalized.... |
eq | No Documentation 🚧 |
new_unchecked | Create a [`Dir3A`] from a [`Vec3A`] that is already normalized. # Warning `value` must be normali... |
as_vec3a | Returns the inner [`Vec3A`] |
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3A | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Dir3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3A | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
Name | Type | Documentation |
---|---|---|
_self | Dir3A | No Documentation 🚧 |
rhs | Dir3A | No Documentation 🚧 |
s | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3A | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Dir3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3A | 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
Name | Type | Documentation |
---|---|---|
_self | Dir3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3A | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
value | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3A | No Documentation 🚧 |
as_vec3a
Returns the inner [
Vec3A
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Dir3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
neg | No Documentation 🚧 |
clone | No Documentation 🚧 |
gt | No Documentation 🚧 |
le | No Documentation 🚧 |
lt | No Documentation 🚧 |
eq | No Documentation 🚧 |
ge | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | FloatOrd | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | FloatOrd | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | FloatOrd | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | FloatOrd | No Documentation 🚧 |
gt
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
le
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
lt
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
ge
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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);
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
from_translation | Create a two-dimensional isometry from a translation. |
eq | No Documentation 🚧 |
mul | No Documentation 🚧 |
mul-2 | No Documentation 🚧 |
inverse | The inverse isometry that undoes this one. |
from_rotation | Create a two-dimensional isometry from a rotation. |
new | Create a two-dimensional isometry from a rotation and a translation. |
clone | 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. |
transform_point | Transform a point by rotating and translating it using this isometry. |
mul-1 | No Documentation 🚧 |
from_xy | Create a two-dimensional isometry from a translation with the given `x` and `y` components. |
inverse_transform_point | Transform a point by rotating and translating it using the inverse of this isometry. This is more ... |
from_translation
Create a two-dimensional isometry from a translation.
Arguments
Name | Type | Documentation |
---|---|---|
translation | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Isometry2d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Isometry2d | No Documentation 🚧 |
other | Isometry2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Isometry2d | No Documentation 🚧 |
rhs | Isometry2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Isometry2d | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
arg0 | Isometry2d | No Documentation 🚧 |
arg1 | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
inverse
The inverse isometry that undoes this one.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Isometry2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Isometry2d | No Documentation 🚧 |
from_rotation
Create a two-dimensional isometry from a rotation.
Arguments
Name | Type | Documentation |
---|---|---|
rotation | Rot2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Isometry2d | No Documentation 🚧 |
new
Create a two-dimensional isometry from a rotation and a translation.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Isometry2d | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Isometry2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Isometry2d | No Documentation 🚧 |
rhs | Isometry2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Isometry2d | No Documentation 🚧 |
transform_point
Transform a point by rotating and translating it using this isometry.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Isometry2d | No Documentation 🚧 |
point | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
arg0 | Isometry2d | No Documentation 🚧 |
arg1 | Dir2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir2 | No Documentation 🚧 |
from_xy
Create a two-dimensional isometry from a translation with the given
x
andy
components.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Isometry2d | No Documentation 🚧 |
point | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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);
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
mul-3 | No Documentation 🚧 |
mul-1 | No Documentation 🚧 |
eq | 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. |
mul | No Documentation 🚧 |
mul-2 | No Documentation 🚧 |
inverse | The inverse isometry that undoes this one. |
clone | No Documentation 🚧 |
from_xyz | Create a three-dimensional isometry from a translation with the given `x`, `y`, and `z` components. |
from_rotation | Create a three-dimensional isometry from a rotation. |
mul-3
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
arg0 | Isometry3d | No Documentation 🚧 |
arg1 | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
arg0 | Isometry3d | No Documentation 🚧 |
arg1 | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Isometry3d | No Documentation 🚧 |
other | Isometry3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | Isometry3d | No Documentation 🚧 |
rhs | Isometry3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Isometry3d | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Isometry3d | No Documentation 🚧 |
rhs | Isometry3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Isometry3d | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
arg0 | Isometry3d | No Documentation 🚧 |
arg1 | Dir3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | No Documentation 🚧 |
inverse
The inverse isometry that undoes this one.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Isometry3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Isometry3d | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Isometry3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Isometry3d | No Documentation 🚧 |
from_xyz
Create a three-dimensional isometry from a translation with the given
x
,y
, andz
components.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Isometry3d | No Documentation 🚧 |
from_rotation
Create a three-dimensional isometry from a rotation.
Arguments
Name | Type | Documentation |
---|---|---|
rotation | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Isometry3d | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
closest_point | Finds the point on the annulus that is closest to the given `point`: - If the point is outside of ... |
diameter | Get the diameter of the annulus |
new | Create a new [`Annulus`] from the radii of the inner and outer circle |
eq | No Documentation 🚧 |
thickness | Get the thickness of the annulus |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Annulus | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
diameter
Get the diameter of the annulus
Arguments
Name | Type | Documentation |
---|---|---|
_self | Annulus | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
new
Create a new [
Annulus
] from the radii of the inner and outer circle
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Annulus | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
thickness
Get the thickness of the annulus
Arguments
Name | Type | Documentation |
---|---|---|
_self | Annulus | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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π].
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
from_degrees | Create a new [`Arc2d`] from a `radius` and an `angle` in degrees. |
chord_length | Get the distance between the endpoints (the length of the chord) |
from_turns | Create a new [`Arc2d`] from a `radius` and a `fraction` of a single turn. For instance, `0.5` turns is a semicircle. |
length | Get the length of the arc |
is_minor | Produces true if the arc is at most half a circle. **Note:** This is not the negation of [`is_major`](Self::is_major): an exact semicircle is both major and minor. |
left_endpoint | Get the left-hand end point of the arc |
from_radians | Create a new [`Arc2d`] from a `radius` and an `angle` in radians |
clone | No Documentation 🚧 |
new | Create a new [`Arc2d`] from a `radius` and a `half_angle` |
angle | Get the angle of the arc |
right_endpoint | Get the right-hand end point of the arc |
chord_midpoint | Get the midpoint of the two endpoints (the midpoint of the chord) |
is_major | Produces true if the arc is at least half a circle. **Note:** This is not the negation of [`is_minor`](Self::is_minor): an exact semicircle is both major and minor. |
sagitta | Get the length of the sagitta of this arc, that is, the length of the line between the midpoints o... |
eq | No Documentation 🚧 |
midpoint | Get the midpoint of the arc |
half_chord_length | Get half the distance between the endpoints (half the length of the chord) |
apothem | Get the length of the apothem of this arc, that is, the distance from the center of the circle to ... |
from_degrees
Create a new [
Arc2d
] from aradius
and anangle
in degrees.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Arc2d | No Documentation 🚧 |
chord_length
Get the distance between the endpoints (the length of the chord)
Arguments
Name | Type | Documentation |
---|---|---|
_self | Arc2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Arc2d | No Documentation 🚧 |
length
Get the length of the arc
Arguments
Name | Type | Documentation |
---|---|---|
_self | Arc2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Name | Type | Documentation |
---|---|---|
_self | Arc2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
left_endpoint
Get the left-hand end point of the arc
Arguments
Name | Type | Documentation |
---|---|---|
_self | Arc2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
from_radians
Create a new [
Arc2d
] from aradius
and anangle
in radians
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Arc2d | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Arc2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Arc2d | No Documentation 🚧 |
new
Create a new [
Arc2d
] from aradius
and ahalf_angle
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Arc2d | No Documentation 🚧 |
angle
Get the angle of the arc
Arguments
Name | Type | Documentation |
---|---|---|
_self | Arc2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
right_endpoint
Get the right-hand end point of the arc
Arguments
Name | Type | Documentation |
---|---|---|
_self | Arc2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
chord_midpoint
Get the midpoint of the two endpoints (the midpoint of the chord)
Arguments
Name | Type | Documentation |
---|---|---|
_self | Arc2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | 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
Name | Type | Documentation |
---|---|---|
_self | Arc2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | Arc2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
midpoint
Get the midpoint of the arc
Arguments
Name | Type | Documentation |
---|---|---|
_self | Arc2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
half_chord_length
Get half the distance between the endpoints (half the length of the chord)
Arguments
Name | Type | Documentation |
---|---|---|
_self | Arc2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Arc2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
eq | No Documentation 🚧 |
to_inner_rectangle | Get the part connecting the semicircular ends of the capsule as a [`Rectangle`] |
new | Create a new `Capsule2d` from a radius and length |
clone | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
to_inner_rectangle
Get the part connecting the semicircular ends of the capsule as a [
Rectangle
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Capsule2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rectangle | No Documentation 🚧 |
new
Create a new
Capsule2d
from a radius and length
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Capsule2d | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Capsule2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Capsule2d | No Documentation 🚧 |
Circle
Circle
- radius:f32
Description
A circle primitive, representing the set of points some distance from the origin
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
diameter | Get the diameter of the circle |
closest_point | Finds the point on the circle that is closest to the given `point`. If the point is outside the ci... |
eq | No Documentation 🚧 |
new | Create a new [`Circle`] from a `radius` |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Circle | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Circle | No Documentation 🚧 |
diameter
Get the diameter of the circle
Arguments
Name | Type | Documentation |
---|---|---|
_self | Circle | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
new
Create a new [
Circle
] from aradius
Arguments
Name | Type | Documentation |
---|---|---|
radius | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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π].
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
angle | Get the angle of the sector |
half_angle | Get half the angle of the sector |
eq | No Documentation 🚧 |
sagitta | Get the length of the sagitta of this sector See [`Arc2d::sagitta`] |
arc_length | Get the length of the arc defining the sector |
from_degrees | Create a new [`CircularSector`] from a `radius` and an `angle` in degrees. |
from_turns | Create a new [`CircularSector`] from a `radius` and a number of `turns` of a circle. For instance, `0.5` turns is a semicircle. |
radius | Get the radius of the sector |
half_chord_length | Get half the length of the chord defined by the sector See [`Arc2d::half_chord_length`] |
chord_length | Get the length of the chord defined by the sector See [`Arc2d::chord_length`] |
new | Create a new [`CircularSector`] from a `radius` and an `angle` |
clone | No Documentation 🚧 |
chord_midpoint | Get the midpoint of the chord defined by the sector See [`Arc2d::chord_midpoint`] |
from_radians | Create a new [`CircularSector`] from a `radius` and an `angle` in radians. |
apothem | Get the length of the apothem of this sector See [`Arc2d::apothem`] |
angle
Get the angle of the sector
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSector | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
half_angle
Get half the angle of the sector
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSector | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSector | No Documentation 🚧 |
other | CircularSector | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
sagitta
Get the length of the sagitta of this sector See [
Arc2d::sagitta
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSector | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
arc_length
Get the length of the arc defining the sector
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSector | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
from_degrees
Create a new [
CircularSector
] from aradius
and anangle
in degrees.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | CircularSector | No Documentation 🚧 |
radius
Get the radius of the sector
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSector | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
half_chord_length
Get half the length of the chord defined by the sector See [
Arc2d::half_chord_length
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSector | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
chord_length
Get the length of the chord defined by the sector See [
Arc2d::chord_length
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSector | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
new
Create a new [
CircularSector
] from aradius
and anangle
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | CircularSector | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSector | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | CircularSector | No Documentation 🚧 |
chord_midpoint
Get the midpoint of the chord defined by the sector See [
Arc2d::chord_midpoint
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSector | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
from_radians
Create a new [
CircularSector
] from aradius
and anangle
in radians.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | CircularSector | No Documentation 🚧 |
apothem
Get the length of the apothem of this sector See [
Arc2d::apothem
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSector | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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π].
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
angle | Get the angle of the segment |
arc_length | Get the length of the arc defining the segment |
chord_midpoint | Get the midpoint of the segment's base, also known as its chord |
chord_length | Get the length of the segment's base, also known as its chord |
half_chord_length | Get half the length of the segment's base, also known as its chord |
half_angle | Get the half-angle of the segment |
from_radians | Create a new [`CircularSegment`] from a `radius` and an `angle` in radians. |
new | Create a new [`CircularSegment`] from a `radius`, and an `angle` |
radius | Get the radius of the segment |
from_turns | Create a new [`CircularSegment`] from a `radius` and a number of `turns` of a circle. For instance, `0.5` turns is a semicircle. |
apothem | Get the length of the apothem of this segment, which is the signed distance between the segment an... |
eq | No Documentation 🚧 |
from_degrees | Create a new [`CircularSegment`] from a `radius` and an `angle` in degrees. |
sagitta | Get the length of the sagitta of this segment, also known as its height See [`Arc2d::sagitta`] |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSegment | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | CircularSegment | No Documentation 🚧 |
angle
Get the angle of the segment
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSegment | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
arc_length
Get the length of the arc defining the segment
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSegment | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
chord_midpoint
Get the midpoint of the segment's base, also known as its chord
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSegment | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
chord_length
Get the length of the segment's base, also known as its chord
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSegment | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
half_chord_length
Get half the length of the segment's base, also known as its chord
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSegment | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
half_angle
Get the half-angle of the segment
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSegment | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
from_radians
Create a new [
CircularSegment
] from aradius
and anangle
in radians.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | CircularSegment | No Documentation 🚧 |
new
Create a new [
CircularSegment
] from aradius
, and anangle
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | CircularSegment | No Documentation 🚧 |
radius
Get the radius of the segment
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSegment | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | CircularSegment | 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
Name | Type | Documentation |
---|---|---|
_self | CircularSegment | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSegment | No Documentation 🚧 |
other | CircularSegment | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
from_degrees
Create a new [
CircularSegment
] from aradius
and anangle
in degrees.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | CircularSegment | No Documentation 🚧 |
sagitta
Get the length of the sagitta of this segment, also known as its height See [
Arc2d::sagitta
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | CircularSegment | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
new | Create a new `Ellipse` from half of its width and height. This corresponds to the two perpendicula... |
focal_length | Get the focal length of the ellipse. This corresponds to the distance between one of the foci and t... |
semi_major | Returns the length of the semi-major axis. This corresponds to the longest radius of the ellipse. |
from_size | Create a new `Ellipse` from a given full size. `size.x` is the diameter along the X axis, and `size.y`... |
eccentricity | Returns the [eccentricity](https://en.wikipedia.org/wiki/Eccentricity_(mathematics)) 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. |
semi_minor | Returns the length of the semi-minor axis. This corresponds to the shortest radius of the ellipse. |
clone | No Documentation 🚧 |
eq | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Ellipse | 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
Name | Type | Documentation |
---|---|---|
_self | Ellipse | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
semi_major
Returns the length of the semi-major axis. This corresponds to the longest radius of the ellipse.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Ellipse | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
size | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Ellipse | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
semi_minor
Returns the length of the semi-minor axis. This corresponds to the shortest radius of the ellipse.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Ellipse | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Ellipse | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Ellipse | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
]
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Line2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Line2d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
eq | No Documentation 🚧 |
new | Create a new `Plane2d` from a normal # Panics Panics if the given `normal` is zero (or very close... |
clone | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
normal | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Plane2d | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Plane2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
from_size | Create a new `Rectangle` from a given full size |
eq | No Documentation 🚧 |
from_corners | Create a new `Rectangle` from two corner points |
closest_point | Finds the point on the rectangle that is closest to the given `point`. If the point is outside the... |
size | Get the size of the rectangle |
from_length | Create a `Rectangle` from a single length. The resulting `Rectangle` will be the same size in ever... |
clone | No Documentation 🚧 |
new | Create a new `Rectangle` from a full width and height |
from_size
Create a new
Rectangle
from a given full size
Arguments
Name | Type | Documentation |
---|---|---|
size | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rectangle | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
from_corners
Create a new
Rectangle
from two corner points
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
size
Get the size of the rectangle
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rectangle | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
from_length
Create a
Rectangle
from a single length. The resultingRectangle
will be the same size in every direction.
Arguments
Name | Type | Documentation |
---|---|---|
length | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rectangle | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rectangle | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rectangle | No Documentation 🚧 |
new
Create a new
Rectangle
from a full width and height
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rectangle | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
external_angle_degrees | Get the external angle of the regular polygon in degrees. This is the angle formed by two adjacent... |
circumradius | Get the radius of the circumcircle on which all vertices of the regular polygon lie |
side_length | Get the length of one side of the regular polygon |
inradius | Get the inradius or apothem of the regular polygon. This is the radius of the largest circle that ... |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
new | Create a new `RegularPolygon` from the radius of the circumcircle and a number of sides # Panics ... |
internal_angle_degrees | Get the internal angle of the regular polygon in degrees. This is the angle formed by two adjacent... |
external_angle_radians | Get the external angle of the regular polygon in radians. This is the angle formed by two adjacent... |
internal_angle_radians | Get the internal angle of the regular polygon in radians. This is the angle formed by two adjacent... |
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
Name | Type | Documentation |
---|---|---|
_self | RegularPolygon | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
circumradius
Get the radius of the circumcircle on which all vertices of the regular polygon lie
Arguments
Name | Type | Documentation |
---|---|---|
_self | RegularPolygon | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
side_length
Get the length of one side of the regular polygon
Arguments
Name | Type | Documentation |
---|---|---|
_self | RegularPolygon | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | RegularPolygon | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | RegularPolygon | No Documentation 🚧 |
other | RegularPolygon | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | RegularPolygon | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | RegularPolygon | No Documentation 🚧 |
new
Create a new
RegularPolygon
from the radius of the circumcircle and a number of sidesPanics
Panics if
circumradius
is negative
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | RegularPolygon | 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
Name | Type | Documentation |
---|---|---|
_self | RegularPolygon | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | RegularPolygon | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | RegularPolygon | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
circumradius | Get the radius of the circumcircle on which all vertices of the rhombus lie |
inradius | Get the radius of the largest circle that can be drawn within the rhombus |
from_inradius | Create a new `Rhombus` from a given inradius with all inner angles equal. |
side | Get the length of each side of the rhombus |
closest_point | Finds the point on the rhombus that is closest to the given `point`. If the point is outside the r... |
eq | No Documentation 🚧 |
new | Create a new `Rhombus` from a vertical and horizontal diagonal sizes. |
from_side | Create a new `Rhombus` from a side length with all inner angles equal. |
clone | No Documentation 🚧 |
circumradius
Get the radius of the circumcircle on which all vertices of the rhombus lie
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rhombus | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
inradius
Get the radius of the largest circle that can be drawn within the rhombus
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rhombus | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
from_inradius
Create a new
Rhombus
from a given inradius with all inner angles equal.
Arguments
Name | Type | Documentation |
---|---|---|
inradius | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rhombus | No Documentation 🚧 |
side
Get the length of each side of the rhombus
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rhombus | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
new
Create a new
Rhombus
from a vertical and horizontal diagonal sizes.
Arguments
Name | Type | Documentation |
---|---|---|
horizontal_diagonal | f32 | No Documentation 🚧 |
vertical_diagonal | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rhombus | No Documentation 🚧 |
from_side
Create a new
Rhombus
from a side length with all inner angles equal.
Arguments
Name | Type | Documentation |
---|---|---|
side | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rhombus | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rhombus | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rhombus | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
point2 | Get the position of the second point on the line segment |
point1 | Get the position of the first point on the line segment |
new | Create a new `Segment2d` from a direction and full length of the segment |
eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Segment2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Segment2d | No Documentation 🚧 |
point2
Get the position of the second point on the line segment
Arguments
Name | Type | Documentation |
---|---|---|
_self | Segment2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
point1
Get the position of the first point on the line segment
Arguments
Name | Type | Documentation |
---|---|---|
_self | Segment2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
new
Create a new
Segment2d
from a direction and full length of the segment
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Segment2d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
Triangle2d
Triangle2d
- vertices:[glam::Vec2; 3]
Description
A triangle in 2D space
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
new | Create a new `Triangle2d` from points `a`, `b`, and `c` |
is_acute | Checks if the triangle is acute, meaning all angles are less than 90 degrees |
is_degenerate | Checks if the triangle is degenerate, meaning it has zero area. A triangle is degenerate if the cr... |
is_obtuse | Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees |
eq | No Documentation 🚧 |
reversed | This triangle but reversed. |
reverse | Reverse the [`WindingOrder`] of the triangle by swapping the first and last vertices. |
clone | No Documentation 🚧 |
new
Create a new
Triangle2d
from pointsa
,b
, andc
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Triangle2d | No Documentation 🚧 |
is_acute
Checks if the triangle is acute, meaning all angles are less than 90 degrees
Arguments
Name | Type | Documentation |
---|---|---|
_self | Triangle2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Triangle2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
is_obtuse
Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees
Arguments
Name | Type | Documentation |
---|---|---|
_self | Triangle2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Triangle2d | No Documentation 🚧 |
other | Triangle2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
reversed
This triangle but reversed.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Triangle2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Triangle2d | No Documentation 🚧 |
reverse
Reverse the [
WindingOrder
] of the triangle by swapping the first and last vertices.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Triangle2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Triangle2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
new | Create a new `Capsule3d` from a radius and length |
eq | No Documentation 🚧 |
to_cylinder | Get the part connecting the hemispherical ends of the capsule as a [`Cylinder`] |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Capsule3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Capsule3d | No Documentation 🚧 |
new
Create a new
Capsule3d
from a radius and length
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Capsule3d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
to_cylinder
Get the part connecting the hemispherical ends of the capsule as a [
Cylinder
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Capsule3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
base_area | Get the surface area of the base of the cone |
base | Get the base of the cone as a [`Circle`] |
clone | No Documentation 🚧 |
lateral_area | Get the surface area of the side of the cone, also known as the lateral area |
eq | No Documentation 🚧 |
new | Create a new [`Cone`] from a radius and height. |
slant_height | Get the slant height of the cone, the length of the line segment connecting a point on the base to... |
base_area
Get the surface area of the base of the cone
Arguments
Name | Type | Documentation |
---|---|---|
_self | Cone | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
base
Get the base of the cone as a [
Circle
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Cone | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Circle | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Cone | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Cone | No Documentation 🚧 |
lateral_area
Get the surface area of the side of the cone, also known as the lateral area
Arguments
Name | Type | Documentation |
---|---|---|
_self | Cone | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
new
Create a new [
Cone
] from a radius and height.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Cone | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | ConicalFrustum | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | ConicalFrustum | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | ConicalFrustum | No Documentation 🚧 |
other | ConicalFrustum | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
closest_point | Finds the point on the cuboid that is closest to the given `point`. If the point is outside the cu... |
eq | No Documentation 🚧 |
from_size | Create a new `Cuboid` from a given full size |
clone | No Documentation 🚧 |
size | Get the size of the cuboid |
new | Create a new `Cuboid` from a full x, y, and z length |
from_corners | Create a new `Cuboid` from two corner points |
from_length | Create a `Cuboid` from a single length. The resulting `Cuboid` will be the same size in every dire... |
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
from_size
Create a new
Cuboid
from a given full size
Arguments
Name | Type | Documentation |
---|---|---|
size | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Cuboid | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Cuboid | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Cuboid | No Documentation 🚧 |
size
Get the size of the cuboid
Arguments
Name | Type | Documentation |
---|---|---|
_self | Cuboid | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
new
Create a new
Cuboid
from a full x, y, and z length
Arguments
Name | Type | Documentation |
---|---|---|
x_length | f32 | No Documentation 🚧 |
y_length | f32 | No Documentation 🚧 |
z_length | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Cuboid | No Documentation 🚧 |
from_corners
Create a new
Cuboid
from two corner points
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Cuboid | No Documentation 🚧 |
from_length
Create a
Cuboid
from a single length. The resultingCuboid
will be the same size in every direction.
Arguments
Name | Type | Documentation |
---|---|---|
length | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Cuboid | No Documentation 🚧 |
Cylinder
Cylinder
- radius:f32
- half_height:f32
Description
A cylinder primitive centered on the origin
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
lateral_area | Get the surface area of the side of the cylinder, also known as the lateral area |
base | Get the base of the cylinder as a [`Circle`] |
eq | No Documentation 🚧 |
new | Create a new `Cylinder` from a radius and full height |
base_area | Get the surface area of one base of the cylinder |
clone | No Documentation 🚧 |
lateral_area
Get the surface area of the side of the cylinder, also known as the lateral area
Arguments
Name | Type | Documentation |
---|---|---|
_self | Cylinder | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
base
Get the base of the cylinder as a [
Circle
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Cylinder | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Circle | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
new
Create a new
Cylinder
from a radius and full height
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Cylinder | No Documentation 🚧 |
base_area
Get the surface area of one base of the cylinder
Arguments
Name | Type | Documentation |
---|---|---|
_self | Cylinder | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Cylinder | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
isometry_into_xy | 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]... |
eq | No Documentation 🚧 |
isometry_from_xy | Computes an [`Isometry3d`] which transforms points from the XY-plane to this plane with the given `origin`. ## Guarantees * the transformation is a [congruence]... |
clone | 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
Name | Type | Documentation |
---|---|---|
_self | InfinitePlane3d | No Documentation 🚧 |
origin | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Isometry3d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | InfinitePlane3d | No Documentation 🚧 |
other | InfinitePlane3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | InfinitePlane3d | No Documentation 🚧 |
origin | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Isometry3d | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | InfinitePlane3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | InfinitePlane3d | 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
]
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Line3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Line3d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
new | Create a new `Plane3d` from a normal and a half size # Panics Panics if the given `normal` is zer... |
clone | No Documentation 🚧 |
eq | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Plane3d | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Plane3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Plane3d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
point2 | Get the position of the second point on the line segment |
point1 | Get the position of the first point on the line segment |
clone | No Documentation 🚧 |
new | Create a new `Segment3d` from a direction and full length of the segment |
eq | No Documentation 🚧 |
point2
Get the position of the second point on the line segment
Arguments
Name | Type | Documentation |
---|---|---|
_self | Segment3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
point1
Get the position of the first point on the line segment
Arguments
Name | Type | Documentation |
---|---|---|
_self | Segment3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Segment3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Segment3d | No Documentation 🚧 |
new
Create a new
Segment3d
from a direction and full length of the segment
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Segment3d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
Sphere
Sphere
- radius:f32
Description
A sphere primitive, representing the set of all points some distance from the origin
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
diameter | Get the diameter of the sphere |
new | Create a new [`Sphere`] from a `radius` |
eq | No Documentation 🚧 |
closest_point | Finds the point on the sphere that is closest to the given `point`. If the point is outside the sp... |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Sphere | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Sphere | No Documentation 🚧 |
diameter
Get the diameter of the sphere
Arguments
Name | Type | Documentation |
---|---|---|
_self | Sphere | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
new
Create a new [
Sphere
] from aradius
Arguments
Name | Type | Documentation |
---|---|---|
radius | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Sphere | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
Tetrahedron
Tetrahedron
- vertices:[glam::Vec3; 4]
Description
A tetrahedron primitive.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
centroid | Get the centroid of the tetrahedron. This function finds the geometric center of the tetrahedron ... |
signed_volume | Get the signed volume of the tetrahedron. If it's negative, the normal vector of the face defined ... |
new | Create a new [`Tetrahedron`] from points `a`, `b`, `c` and `d`. |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
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
Name | Type | Documentation |
---|---|---|
_self | Tetrahedron | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | 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
Name | Type | Documentation |
---|---|---|
_self | Tetrahedron | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
new
Create a new [
Tetrahedron
] from pointsa
,b
,c
andd
.
Arguments
Name | Type | Documentation |
---|---|---|
a | Vec3 | No Documentation 🚧 |
b | Vec3 | No Documentation 🚧 |
c | Vec3 | No Documentation 🚧 |
d | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Tetrahedron | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Tetrahedron | No Documentation 🚧 |
other | Tetrahedron | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Tetrahedron | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Tetrahedron | 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
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
inner_radius | Get the inner radius of the torus. For a ring torus, this corresponds to the radius of the hole, ... |
new | Create a new `Torus` from an inner and outer radius. The inner radius is the radius of the hole, a... |
outer_radius | Get the outer radius of the torus. This corresponds to the overall radius of the entire object, o... |
clone | No Documentation 🚧 |
eq | 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
Name | Type | Documentation |
---|---|---|
_self | Torus | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Torus | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Torus | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Torus | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
Triangle3d
Triangle3d
- vertices:[glam::Vec3; 3]
Description
A 3D triangle primitive.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
is_degenerate | Checks if the triangle is degenerate, meaning it has zero area. A triangle is degenerate if the cr... |
eq | No Documentation 🚧 |
is_acute | Checks if the triangle is acute, meaning all angles are less than 90 degrees |
circumcenter | Get the circumcenter of the triangle. |
reverse | Reverse the triangle by swapping the first and last vertices. |
new | Create a new [`Triangle3d`] from points `a`, `b`, and `c`. |
reversed | This triangle but reversed. |
is_obtuse | Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees |
centroid | Get the centroid of the triangle. This function finds the geometric center of the triangle by aver... |
clone | 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
Name | Type | Documentation |
---|---|---|
_self | Triangle3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Triangle3d | No Documentation 🚧 |
other | Triangle3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
is_acute
Checks if the triangle is acute, meaning all angles are less than 90 degrees
Arguments
Name | Type | Documentation |
---|---|---|
_self | Triangle3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
circumcenter
Get the circumcenter of the triangle.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Triangle3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
reverse
Reverse the triangle by swapping the first and last vertices.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Triangle3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
new
Create a new [
Triangle3d
] from pointsa
,b
, andc
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Triangle3d | No Documentation 🚧 |
reversed
This triangle but reversed.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Triangle3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Triangle3d | No Documentation 🚧 |
is_obtuse
Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees
Arguments
Name | Type | Documentation |
---|---|---|
_self | Triangle3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
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
Name | Type | Documentation |
---|---|---|
_self | Triangle3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Triangle3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
new | Create a new `Ray2d` from a given origin and direction |
eq | No Documentation 🚧 |
get_point | Get a point at a given distance along the ray |
intersect_plane | Get the distance to a plane if the ray intersects it |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Ray2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Ray2d | No Documentation 🚧 |
new
Create a new
Ray2d
from a given origin and direction
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Ray2d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
get_point
Get a point at a given distance along the ray
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
intersect_plane
Get the distance to a plane if the ray intersects it
Arguments
Name | Type | Documentation |
---|---|---|
_self | Ray2d | No Documentation 🚧 |
plane_origin | Vec2 | No Documentation 🚧 |
plane | Plane2d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Optional<f32> | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
get_point | Get a point at a given distance along the ray |
intersect_plane | Get the distance to a plane if the ray intersects it |
new | Create a new `Ray3d` from a given origin and direction |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
get_point
Get a point at a given distance along the ray
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
intersect_plane
Get the distance to a plane if the ray intersects it
Arguments
Name | Type | Documentation |
---|---|---|
_self | Ray3d | No Documentation 🚧 |
plane_origin | Vec3 | No Documentation 🚧 |
plane | InfinitePlane3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Optional<f32> | No Documentation 🚧 |
new
Create a new
Ray3d
from a given origin and direction
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Ray3d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Ray3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
new | Create a new rectangle from two corner points. The two points do not need to be the minimum and/or... |
center | The center point of the rectangle. # Rounding Behavior If the (min + max) contains odd numbers th... |
as_rect | Returns self as [`Rect`] (f32) |
assert_receiver_is_total_eq | 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); `... |
union_point | Build a new rectangle formed of the union of this rectangle and a point. The union is the smallest... |
from_corners | Create a new rectangle from two corner points. The two points do not need to be the minimum and/or... |
from_center_half_size | Create a new rectangle from its center and half-size. # Panics This method panics if any of the c... |
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); `... |
as_urect | Returns self as [`URect`] (u32) |
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)); ``` |
inflate | Create a new rectangle by expanding it evenly on all sides. A positive expansion value produces a ... |
clone | 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)); `... |
intersect | Build a new rectangle formed of the intersection of this rectangle and another rectangle. The inte... |
union | Build a new rectangle formed of the union of this rectangle and another rectangle. The union is th... |
from_center_size | Create a new rectangle from its center and size. # Rounding Behavior If the size contains odd num... |
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()); ``` |
eq | No Documentation 🚧 |
half_size | Rectangle half-size. # Rounding Behavior If the full size contains odd numbers they will be round... |
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
Name | Type | Documentation |
---|---|---|
x0 | i32 | No Documentation 🚧 |
y0 | i32 | No Documentation 🚧 |
x1 | i32 | No Documentation 🚧 |
y1 | i32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IRect | 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
Name | Type | Documentation |
---|---|---|
_self | IRect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
as_rect
Returns self as [
Rect
] (f32)
Arguments
Name | Type | Documentation |
---|---|---|
_self | IRect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rect | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | IRect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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
Name | Type | Documentation |
---|---|---|
_self | IRect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IRect | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IRect | 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
Name | Type | Documentation |
---|---|---|
_self | IRect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | No Documentation 🚧 |
as_urect
Returns self as [
URect
] (u32)
Arguments
Name | Type | Documentation |
---|---|---|
_self | IRect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | URect | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IRect | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | IRect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | IRect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IRect | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | IRect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | IRect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
from_center_size | Create a new rectangle from its center and size. # Panics This method panics if any of the compon... |
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)); ``` |
union_point | Build a new rectangle formed of the union of this rectangle and a point. The union is the smallest... |
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); ``` |
intersect | Build a new rectangle formed of the intersection of this rectangle and another rectangle. The inte... |
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()); ``` |
normalize | Build a new rectangle from this one with its coordinates expressed relative to `other` in a normal... |
new | Create a new rectangle from two corner points. The two points do not need to be the minimum and/or... |
eq | 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)); ``` |
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)); ``` |
from_center_half_size | Create a new rectangle from its center and half-size. # Panics This method panics if any of the c... |
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); ``` |
as_irect | Returns self as [`IRect`] (i32) |
as_urect | Returns self as [`URect`] (u32) |
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)); `... |
clone | No Documentation 🚧 |
inflate | Create a new rectangle by expanding it evenly on all sides. A positive expansion value produces a ... |
from_corners | Create a new rectangle from two corner points. The two points do not need to be the minimum and/or... |
union | Build a new rectangle formed of the union of this rectangle and another rectangle. The union is th... |
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rect | 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
Name | Type | Documentation |
---|---|---|
_self | Rect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rect | 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
Name | Type | Documentation |
---|---|---|
_self | Rect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Rect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rect | 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
Name | Type | Documentation |
---|---|---|
x0 | f32 | No Documentation 🚧 |
y0 | f32 | No Documentation 🚧 |
x1 | f32 | No Documentation 🚧 |
y1 | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rect | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | Rect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Rect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
as_irect
Returns self as [
IRect
] (i32)
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IRect | No Documentation 🚧 |
as_urect
Returns self as [
URect
] (u32)
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | URect | 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
Name | Type | Documentation |
---|---|---|
_self | Rect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rect | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rect | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rect | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
as_irect | Returns self as [`IRect`] (i32) |
union | Build a new rectangle formed of the union of this rectangle and another rectangle. The union is th... |
new | Create a new rectangle from two corner points. The two points do not need to be the minimum and/or... |
clone | No Documentation 🚧 |
inflate | Create a new rectangle by expanding it evenly on all sides. A positive expansion value produces a ... |
assert_receiver_is_total_eq | No Documentation 🚧 |
center | The center point of the rectangle. # Rounding Behavior If the (min + max) contains odd numbers th... |
intersect | Build a new rectangle formed of the intersection of this rectangle and another rectangle. The inte... |
half_size | Rectangle half-size. # Rounding Behavior If the full size contains odd numbers they will be round... |
from_center_half_size | Create a new rectangle from its center and half-size. # Panics This method panics if any of the c... |
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)); ``` |
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()); ``` |
union_point | Build a new rectangle formed of the union of this rectangle and a point. The union is the smallest... |
from_corners | Create a new rectangle from two corner points. The two points do not need to be the minimum and/or... |
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); `... |
eq | No Documentation 🚧 |
as_rect | Returns self as [`Rect`] (f32) |
from_center_size | Create a new rectangle from its center and size. # Rounding Behavior If the size contains odd num... |
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); `... |
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)); `... |
as_irect
Returns self as [
IRect
] (i32)
Arguments
Name | Type | Documentation |
---|---|---|
_self | URect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IRect | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | URect | 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
Name | Type | Documentation |
---|---|---|
x0 | u32 | No Documentation 🚧 |
y0 | u32 | No Documentation 🚧 |
x1 | u32 | No Documentation 🚧 |
y1 | u32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | URect | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | URect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | URect | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | URect | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | URect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | URect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | URect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | URect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | URect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
as_rect
Returns self as [
Rect
] (f32)
Arguments
Name | Type | Documentation |
---|---|---|
_self | URect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rect | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | URect | 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
Name | Type | Documentation |
---|---|---|
_self | URect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | 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
Name | Type | Documentation |
---|---|---|
_self | URect | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | 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);
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
is_nan | Returns `true` if the rotation is NaN. |
sin_cos | Returns the sine and cosine of the rotation angle in radians. |
length_squared | Computes the squared length or norm of the complex number used to represent the rotation. This is ... |
slerp | Performs a spherical linear interpolation between `self` and `end` based on the value `s`. This c... |
as_radians | Returns the rotation in radians in the `(-pi, pi]` range. |
nlerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`, and normalizes th... |
radians | Creates a [`Rot2`] from a counterclockwise angle in radians. # Note The input rotation will always be clamped to the range `(-π, π]... |
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%]... |
angle_to | Returns the angle in radians needed to make `self` and `other` coincide. |
inverse | Returns the inverse of the rotation. This is also the conjugate of the unit complex number represe... |
mul-1 | No Documentation 🚧 |
fast_renormalize | Returns `self` after an approximate normalization, assuming the value is already nearly normalized.... |
is_finite | Returns `true` if the rotation is neither infinite nor NaN. |
mul-2 | No Documentation 🚧 |
length | Computes the length or norm of the complex number used to represent the rotation. The length is ty... |
from_sin_cos | Creates a [`Rot2`] from the sine and cosine of an angle in radians. The rotation is only valid if `sin * sin + cos * cos == 1.0`. # Panics Panics if `sin * sin + cos * cos != 1.0` when the `glam_assert` feature is enabled. |
normalize | Returns `self` with a length of `1.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. |
degrees | Creates a [`Rot2`] from a counterclockwise angle in degrees. # Note The input rotation will always be clamped to the range `(-180°, 180°]... |
as_turn_fraction | Returns the rotation as a fraction of a full 360 degree turn. |
clone | No Documentation 🚧 |
eq | No Documentation 🚧 |
is_near_identity | Returns `true` if the rotation is near [`Rot2::IDENTITY`]. |
length_recip | Computes `1.0 / self.length()`. For valid results, `self` must _not_ have a length of zero. |
as_degrees | Returns the rotation in degrees in the `(-180, 180]` range. |
angle_between | Returns the angle in radians needed to make `self` and `other` coincide. |
mul | No Documentation 🚧 |
is_normalized | Returns whether `self` has a length of `1.0` or not. Uses a precision threshold of approximately `1e-4`... |
is_nan
Returns
true
if the rotation is NaN.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rot2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
sin_cos
Returns the sine and cosine of the rotation angle in radians.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rot2 | No Documentation 🚧 |
Returns
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
Name | Type | Documentation |
---|---|---|
_self | Rot2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rot2 | No Documentation 🚧 |
as_radians
Returns the rotation in radians in the
(-pi, pi]
range.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rot2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
radians | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
fraction | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rot2 | No Documentation 🚧 |
angle_to
Returns the angle in radians needed to make
self
andother
coincide.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
inverse
Returns the inverse of the rotation. This is also the conjugate of the unit complex number representing the rotation.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rot2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rot2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir2 | 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
Name | Type | Documentation |
---|---|---|
_self | Rot2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rot2 | No Documentation 🚧 |
is_finite
Returns
true
if the rotation is neither infinite nor NaN.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rot2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | 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
Name | Type | Documentation |
---|---|---|
_self | Rot2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Rot2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
degrees | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rot2 | No Documentation 🚧 |
as_turn_fraction
Returns the rotation as a fraction of a full 360 degree turn.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rot2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rot2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rot2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
is_near_identity
Returns
true
if the rotation is near [Rot2::IDENTITY
].
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rot2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
length_recip
Computes
1.0 / self.length()
. For valid results,self
must not have a length of zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rot2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
as_degrees
Returns the rotation in degrees in the
(-180, 180]
range.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rot2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
angle_between
Returns the angle in radians needed to make
self
andother
coincide.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Rot2 | No Documentation 🚧 |
is_normalized
Returns whether
self
has a length of1.0
or not. Uses a precision threshold of approximately1e-4
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Rot2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Fixed | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
-
When using
TimeUpdateStrategy::ManualDuration
, [Time<Real>#impl-Time<Real>
] is only a mock of wall clock time. ↩ ↩2
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Real | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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);
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
elapsed_secs | Returns the elapsed time since the last [`reset`](Stopwatch::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`](Stopwatch::elapsed)... |
elapsed | Returns the elapsed time since the last [`reset`](Stopwatch::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`](Stopwatch::elapsed_secs)... |
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); ``` |
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); ``` |
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()); ``` |
eq | No Documentation 🚧 |
pause | Pauses the stopwatch. Any call to [`tick`](Stopwatch::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); ``` |
clone | 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); ``` |
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); ``` |
elapsed_secs_f64 | Returns the elapsed time since the last [`reset`](Stopwatch::reset) of the stopwatch, in seconds, as f64. # See Also [`elapsed`](Stopwatch::elapsed)... |
assert_receiver_is_total_eq | 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
Name | Type | Documentation |
---|---|---|
_self | Stopwatch | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Name | Type | Documentation |
---|---|---|
_self | Stopwatch | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | 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
Name | Type | Documentation |
---|---|---|
_self | Stopwatch | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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
Name | Type | Documentation |
---|---|---|
_self | Stopwatch | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | Stopwatch | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Stopwatch | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Stopwatch | 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
Name | Type | Documentation |
---|---|---|
_self | Stopwatch | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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
Name | Type | Documentation |
---|---|---|
arg0 | Stopwatch | 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
Name | Type | Documentation |
---|---|---|
_self | Stopwatch | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Stopwatch | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
elapsed_secs_f64 | Returns the time elapsed on the timer as an `f64`. See also [`Timer::elapsed`](Timer::elapsed). |
new | Creates a new timer with a given duration. See also [`Timer::from_seconds`](Timer::from_seconds). |
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); ``` |
unpause | Unpauses the Timer. Resumes the ticking of the timer. See also [`Stopwatch::unpause()`](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); ``` |
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); ``` |
elapsed_secs | Returns the time elapsed on the timer as an `f32`. See also [`Timer::elapsed`](Timer::elapsed). |
elapsed | Returns the time elapsed on the timer. Guaranteed to be between 0.0 and `duration`. Will only equa... |
reset | Resets the timer. The reset doesn't affect the `paused` state of the timer. See also [`Stopwatch::reset`](Stopwatch::reset)... |
paused | Returns `true` if the timer is paused. See also [`Stopwatch::is_paused`](Stopwatch::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()); ``` |
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); ``` |
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()); ``` |
finished | Returns `true` if the timer has reached its duration. For repeating timers, this method behaves id... |
clone | 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)); ``` |
pause | Pauses the Timer. Disables the ticking of the timer. See also [`Stopwatch::pause`](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); ``` |
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)); ``` |
times_finished_this_tick | Returns the number of times a repeating timer finished during the last [`tick`](Timer |
assert_receiver_is_total_eq | 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)); ``` |
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); ``` |
set_elapsed | Sets the elapsed time of the timer without any other considerations. See also [`Stopwatch::set`](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()); ``` |
eq | 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); ``` |
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); ``` |
elapsed_secs_f64
Returns the time elapsed on the timer as an
f64
. See alsoTimer::elapsed
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
new
Creates a new timer with a given duration. See also
Timer::from_seconds
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Timer | 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
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | TimerMode | 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
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
elapsed_secs
Returns the time elapsed on the timer as an
f32
. See alsoTimer::elapsed
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | 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
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Timer | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | 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
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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
Name | Type | Documentation |
---|---|---|
_self | Timer | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
TimerMode
Once
Repeating
Description
Specifies [
Timer
] behavior.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
eq | No Documentation 🚧 |
assert_receiver_is_total_eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | TimerMode | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | TimerMode | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | TimerMode | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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.
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Virtual | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
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. |
from_rotation | No Documentation 🚧 |
from_xyz | No Documentation 🚧 |
mul-1 | No Documentation 🚧 |
back | Return the local back vector (Z). |
up | Return the local up vector (Y). |
translation_vec3a | Get the translation as a [`Vec3A`]. |
right | Return the local right vector (X). |
forward | Return the local forward vector (-Z). |
transform_point | Transforms the given point from local space to global space, applying shear, scale, rotation and tr... |
affine | Returns the 3d affine transformation matrix as an [`Affine3A`]. |
mul-2 | No Documentation 🚧 |
compute_matrix | Returns the 3d affine transformation matrix as a [`Mat4`]. |
clone | No Documentation 🚧 |
left | Return the local left vector (-X). |
from_isometry | No Documentation 🚧 |
eq | No Documentation 🚧 |
mul | No Documentation 🚧 |
from_translation | No Documentation 🚧 |
reparented_to | Returns the [`Transform`] `self` would have if it was a child of an entity with the `parent` [`GlobalTransform`... |
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 with `to_scale_rotation_translation`, which means you should use it instead if you also need rotation. |
mul_transform | Multiplies `self` with `transform` component by component, returning the resulting [`GlobalTransform`]... |
translation | Get the translation as a [`Vec3`]. |
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]... |
from_scale | No Documentation 🚧 |
radius_vec3a | Get an upper bound of the radius from the given `extents`. |
down | Return the local down vector (-Y). |
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. |
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
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Transform | No Documentation 🚧 |
from_rotation
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
rotation | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GlobalTransform | No Documentation 🚧 |
from_xyz
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GlobalTransform | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
arg0 | GlobalTransform | No Documentation 🚧 |
arg1 | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GlobalTransform | No Documentation 🚧 |
back
Return the local back vector (Z).
Arguments
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | No Documentation 🚧 |
up
Return the local up vector (Y).
Arguments
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | No Documentation 🚧 |
translation_vec3a
Get the translation as a [
Vec3A
].
Arguments
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
right
Return the local right vector (X).
Arguments
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | No Documentation 🚧 |
forward
Return the local forward vector (-Z).
Arguments
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | 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
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
point | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
affine
Returns the 3d affine transformation matrix as an [
Affine3A
].
Arguments
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
arg0 | GlobalTransform | No Documentation 🚧 |
arg1 | Transform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GlobalTransform | No Documentation 🚧 |
compute_matrix
Returns the 3d affine transformation matrix as a [
Mat4
].
Arguments
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GlobalTransform | No Documentation 🚧 |
left
Return the local left vector (-X).
Arguments
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | No Documentation 🚧 |
from_isometry
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
iso | Isometry3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GlobalTransform | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
other | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
value | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
from_translation
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
translation | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GlobalTransform | 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
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
parent | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Transform | 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
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
mul_transform
Multiplies
self
withtransform
component by component, returning the resulting [GlobalTransform
]
Arguments
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
transform | Transform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GlobalTransform | No Documentation 🚧 |
translation
Get the translation as a [
Vec3
].
Arguments
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Isometry3d | No Documentation 🚧 |
from_scale
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
scale | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GlobalTransform | No Documentation 🚧 |
radius_vec3a
Get an upper bound of the radius from the given
extents
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
extents | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
down
Return the local down vector (-Y).
Arguments
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | 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
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
with_scale | Returns this [`Transform`] with a new scale. |
is_finite | Returns `true` if, and only if, translation, rotation and scale all are finite. If any of them con... |
left | Equivalent to [`-local_x()`][Transform::local_x()] |
from_xyz | Creates a new [`Transform`] at the position `(x, y, z)`. In 2d, the `z` component is used for z-ordering elements: higher `z`-value will be in front of lower `z`-value. |
mul-1 | No Documentation 🚧 |
local_z | Get the unit vector in the local `Z` direction. |
local_x | Get the unit vector in the local `X` direction. |
transform_point | Transforms the given `point`, applying scale, rotation and translation. If this [`Transform`] has an ancestor entity with a [`Transform`]... |
rotate_local_x | Rotates this [`Transform`] around its local `X` axis by `angle` (in radians). |
from_rotation | Creates a new [`Transform`], with `rotation`. Translation will be 0 and scale 1 on all axes. |
right | Equivalent to [`local_x()`][Transform::local_x()] |
from_scale | Creates a new [`Transform`], with `scale`. Translation will be 0 and rotation 0 on all axes. |
from_isometry | Creates a new [`Transform`] that is equivalent to the given [isometry]. [isometry]: Isometry3d |
rotate | Rotates this [`Transform`] by the given rotation. If this [`Transform`] has a parent, the `rotation`... |
mul | No Documentation 🚧 |
rotate_local_z | Rotates this [`Transform`] around its local `Z` axis by `angle` (in radians). |
compute_affine | Returns the 3d affine transformation matrix from this transforms translation, rotation, and scale. |
with_translation | Returns this [`Transform`] with a new translation. |
down | Equivalent to [`-local_y()`][Transform::local_y] |
rotate_around | Rotates this [`Transform`] around a `point` in space. If this [`Transform`] has a parent, the `point`... |
from_translation | Creates a new [`Transform`], with `translation`. Rotation will be 0 and scale 1 on all axes. |
with_rotation | Returns this [`Transform`] with a new rotation. |
rotate_local_y | Rotates this [`Transform`] around its local `Y` axis by `angle` (in radians). |
local_y | Get the unit vector in the local `Y` direction. |
compute_matrix | Returns the 3d affine transformation matrix from this transforms translation, rotation, and scale. |
rotate_local_axis | Rotates this [`Transform`] around its local `axis` by `angle` (in radians). |
rotate_x | Rotates this [`Transform`] around the `X` axis by `angle` (in radians). If this [`Transform`] has ... |
rotate_y | Rotates this [`Transform`] around the `Y` axis by `angle` (in radians). If this [`Transform`] has ... |
forward | Equivalent to [`-local_z()`][Transform::local_z] |
from_matrix | Extracts the translation, rotation, and scale from `matrix`. It must be a 3d affine transformation... |
up | Equivalent to [`local_y()`][Transform::local_y] |
eq | No Documentation 🚧 |
back | Equivalent to [`local_z()`][Transform::local_z] |
rotate_z | Rotates this [`Transform`] around the `Z` axis by `angle` (in radians). If this [`Transform`] has ... |
to_isometry | Get the [isometry] defined by this transform's rotation and translation, ignoring scale. [isometry... |
rotate_axis | Rotates this [`Transform`] around the given `axis` by `angle` (in radians). If this [`Transform`] ... |
mul-2 | No Documentation 🚧 |
mul_transform | Multiplies `self` with `transform` component by component, returning the resulting [`Transform`] |
rotate_local | Rotates this [`Transform`] by the given `rotation`. The `rotation` is relative to this [`Transform... |
clone | No Documentation 🚧 |
translate_around | Translates this [`Transform`] around a `point` in space. If this [`Transform`] has a parent, the `point`... |
with_scale
Returns this [
Transform
] with a new scale.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
left
Equivalent to [
-local_x()
][Transform::local_x()]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Transform | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
arg0 | Transform | No Documentation 🚧 |
arg1 | GlobalTransform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | GlobalTransform | No Documentation 🚧 |
local_z
Get the unit vector in the local
Z
direction.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | No Documentation 🚧 |
local_x
Get the unit vector in the local
X
direction.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
rotate_local_x
Rotates this [
Transform
] around its localX
axis byangle
(in radians).
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
from_rotation
Creates a new [
Transform
], withrotation
. Translation will be 0 and scale 1 on all axes.
Arguments
Name | Type | Documentation |
---|---|---|
rotation | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Transform | No Documentation 🚧 |
right
Equivalent to [
local_x()
][Transform::local_x()]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | No Documentation 🚧 |
from_scale
Creates a new [
Transform
], withscale
. Translation will be 0 and rotation 0 on all axes.
Arguments
Name | Type | Documentation |
---|---|---|
scale | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Transform | No Documentation 🚧 |
from_isometry
Creates a new [
Transform
] that is equivalent to the given [isometry]. [isometry]: Isometry3d
Arguments
Name | Type | Documentation |
---|---|---|
iso | Isometry3d | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Transform | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
rotate_local_z
Rotates this [
Transform
] around its localZ
axis byangle
(in radians).
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
compute_affine
Returns the 3d affine transformation matrix from this transforms translation, rotation, and scale.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | No Documentation 🚧 |
with_translation
Returns this [
Transform
] with a new translation.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Transform | No Documentation 🚧 |
down
Equivalent to [
-local_y()
][Transform::local_y]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | 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
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
point | Vec3 | No Documentation 🚧 |
rotation | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
from_translation
Creates a new [
Transform
], withtranslation
. Rotation will be 0 and scale 1 on all axes.
Arguments
Name | Type | Documentation |
---|---|---|
translation | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Transform | No Documentation 🚧 |
with_rotation
Returns this [
Transform
] with a new rotation.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Transform | No Documentation 🚧 |
rotate_local_y
Rotates this [
Transform
] around its localY
axis byangle
(in radians).
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
local_y
Get the unit vector in the local
Y
direction.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | No Documentation 🚧 |
compute_matrix
Returns the 3d affine transformation matrix from this transforms translation, rotation, and scale.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
rotate_local_axis
Rotates this [
Transform
] around its localaxis
byangle
(in radians).
Arguments
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
axis | Dir3 | No Documentation 🚧 |
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
forward
Equivalent to [
-local_z()
][Transform::local_z]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | No Documentation 🚧 |
from_matrix
Extracts the translation, rotation, and scale from
matrix
. It must be a 3d affine transformation matrix.
Arguments
Name | Type | Documentation |
---|---|---|
world_from_local | Mat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Transform | No Documentation 🚧 |
up
Equivalent to [
local_y()
][Transform::local_y]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
back
Equivalent to [
local_z()
][Transform::local_z]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Dir3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
to_isometry
Get the [isometry] defined by this transform's rotation and translation, ignoring scale. [isometry]: Isometry3d
Arguments
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Isometry3d | 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
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
axis | Dir3 | No Documentation 🚧 |
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Transform | No Documentation 🚧 |
mul_transform
Multiplies
self
withtransform
component by component, returning the resulting [Transform
]
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Transform | No Documentation 🚧 |
rotate_local
Rotates this [
Transform
] by the givenrotation
. Therotation
is relative to this [Transform
]'s current rotation.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Transform | 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
Name | Type | Documentation |
---|---|---|
_self | Transform | No Documentation 🚧 |
point | Vec3 | No Documentation 🚧 |
rotation | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
Duration
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
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()); ``` |
div | No Documentation 🚧 |
eq | No Documentation 🚧 |
saturating_sub | Saturating `Duration` subtraction. Computes `self - 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); ``` |
as_secs_f32 | Returns the number of seconds contained by this `Duration` as `f32`. The returned value includes t... |
add | 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); ``` |
from_secs_f32 | Creates a new `Duration` from the specified number of seconds represented as `f32`. # Panics Thi... |
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()); `... |
div_duration_f64 | Divides `Duration` by `Duration` and returns `f64`. # 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); ``` |
subsec_nanos | Returns the fractional part of this `Duration`, in nanoseconds. This method does **not** return th... |
new | Creates a new `Duration` from the specified number of whole seconds and additional nanoseconds. I... |
mul | 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()); ``` |
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); ``` |
abs_diff | Computes the absolute difference between `self` and `other`. # 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)); `... |
subsec_millis | Returns the fractional part of this `Duration`, in whole milliseconds. This method does **not** re... |
saturating_add | Saturating `Duration` addition. Computes `self + other`, returning [`Duration::MAX`] if overflow occurred. # Examples ``` #![feature(duration_constants)]... |
clone | No Documentation 🚧 |
as_secs_f64 | Returns the number of seconds contained by this `Duration` as `f64`. The returned value includes t... |
as_secs | Returns the number of _whole_ seconds contained by this `Duration`. The returned value does not in... |
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()); `... |
div_f32 | Divides `Duration` by `f32`. # Panics This method will panic if result is negative, overflows `Duration`... |
mul_f32 | Multiplies `Duration` by `f32`. # Panics This method will panic if result is negative, overflows `Duration`... |
sub | No Documentation 🚧 |
div_duration_f32 | Divides `Duration` by `Duration` and returns `f32`. # 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); ``` |
saturating_mul | Saturating `Duration` multiplication. Computes `self * 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); ``` |
subsec_micros | Returns the fractional part of this `Duration`, in whole microseconds. This method does **not** re... |
div_f64 | Divides `Duration` by `f64`. # Panics This method will panic if result is negative, overflows `Duration`... |
from_secs_f64 | Creates a new `Duration` from the specified number of seconds represented as `f64`. # Panics Thi... |
from_nanos | Creates a new `Duration` from the specified number of nanoseconds. Note: Using this on the return ... |
mul_f64 | Multiplies `Duration` by `f64`. # Panics This method will panic if result is negative, overflows `Duration`... |
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); `... |
assert_receiver_is_total_eq | 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
Name | Type | Documentation |
---|---|---|
secs | u64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | 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
Name | Type | Documentation |
---|---|---|
_self | Duration | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | 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
Name | Type | Documentation |
---|---|---|
_self | Duration | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u128 | 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
Name | Type | Documentation |
---|---|---|
secs | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | 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
Name | Type | Documentation |
---|---|---|
micros | u64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | 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
Name | Type | Documentation |
---|---|---|
_self | Duration | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Duration | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | Duration | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u128 | No Documentation 🚧 |
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | 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
Name | Type | Documentation |
---|---|---|
_self | Duration | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Duration | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | 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
Name | Type | Documentation |
---|---|---|
_self | Duration | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | 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
Name | Type | Documentation |
---|---|---|
_self | Duration | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | 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
Name | Type | Documentation |
---|---|---|
millis | u64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Duration | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
secs | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
nanos | u64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Duration | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u128 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Duration | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
Instant
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
saturating_duration_since | Returns the amount of time elapsed from another instant to this one, or zero duration if that inst... |
sub | No Documentation 🚧 |
add | # Panics This function may panic if the resulting point in time cannot be represented by the unde... |
now | Returns an instant corresponding to "now". # Examples ``` use std::time::Instant; let now = Instant::now(); `... |
elapsed | Returns the amount of time elapsed since this instant. # Panics Previous Rust versions panicked w... |
assert_receiver_is_total_eq | No Documentation 🚧 |
duration_since | Returns the amount of time elapsed from another instant to this one, or zero duration if that inst... |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
sub-1 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Instant | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Instant | No Documentation 🚧 |
now
Returns an instant corresponding to "now".
Examples
use std::time::Instant; let now = Instant::now();
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Instant | 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
Name | Type | Documentation |
---|---|---|
_self | Instant | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Instant | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Instant | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Instant | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Duration | No Documentation 🚧 |
RangeFull
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
eq | No Documentation 🚧 |
assert_receiver_is_total_eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | RangeFull | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | RangeFull | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | RangeFull | No Documentation 🚧 |
AtomicBool
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
new | Creates a new `AtomicBool`. # Examples ``` use std::sync::atomic::AtomicBool; let atomic_true = AtomicBool::new(true); let atomic_false = AtomicBool::new(false); `... |
into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new
Creates a new
AtomicBool
.Examples
use std::sync::atomic::AtomicBool; let atomic_true = AtomicBool::new(true); let atomic_false = AtomicBool::new(false);
Arguments
Name | Type | Documentation |
---|---|---|
v | bool | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AtomicBool | No Documentation 🚧 |
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
Name | Type | Documentation |
---|---|---|
_self | AtomicBool | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
AtomicI16
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicI16; let atomic_forty_two = AtomicI16::new(42); `... |
into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicI16; let atomic_forty_two = AtomicI16::new(42);
Arguments
Name | Type | Documentation |
---|---|---|
v | i16 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AtomicI16 | No Documentation 🚧 |
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
Name | Type | Documentation |
---|---|---|
_self | AtomicI16 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i16 | No Documentation 🚧 |
AtomicI32
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicI32; let atomic_forty_two = AtomicI32::new(42); `... |
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
Name | Type | Documentation |
---|---|---|
_self | AtomicI32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | No Documentation 🚧 |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicI32; let atomic_forty_two = AtomicI32::new(42);
Arguments
Name | Type | Documentation |
---|---|---|
v | i32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AtomicI32 | No Documentation 🚧 |
AtomicI64
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicI64; let atomic_forty_two = AtomicI64::new(42); `... |
into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicI64; let atomic_forty_two = AtomicI64::new(42);
Arguments
Name | Type | Documentation |
---|---|---|
v | i64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AtomicI64 | No Documentation 🚧 |
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
Name | Type | Documentation |
---|---|---|
_self | AtomicI64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | No Documentation 🚧 |
AtomicI8
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicI8; let atomic_forty_two = AtomicI8::new(42); `... |
into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicI8; let atomic_forty_two = AtomicI8::new(42);
Arguments
Name | Type | Documentation |
---|---|---|
v | i8 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AtomicI8 | No Documentation 🚧 |
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
Name | Type | Documentation |
---|---|---|
_self | AtomicI8 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i8 | No Documentation 🚧 |
AtomicIsize
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicIsize; let atomic_forty_two = AtomicIsize::new(42); `... |
into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicIsize; let atomic_forty_two = AtomicIsize::new(42);
Arguments
Name | Type | Documentation |
---|---|---|
v | isize | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AtomicIsize | No Documentation 🚧 |
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
Name | Type | Documentation |
---|---|---|
_self | AtomicIsize | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | isize | No Documentation 🚧 |
AtomicU16
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicU16; let atomic_forty_two = AtomicU16::new(42); `... |
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
Name | Type | Documentation |
---|---|---|
_self | AtomicU16 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u16 | No Documentation 🚧 |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicU16; let atomic_forty_two = AtomicU16::new(42);
Arguments
Name | Type | Documentation |
---|---|---|
v | u16 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AtomicU16 | No Documentation 🚧 |
AtomicU32
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicU32; let atomic_forty_two = AtomicU32::new(42); `... |
into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicU32; let atomic_forty_two = AtomicU32::new(42);
Arguments
Name | Type | Documentation |
---|---|---|
v | u32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AtomicU32 | No Documentation 🚧 |
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
Name | Type | Documentation |
---|---|---|
_self | AtomicU32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
AtomicU64
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicU64; let atomic_forty_two = AtomicU64::new(42); `... |
into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicU64; let atomic_forty_two = AtomicU64::new(42);
Arguments
Name | Type | Documentation |
---|---|---|
v | u64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AtomicU64 | No Documentation 🚧 |
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
Name | Type | Documentation |
---|---|---|
_self | AtomicU64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | No Documentation 🚧 |
AtomicU8
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicU8; let atomic_forty_two = AtomicU8::new(42); `... |
into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicU8; let atomic_forty_two = AtomicU8::new(42);
Arguments
Name | Type | Documentation |
---|---|---|
v | u8 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AtomicU8 | No Documentation 🚧 |
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
Name | Type | Documentation |
---|---|---|
_self | AtomicU8 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u8 | No Documentation 🚧 |
AtomicUsize
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicUsize; let atomic_forty_two = AtomicUsize::new(42); `... |
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
Name | Type | Documentation |
---|---|---|
_self | AtomicUsize | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | usize | No Documentation 🚧 |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicUsize; let atomic_forty_two = AtomicUsize::new(42);
Arguments
Name | Type | Documentation |
---|---|---|
v | usize | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | AtomicUsize | No Documentation 🚧 |
Affine2
Affine2
- matrix2:glam::Mat2
- translation:glam::Vec2
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
from_mat2_translation | Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) and a transla... |
from_mat2 | Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) |
eq | No Documentation 🚧 |
transform_vector2 | Transforms the given 2D vector, applying shear, scale and rotation (but NOT translation). To also... |
from_angle | Creates an affine transform from the given rotation `angle`. |
to_cols_array_2d | Creates a `[[f32; 2]; 3]` 2D array storing data in column major order. If you require data in row... |
inverse | Return the inverse of this transform. Note that if the transform is not invertible the result will... |
to_cols_array | Creates a `[f32; 6]` array storing data in column major order. |
from_mat3 | The given `Mat3` must be an affine transform, |
from_translation | Creates an affine transformation from the given 2D `translation`. |
mul-1 | No Documentation 🚧 |
from_scale | Creates an affine transform that changes scale. Note that if any scale is zero the transform will ... |
mul-2 | No Documentation 🚧 |
from_mat3a | The given [`Mat3A`] must be an affine transform, |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
mul | No Documentation 🚧 |
from_scale_angle_translation | Creates an affine transform from the given 2D `scale`, rotation `angle` (in radians) and `translation`... |
clone | No Documentation 🚧 |
is_nan | Returns `true` if any elements are `NaN`. |
from_angle_translation | Creates an affine transform from the given 2D rotation `angle` (in radians) and `translation`. Eq... |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
from_cols | Creates an affine transform from three column vectors. |
transform_point2 | Transforms the given 2D point, applying shear, scale, rotation and translation. |
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine2 | No Documentation 🚧 |
from_mat2
Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation)
Arguments
Name | Type | Documentation |
---|---|---|
matrix2 | Mat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
from_angle
Creates an affine transform from the given rotation
angle
.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine2 | 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
Name | Type | Documentation |
---|---|---|
_self | Affine2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [[f32; 2]; 3] | No Documentation 🚧 |
inverse
Return the inverse of this transform. Note that if the transform is not invertible the result will be invalid.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Affine2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine2 | No Documentation 🚧 |
to_cols_array
Creates a
[f32; 6]
array storing data in column major order.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Affine2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f32; 6] | No Documentation 🚧 |
from_mat3
The given
Mat3
must be an affine transform,
Arguments
Name | Type | Documentation |
---|---|---|
m | Mat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine2 | No Documentation 🚧 |
from_translation
Creates an affine transformation from the given 2D
translation
.
Arguments
Name | Type | Documentation |
---|---|---|
translation | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | 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
Name | Type | Documentation |
---|---|---|
scale | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine2 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
from_mat3a
The given [
Mat3A
] must be an affine transform,
Arguments
Name | Type | Documentation |
---|---|---|
m | Mat3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Affine2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
scale | Vec2 | No Documentation 🚧 |
angle | f32 | No Documentation 🚧 |
translation | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Affine2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine2 | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Affine2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine2 | 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 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
Name | Type | Documentation |
---|---|---|
_self | Affine2 | No Documentation 🚧 |
rhs | Affine2 | No Documentation 🚧 |
max_abs_diff | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
from_cols
Creates an affine transform from three column vectors.
Arguments
Name | Type | Documentation |
---|---|---|
x_axis | Vec2 | No Documentation 🚧 |
y_axis | Vec2 | No Documentation 🚧 |
z_axis | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine2 | No Documentation 🚧 |
transform_point2
Transforms the given 2D point, applying shear, scale, rotation and translation.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
Affine3A
Affine3A
- matrix3:glam::Mat3A
- translation:glam::Vec3A
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
from_quat | Creates an affine transform from the given `rotation` quaternion. |
transform_point3 | Transforms the given 3D points, applying shear, scale, rotation and translation. |
transform_vector3 | Transforms the given 3D vector, applying shear, scale and rotation (but NOT translation). To also... |
from_rotation_z | Creates an affine transform containing a 3D rotation around the z axis of `angle` (in radians). |
to_cols_array | Creates a `[f32; 12]` array storing data in column major order. |
from_rotation_y | Creates an affine transform containing a 3D rotation around the y axis of `angle` (in radians). |
transform_vector3a | Transforms the given [`Vec3A`], applying shear, scale and rotation (but NOT translation). To also apply translation, use [`Self::transform_point3a()`]... |
to_cols_array_2d | Creates a `[[f32; 3]; 4]` 3D array storing data in column major order. If you require data in row... |
from_scale | Creates an affine transform that changes scale. Note that if any scale is zero the transform will ... |
look_to_rh | Creates a right-handed view transform using a camera position, an up direction, and a facing direc... |
look_at_rh | Creates a right-handed view transform using a camera position, an up direction, and a focal point.... |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
from_mat3_translation | Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) and a transla... |
is_nan | Returns `true` if any elements are `NaN`. |
eq | No Documentation 🚧 |
from_scale_rotation_translation | Creates an affine transform from the given 3D `scale`, `rotation` and `translation`. Equivalent t... |
from_mat3 | Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) |
from_cols | Creates an affine transform from three column vectors. |
from_rotation_translation | Creates an affine transform from the given 3D `rotation` and `translation`. Equivalent to `Affine3A::from_translation(translation) * Affine3A::from_quat(rotation)` |
inverse | Return the inverse of this transform. Note that if the transform is not invertible the result will... |
mul-1 | No Documentation 🚧 |
look_to_lh | Creates a left-handed view transform using a camera position, an up direction, and a facing direct... |
look_at_lh | Creates a left-handed view transform using a camera position, an up direction, and a focal point. ... |
clone | No Documentation 🚧 |
transform_point3a | Transforms the given [`Vec3A`], applying shear, scale, rotation and translation. |
from_translation | Creates an affine transformation from the given 3D `translation`. |
mul | No Documentation 🚧 |
from_mat4 | The given `Mat4` must be an affine transform, i.e. contain no perspective transform. |
from_axis_angle | Creates an affine transform containing a 3D rotation around a normalized rotation `axis` of `angle... |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
from_rotation_x | Creates an affine transform containing a 3D rotation around the x axis of `angle` (in radians). |
from_quat
Creates an affine transform from the given
rotation
quaternion.
Arguments
Name | Type | Documentation |
---|---|---|
rotation | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | No Documentation 🚧 |
transform_point3
Transforms the given 3D points, applying shear, scale, rotation and translation.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
from_rotation_z
Creates an affine transform containing a 3D rotation around the z axis of
angle
(in radians).
Arguments
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | No Documentation 🚧 |
to_cols_array
Creates a
[f32; 12]
array storing data in column major order.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Affine3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f32; 12] | No Documentation 🚧 |
from_rotation_y
Creates an affine transform containing a 3D rotation around the y axis of
angle
(in radians).
Arguments
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
Name | Type | Documentation |
---|---|---|
_self | Affine3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [[f32; 3]; 4] | 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
Name | Type | Documentation |
---|---|---|
scale | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
eye | Vec3 | No Documentation 🚧 |
center | Vec3 | No Documentation 🚧 |
up | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | 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 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
Name | Type | Documentation |
---|---|---|
_self | Affine3A | No Documentation 🚧 |
rhs | Affine3A | No Documentation 🚧 |
max_abs_diff | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Affine3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
scale | Vec3 | No Documentation 🚧 |
rotation | Quat | No Documentation 🚧 |
translation | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | No Documentation 🚧 |
from_mat3
Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation)
Arguments
Name | Type | Documentation |
---|---|---|
mat3 | Mat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | No Documentation 🚧 |
from_cols
Creates an affine transform from three column vectors.
Arguments
Name | Type | Documentation |
---|---|---|
x_axis | Vec3A | No Documentation 🚧 |
y_axis | Vec3A | No Documentation 🚧 |
z_axis | Vec3A | No Documentation 🚧 |
w_axis | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Affine3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | 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
Name | Type | Documentation |
---|---|---|
eye | Vec3 | No Documentation 🚧 |
center | Vec3 | No Documentation 🚧 |
up | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Affine3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | No Documentation 🚧 |
transform_point3a
Transforms the given [
Vec3A
], applying shear, scale, rotation and translation.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
from_translation
Creates an affine transformation from the given 3D
translation
.
Arguments
Name | Type | Documentation |
---|---|---|
translation | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | No Documentation 🚧 |
from_mat4
The given
Mat4
must be an affine transform, i.e. contain no perspective transform.
Arguments
Name | Type | Documentation |
---|---|---|
m | Mat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | No Documentation 🚧 |
from_axis_angle
Creates an affine transform containing a 3D rotation around a normalized rotation
axis
ofangle
(in radians).
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Affine3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
from_rotation_x
Creates an affine transform containing a 3D rotation around the x axis of
angle
(in radians).
Arguments
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Affine3A | No Documentation 🚧 |
BVec2
BVec2
- x:bool
- y:bool
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
test | Tests the value at `index`. Panics if `index` is greater than 1. |
eq | No Documentation 🚧 |
splat | Creates a vector mask with all elements set to `v`. |
from_array | Creates a new vector mask from a bool array. |
set | Sets the element at `index`. Panics if `index` is greater than 1. |
clone | No Documentation 🚧 |
any | Returns true if any of the elements are true, false otherwise. |
all | Returns true if all the elements are true, false otherwise. |
new | Creates a new vector mask. |
assert_receiver_is_total_eq | No Documentation 🚧 |
bitmask | Returns a bitmask with the lowest 2 bits set from the elements of `self`. A true element results i... |
test
Tests the value at
index
. Panics ifindex
is greater than 1.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
splat
Creates a vector mask with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | bool | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
from_array
Creates a new vector mask from a bool array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [bool; 2] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
set
Sets the element at
index
. Panics ifindex
is greater than 1.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec2 | No Documentation 🚧 |
index | usize | No Documentation 🚧 |
value | bool | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
any
Returns true if any of the elements are true, false otherwise.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
all
Returns true if all the elements are true, false otherwise.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
new
Creates a new vector mask.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | BVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
BVec3
BVec3
- x:bool
- y:bool
- z:bool
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
assert_receiver_is_total_eq | No Documentation 🚧 |
bitmask | Returns a bitmask with the lowest 3 bits set from the elements of `self`. A true element results i... |
new | Creates a new vector mask. |
eq | No Documentation 🚧 |
test | Tests the value at `index`. Panics if `index` is greater than 2. |
splat | Creates a vector mask with all elements set to `v`. |
all | Returns true if all the elements are true, false otherwise. |
any | Returns true if any of the elements are true, false otherwise. |
clone | No Documentation 🚧 |
set | Sets the element at `index`. Panics if `index` is greater than 2. |
from_array | Creates a new vector mask from a bool array. |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | BVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
new
Creates a new vector mask.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
test
Tests the value at
index
. Panics ifindex
is greater than 2.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
splat
Creates a vector mask with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | bool | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
all
Returns true if all the elements are true, false otherwise.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
any
Returns true if any of the elements are true, false otherwise.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
set
Sets the element at
index
. Panics ifindex
is greater than 2.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec3 | No Documentation 🚧 |
index | usize | No Documentation 🚧 |
value | bool | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
from_array
Creates a new vector mask from a bool array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [bool; 3] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
BVec3A
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
set | Sets the element at `index`. Panics if `index` is greater than 2. |
from_array | Creates a new vector mask from a bool array. |
eq | No Documentation 🚧 |
test | Tests the value at `index`. Panics if `index` is greater than 2. |
any | Returns true if any of the elements are true, false otherwise. |
new | Creates a new vector mask. |
clone | No Documentation 🚧 |
all | Returns true if all the elements are true, false otherwise. |
bitmask | Returns a bitmask with the lowest 3 bits set from the elements of `self`. A true element results i... |
splat | Creates a vector mask with all elements set to `v`. |
set
Sets the element at
index
. Panics ifindex
is greater than 2.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec3A | No Documentation 🚧 |
index | usize | No Documentation 🚧 |
value | bool | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
from_array
Creates a new vector mask from a bool array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [bool; 3] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3A | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
test
Tests the value at
index
. Panics ifindex
is greater than 2.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
any
Returns true if any of the elements are true, false otherwise.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
new
Creates a new vector mask.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3A | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3A | No Documentation 🚧 |
all
Returns true if all the elements are true, false otherwise.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | BVec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
splat
Creates a vector mask with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | bool | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3A | No Documentation 🚧 |
BVec4
BVec4
- x:bool
- y:bool
- z:bool
- w:bool
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clone | No Documentation 🚧 |
any | Returns true if any of the elements are true, false otherwise. |
all | Returns true if all the elements are true, false otherwise. |
eq | No Documentation 🚧 |
from_array | Creates a new vector mask from a bool array. |
bitmask | Returns a bitmask with the lowest 4 bits set from the elements of `self`. A true element results i... |
new | Creates a new vector mask. |
assert_receiver_is_total_eq | No Documentation 🚧 |
set | Sets the element at `index`. Panics if `index` is greater than 3. |
test | Tests the value at `index`. Panics if `index` is greater than 3. |
splat | Creates a vector mask with all elements set to `v`. |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
any
Returns true if any of the elements are true, false otherwise.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
all
Returns true if all the elements are true, false otherwise.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
from_array
Creates a new vector mask from a bool array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [bool; 4] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | 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
Name | Type | Documentation |
---|---|---|
_self | BVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
new
Creates a new vector mask.
Arguments
Name | Type | Documentation |
---|---|---|
x | bool | No Documentation 🚧 |
y | bool | No Documentation 🚧 |
z | bool | No Documentation 🚧 |
w | bool | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
set
Sets the element at
index
. Panics ifindex
is greater than 3.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec4 | No Documentation 🚧 |
index | usize | No Documentation 🚧 |
value | bool | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
test
Tests the value at
index
. Panics ifindex
is greater than 3.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
splat
Creates a vector mask with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | bool | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
BVec4A
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
from_array | Creates a new vector mask from a bool array. |
bitmask | Returns a bitmask with the lowest 4 bits set from the elements of `self`. A true element results i... |
new | Creates a new vector mask. |
test | Tests the value at `index`. Panics if `index` is greater than 3. |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
splat | Creates a vector mask with all elements set to `v`. |
all | Returns true if all the elements are true, false otherwise. |
set | Sets the element at `index`. Panics if `index` is greater than 3. |
any | Returns true if any of the elements are true, false otherwise. |
from_array
Creates a new vector mask from a bool array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [bool; 4] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4A | 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
Name | Type | Documentation |
---|---|---|
_self | BVec4A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
new
Creates a new vector mask.
Arguments
Name | Type | Documentation |
---|---|---|
x | bool | No Documentation 🚧 |
y | bool | No Documentation 🚧 |
z | bool | No Documentation 🚧 |
w | bool | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4A | No Documentation 🚧 |
test
Tests the value at
index
. Panics ifindex
is greater than 3.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec4A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4A | No Documentation 🚧 |
splat
Creates a vector mask with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | bool | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4A | No Documentation 🚧 |
all
Returns true if all the elements are true, false otherwise.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec4A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
set
Sets the element at
index
. Panics ifindex
is greater than 3.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec4A | No Documentation 🚧 |
index | usize | No Documentation 🚧 |
value | bool | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
any
Returns true if any of the elements are true, false otherwise.
Arguments
Name | Type | Documentation |
---|---|---|
_self | BVec4A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
DAffine2
DAffine2
- matrix2:glam::DMat2
- translation:glam::DVec2
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
from_cols | Creates an affine transform from three column vectors. |
to_cols_array | Creates a `[f64; 6]` array storing data in column major order. |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
from_mat3 | The given `DMat3` must be an affine transform, |
from_angle_translation | Creates an affine transform from the given 2D rotation `angle` (in radians) and `translation`. Eq... |
mul | No Documentation 🚧 |
mul-1 | No Documentation 🚧 |
from_scale_angle_translation | Creates an affine transform from the given 2D `scale`, rotation `angle` (in radians) and `translation`... |
eq | No Documentation 🚧 |
from_mat2 | Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) |
from_translation | Creates an affine transformation from the given 2D `translation`. |
transform_vector2 | Transforms the given 2D vector, applying shear, scale and rotation (but NOT translation). To also... |
transform_point2 | Transforms the given 2D point, applying shear, scale, rotation and translation. |
from_mat2_translation | Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) and a transla... |
is_nan | Returns `true` if any elements are `NaN`. |
from_scale | Creates an affine transform that changes scale. Note that if any scale is zero the transform will ... |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
to_cols_array_2d | Creates a `[[f64; 2]; 3]` 2D array storing data in column major order. If you require data in row... |
inverse | Return the inverse of this transform. Note that if the transform is not invertible the result will... |
from_angle | Creates an affine transform from the given rotation `angle`. |
clone | No Documentation 🚧 |
from_cols
Creates an affine transform from three column vectors.
Arguments
Name | Type | Documentation |
---|---|---|
x_axis | DVec2 | No Documentation 🚧 |
y_axis | DVec2 | No Documentation 🚧 |
z_axis | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine2 | No Documentation 🚧 |
to_cols_array
Creates a
[f64; 6]
array storing data in column major order.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DAffine2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f64; 6] | 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 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
Name | Type | Documentation |
---|---|---|
_self | DAffine2 | No Documentation 🚧 |
rhs | DAffine2 | No Documentation 🚧 |
max_abs_diff | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
from_mat3
The given
DMat3
must be an affine transform,
Arguments
Name | Type | Documentation |
---|---|---|
m | DMat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | 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
Name | Type | Documentation |
---|---|---|
scale | DVec2 | No Documentation 🚧 |
angle | f64 | No Documentation 🚧 |
translation | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
from_mat2
Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation)
Arguments
Name | Type | Documentation |
---|---|---|
matrix2 | DMat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine2 | No Documentation 🚧 |
from_translation
Creates an affine transformation from the given 2D
translation
.
Arguments
Name | Type | Documentation |
---|---|---|
translation | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
transform_point2
Transforms the given 2D point, applying shear, scale, rotation and translation.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine2 | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DAffine2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
scale | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DAffine2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | DAffine2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [[f64; 2]; 3] | No Documentation 🚧 |
inverse
Return the inverse of this transform. Note that if the transform is not invertible the result will be invalid.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DAffine2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine2 | No Documentation 🚧 |
from_angle
Creates an affine transform from the given rotation
angle
.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DAffine2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine2 | No Documentation 🚧 |
DAffine3
DAffine3
- matrix3:glam::DMat3
- translation:glam::DVec3
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
look_to_rh | Creates a right-handed view transform using a camera position, an up direction, and a facing direc... |
from_mat3_translation | Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) and a transla... |
transform_point3 | Transforms the given 3D points, applying shear, scale, rotation and translation. |
to_cols_array_2d | Creates a `[[f64; 3]; 4]` 3D array storing data in column major order. If you require data in row... |
look_at_lh | Creates a left-handed view transform using a camera position, an up direction, and a focal point. ... |
from_rotation_z | Creates an affine transform containing a 3D rotation around the z axis of `angle` (in radians). |
from_translation | Creates an affine transformation from the given 3D `translation`. |
clone | No Documentation 🚧 |
from_axis_angle | Creates an affine transform containing a 3D rotation around a normalized rotation `axis` of `angle... |
inverse | Return the inverse of this transform. Note that if the transform is not invertible the result will... |
from_quat | Creates an affine transform from the given `rotation` quaternion. |
from_cols | Creates an affine transform from three column vectors. |
from_rotation_x | Creates an affine transform containing a 3D rotation around the x axis of `angle` (in radians). |
eq | No Documentation 🚧 |
mul | No Documentation 🚧 |
to_cols_array | Creates a `[f64; 12]` array storing data in column major order. |
from_scale_rotation_translation | Creates an affine transform from the given 3D `scale`, `rotation` and `translation`. Equivalent t... |
from_mat4 | The given `DMat4` must be an affine transform, i.e. contain no perspective transform. |
from_mat3 | Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) |
is_nan | Returns `true` if any elements are `NaN`. |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
from_scale | Creates an affine transform that changes scale. Note that if any scale is zero the transform will ... |
mul-1 | No Documentation 🚧 |
look_to_lh | Creates a left-handed view transform using a camera position, an up direction, and a facing direct... |
transform_vector3 | Transforms the given 3D vector, applying shear, scale and rotation (but NOT translation). To also... |
from_rotation_y | Creates an affine transform containing a 3D rotation around the y axis of `angle` (in radians). |
from_rotation_translation | Creates an affine transform from the given 3D `rotation` and `translation`. Equivalent to `DAffine3::from_translation(translation) * DAffine3::from_quat(rotation)` |
look_at_rh | Creates a right-handed view transform using a camera position, an up direction, and a focal point.... |
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
Name | Type | Documentation |
---|---|---|
_self | DAffine3 | No Documentation 🚧 |
rhs | DAffine3 | No Documentation 🚧 |
max_abs_diff | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
eye | DVec3 | No Documentation 🚧 |
dir | DVec3 | No Documentation 🚧 |
up | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine3 | No Documentation 🚧 |
transform_point3
Transforms the given 3D points, applying shear, scale, rotation and translation.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | 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
Name | Type | Documentation |
---|---|---|
_self | DAffine3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [[f64; 3]; 4] | 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
Name | Type | Documentation |
---|---|---|
eye | DVec3 | No Documentation 🚧 |
center | DVec3 | No Documentation 🚧 |
up | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine3 | No Documentation 🚧 |
from_rotation_z
Creates an affine transform containing a 3D rotation around the z axis of
angle
(in radians).
Arguments
Name | Type | Documentation |
---|---|---|
angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine3 | No Documentation 🚧 |
from_translation
Creates an affine transformation from the given 3D
translation
.
Arguments
Name | Type | Documentation |
---|---|---|
translation | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DAffine3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine3 | No Documentation 🚧 |
from_axis_angle
Creates an affine transform containing a 3D rotation around a normalized rotation
axis
ofangle
(in radians).
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DAffine3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine3 | No Documentation 🚧 |
from_quat
Creates an affine transform from the given
rotation
quaternion.
Arguments
Name | Type | Documentation |
---|---|---|
rotation | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine3 | No Documentation 🚧 |
from_cols
Creates an affine transform from three column vectors.
Arguments
Name | Type | Documentation |
---|---|---|
x_axis | DVec3 | No Documentation 🚧 |
y_axis | DVec3 | No Documentation 🚧 |
z_axis | DVec3 | No Documentation 🚧 |
w_axis | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine3 | No Documentation 🚧 |
from_rotation_x
Creates an affine transform containing a 3D rotation around the x axis of
angle
(in radians).
Arguments
Name | Type | Documentation |
---|---|---|
angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine3 | No Documentation 🚧 |
to_cols_array
Creates a
[f64; 12]
array storing data in column major order.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DAffine3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f64; 12] | 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
Name | Type | Documentation |
---|---|---|
scale | DVec3 | No Documentation 🚧 |
rotation | DQuat | No Documentation 🚧 |
translation | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine3 | No Documentation 🚧 |
from_mat4
The given
DMat4
must be an affine transform, i.e. contain no perspective transform.
Arguments
Name | Type | Documentation |
---|---|---|
m | DMat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine3 | No Documentation 🚧 |
from_mat3
Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation)
Arguments
Name | Type | Documentation |
---|---|---|
mat3 | DMat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine3 | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DAffine3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | DAffine3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
scale | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | 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
Name | Type | Documentation |
---|---|---|
eye | DVec3 | No Documentation 🚧 |
dir | DVec3 | No Documentation 🚧 |
up | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
from_rotation_y
Creates an affine transform containing a 3D rotation around the y axis of
angle
(in radians).
Arguments
Name | Type | Documentation |
---|---|---|
angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
eye | DVec3 | No Documentation 🚧 |
center | DVec3 | No Documentation 🚧 |
up | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DAffine3 | No Documentation 🚧 |
DMat2
DMat2
- x_axis:glam::DVec2
- y_axis:glam::DVec2
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
add | No Documentation 🚧 |
sub_mat2 | Subtracts two 2x2 matrices. |
mul-1 | No Documentation 🚧 |
from_cols | Creates a 2x2 matrix from two column vectors. |
eq | No Documentation 🚧 |
div | No Documentation 🚧 |
from_diagonal | Creates a 2x2 matrix with its diagonal set to `diagonal` and all other entries set to 0. |
col | Returns the matrix column for the given `index`. # Panics Panics if `index` is greater than 1. |
to_cols_array_2d | Creates a `[[f64; 2]; 2]` 2D array storing data in column major order. If you require data in row ... |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
mul_scalar | Multiplies a 2x2 matrix by a scalar. |
row | Returns the matrix row for the given `index`. # Panics Panics if `index` is greater than 1. |
as_mat2 | No Documentation 🚧 |
abs | Takes the absolute value of each element in `self` |
neg | No Documentation 🚧 |
mul | No Documentation 🚧 |
mul-2 | No Documentation 🚧 |
determinant | Returns the determinant of `self`. |
from_mat3 | Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. |
from_scale_angle | Creates a 2x2 matrix containing the combining non-uniform `scale` and rotation of `angle` (in radi... |
from_mat3_minor | Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the `i`th column and `j`th... |
to_cols_array | Creates a `[f64; 4]` array storing data in column major order. If you require data in row major order `transpose` the matrix first. |
clone | No Documentation 🚧 |
is_nan | Returns `true` if any elements are `NaN`. |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
mul_vec2 | Transforms a 2D vector. |
mul_mat2 | Multiplies two 2x2 matrices. |
inverse | Returns the inverse of `self`. If the matrix is not invertible the returned matrix will be invalid... |
sub | No Documentation 🚧 |
div_scalar | Divides a 2x2 matrix by a scalar. |
from_angle | Creates a 2x2 matrix containing a rotation of `angle` (in radians). |
transpose | Returns the transpose of `self`. |
add_mat2 | Adds two 2x2 matrices. |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
sub_mat2
Subtracts two 2x2 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
from_cols
Creates a 2x2 matrix from two column vectors.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
from_diagonal
Creates a 2x2 matrix with its diagonal set to
diagonal
and all other entries set to 0.
Arguments
Name | Type | Documentation |
---|---|---|
diagonal | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
col
Returns the matrix column for the given
index
.Panics
Panics if
index
is greater than 1.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | 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
Name | Type | Documentation |
---|---|---|
_self | DMat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [[f64; 2]; 2] | 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
Name | Type | Documentation |
---|---|---|
_self | DMat2 | No Documentation 🚧 |
rhs | DMat2 | No Documentation 🚧 |
max_abs_diff | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
mul_scalar
Multiplies a 2x2 matrix by a scalar.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
row
Returns the matrix row for the given
index
.Panics
Panics if
index
is greater than 1.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
as_mat2
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
abs
Takes the absolute value of each element in
self
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
determinant
Returns the determinant of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
from_mat3
Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column.
Arguments
Name | Type | Documentation |
---|---|---|
m | DMat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
from_scale_angle
Creates a 2x2 matrix containing the combining non-uniform
scale
and rotation ofangle
(in radians).
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DMat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f64; 4] | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | DMat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
mul_vec2
Transforms a 2D vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
mul_mat2
Multiplies two 2x2 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DMat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
div_scalar
Divides a 2x2 matrix by a scalar.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
from_angle
Creates a 2x2 matrix containing a rotation of
angle
(in radians).
Arguments
Name | Type | Documentation |
---|---|---|
angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
transpose
Returns the transpose of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
add_mat2
Adds two 2x2 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
DMat3
DMat3
- x_axis:glam::DVec3
- y_axis:glam::DVec3
- z_axis:glam::DVec3
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
to_cols_array | Creates a `[f64; 9]` array storing data in column major order. If you require data in row major order `transpose` the matrix first. |
div_scalar | Divides a 3x3 matrix by a scalar. |
mul-3 | No Documentation 🚧 |
as_mat3 | No Documentation 🚧 |
transform_point2 | Transforms the given 2D vector as a point. This is the equivalent of multiplying `rhs` as a 3D vec... |
determinant | Returns the determinant of `self`. |
eq | No Documentation 🚧 |
from_angle | Creates an affine transformation matrix from the given 2D rotation `angle` (in radians). The resu... |
from_mat4_minor | Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the `i`th column and `j`th... |
mul_vec3 | Transforms a 3D vector. |
from_mat4 | Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. |
from_rotation_y | Creates a 3D rotation matrix from `angle` (in radians) around the y axis. |
to_euler | Extract Euler angles with the given Euler rotation order. Note if the input matrix contains scales... |
abs | Takes the absolute value of each element in `self` |
add_mat3 | Adds two 3x3 matrices. |
col | Returns the matrix column for the given `index`. # Panics Panics if `index` is greater than 2. |
from_cols | Creates a 3x3 matrix from three column vectors. |
is_nan | Returns `true` if any elements are `NaN`. |
div | No Documentation 🚧 |
transpose | Returns the transpose of `self`. |
from_translation | Creates an affine transformation matrix from the given 2D `translation`. The resulting matrix can ... |
from_rotation_z | Creates a 3D rotation matrix from `angle` (in radians) around the z axis. |
clone | No Documentation 🚧 |
from_euler | Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in radians). |
mul-2 | No Documentation 🚧 |
add | No Documentation 🚧 |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
row | Returns the matrix row for the given `index`. # Panics Panics if `index` is greater than 2. |
inverse | Returns the inverse of `self`. If the matrix is not invertible the returned matrix will be invalid... |
from_mat2 | Creates an affine transformation matrix from the given 2x2 matrix. The resulting matrix can be use... |
from_rotation_x | Creates a 3D rotation matrix from `angle` (in radians) around the x axis. |
from_scale | Creates an affine transformation matrix from the given non-uniform 2D `scale`. The resulting matri... |
mul-1 | 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 ... |
from_diagonal | Creates a 3x3 matrix with its diagonal set to `diagonal` and all other entries set to 0. |
mul_mat3 | Multiplies two 3x3 matrices. |
transform_vector2 | Rotates the given 2D vector. This is the equivalent of multiplying `rhs` as a 3D vector where `z` ... |
from_axis_angle | Creates a 3D rotation matrix from a normalized rotation `axis` and `angle` (in radians). # Panics... |
mul | No Documentation 🚧 |
from_scale_angle_translation | Creates an affine transformation matrix from the given 2D `scale`, rotation `angle` (in radians) a... |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
sub_mat3 | Subtracts two 3x3 matrices. |
mul_scalar | Multiplies a 3x3 matrix by a scalar. |
neg | No Documentation 🚧 |
sub | No Documentation 🚧 |
from_quat | Creates a 3D rotation matrix from the given quaternion. # Panics Will panic if `rotation` is not ... |
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
Name | Type | Documentation |
---|---|---|
_self | DMat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f64; 9] | No Documentation 🚧 |
div_scalar
Divides a 3x3 matrix by a scalar.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
mul-3
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
as_mat3
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
determinant
Returns the determinant of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
mul_vec3
Transforms a 3D vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
from_mat4
Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column.
Arguments
Name | Type | Documentation |
---|---|---|
m | DMat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
from_rotation_y
Creates a 3D rotation matrix from
angle
(in radians) around the y axis.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | 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
Returns
abs
Takes the absolute value of each element in
self
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
add_mat3
Adds two 3x3 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
col
Returns the matrix column for the given
index
.Panics
Panics if
index
is greater than 2.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
from_cols
Creates a 3x3 matrix from three column vectors.
Arguments
Name | Type | Documentation |
---|---|---|
x_axis | DVec3 | No Documentation 🚧 |
y_axis | DVec3 | No Documentation 🚧 |
z_axis | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
transpose
Returns the transpose of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
translation | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
from_rotation_z
Creates a 3D rotation matrix from
angle
(in radians) around the z axis.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
from_euler
Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in radians).
Arguments
Name | Type | Documentation |
---|---|---|
order | EulerRot | No Documentation 🚧 |
a | f64 | No Documentation 🚧 |
b | f64 | No Documentation 🚧 |
c | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DMat3 | No Documentation 🚧 |
rhs | DMat3 | No Documentation 🚧 |
max_abs_diff | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
row
Returns the matrix row for the given
index
.Panics
Panics if
index
is greater than 2.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | 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
Name | Type | Documentation |
---|---|---|
_self | DMat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
m | DMat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
from_rotation_x
Creates a 3D rotation matrix from
angle
(in radians) around the x axis.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
scale | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | 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
Name | Type | Documentation |
---|---|---|
_self | DMat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [[f64; 3]; 3] | No Documentation 🚧 |
from_diagonal
Creates a 3x3 matrix with its diagonal set to
diagonal
and all other entries set to 0.
Arguments
Name | Type | Documentation |
---|---|---|
diagonal | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
mul_mat3
Multiplies two 3x3 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
scale | DVec2 | No Documentation 🚧 |
angle | f64 | No Documentation 🚧 |
translation | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DMat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
sub_mat3
Subtracts two 3x3 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
mul_scalar
Multiplies a 3x3 matrix by a scalar.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
rotation | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
from_quat | Creates an affine transformation matrix from the given `rotation` quaternion. The resulting matrix... |
mul_mat4 | Multiplies two 4x4 matrices. |
as_mat4 | No Documentation 🚧 |
mul-2 | No Documentation 🚧 |
look_to_lh | Creates a left-handed view matrix using a camera position, an up direction, and a facing direction... |
to_euler | Extract Euler angles with the given Euler rotation order. Note if the upper 3x3 matrix contain sca... |
div | No Documentation 🚧 |
from_rotation_translation | Creates an affine transformation matrix from the given 3D `translation`. The resulting matrix can ... |
from_mat3 | Creates an affine transformation matrix from the given 3x3 linear transformation matrix. The resu... |
col | Returns the matrix column for the given `index`. # Panics Panics if `index` is greater than 3. |
transform_vector3 | Transforms the give 3D vector as a direction. This is the equivalent of multiplying the 3D vector ... |
mul | No Documentation 🚧 |
look_at_lh | Creates a left-handed view matrix using a camera position, an up direction, and a focal point. Fo... |
transform_point3 | Transforms the given 3D vector as a point. This is the equivalent of multiplying the 3D vector as ... |
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` or `z_far` are less than or equal to zero when `glam_assert` is enabled. |
transpose | Returns the transpose of `self`. |
from_diagonal | Creates a 4x4 matrix with its diagonal set to `diagonal` and all other entries set to 0. |
mul_scalar | Multiplies a 4x4 matrix by a scalar. |
mul-3 | No Documentation 🚧 |
from_rotation_x | Creates an affine transformation matrix containing a 3D rotation around the x axis of `angle` (in ... |
row | Returns the matrix row for the given `index`. # Panics Panics if `index` is greater than 3. |
perspective_infinite_rh | Creates an infinite right-handed perspective projection matrix with `[0,1]` depth range. Like `perspective_rh`, but with an infinite value for `z_far`. The result is that points near `z_near` are mapped to depth `0`, and as they move towards infinity the depth approaches `1`. # Panics Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is enabled. |
from_rotation_z | Creates an affine transformation matrix containing a 3D rotation around the z axis of `angle` (in ... |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
neg | No Documentation 🚧 |
div_scalar | Divides a 4x4 matrix by a scalar. |
from_scale_rotation_translation | Creates an affine transformation matrix from the given 3D `scale`, `rotation` and `translation`. ... |
add | 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 OpenGL `gluPerspective` function. See https://www\.khronos\.org/registry/OpenGL\-Refpages/gl2\.1/xhtml/gluPerspective\.xml |
from_rotation_y | Creates an affine transformation matrix containing a 3D rotation around the y axis of `angle` (in ... |
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. |
look_to_rh | Creates a right-handed view matrix using a camera position, an up direction, and a facing directio... |
sub | No Documentation 🚧 |
to_cols_array | Creates a `[f64; 16]` array storing data in column major order. If you require data in row major order `transpose` the matrix first. |
from_euler | Creates a affine transformation matrix containing a rotation from the given euler rotation sequenc... |
look_at_rh | Creates a right-handed view matrix using a camera position, an up direction, and a focal point. F... |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
sub_mat4 | Subtracts two 4x4 matrices. |
add_mat4 | Adds two 4x4 matrices. |
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` or `z_far` are less than or equal to zero when `glam_assert` is enabled. |
from_translation | Creates an affine transformation matrix from the given 3D `translation`. The resulting matrix can ... |
clone | No Documentation 🚧 |
perspective_infinite_reverse_lh | Creates an infinite reverse left-handed perspective projection matrix with `[0,1]` depth range. Similar to `perspective_infinite_lh`, but maps `Z = z_near` to a depth of `1` and `Z = infinity` to a depth of `0`. # Panics Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. |
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. |
eq | No Documentation 🚧 |
from_axis_angle | Creates an affine transformation matrix containing a 3D rotation around a normalized rotation `axis`... |
mul-1 | No Documentation 🚧 |
mul_vec4 | Transforms a 4D vector. |
determinant | Returns the determinant of `self`. |
from_scale | Creates an affine transformation matrix containing the given 3D non-uniform `scale`. The resulting... |
to_cols_array_2d | Creates a `[[f64; 4]; 4]` 4D array storing data in column major order. If you require data in row ... |
abs | Takes the absolute value of each element in `self` |
inverse | Returns the inverse of `self`. If the matrix is not invertible the returned matrix will be invalid... |
perspective_infinite_lh | Creates an infinite left-handed perspective projection matrix with `[0,1]` depth range. Like `perspective_lh`, but with an infinite value for `z_far`. The result is that points near `z_near` are mapped to depth `0`, and as they move towards infinity the depth approaches `1`. # Panics Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is enabled. |
orthographic_rh_gl | Creates a right-handed orthographic projection matrix with `[-1,1]` depth range. This is the same as the OpenGL `glOrtho` 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. |
is_nan | Returns `true` if any elements are `NaN`. |
from_cols | Creates a 4x4 matrix from four column vectors. |
perspective_infinite_reverse_rh | Creates an infinite reverse right-handed perspective projection matrix with `[0,1]` depth range. Similar to `perspective_infinite_rh`, but maps `Z = z_near` to a depth of `1` and `Z = infinity` to a depth of `0`. # Panics Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. |
project_point3 | Transforms the given 3D vector as a point, applying perspective correction. This is the equivalent... |
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
Name | Type | Documentation |
---|---|---|
rotation | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
mul_mat4
Multiplies two 4x4 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
as_mat4
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | 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
Name | Type | Documentation |
---|---|---|
eye | DVec3 | No Documentation 🚧 |
dir | DVec3 | No Documentation 🚧 |
up | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | 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
Returns
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
m | DMat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
col
Returns the matrix column for the given
index
.Panics
Panics if
index
is greater than 3.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | 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
Name | Type | Documentation |
---|---|---|
eye | DVec3 | No Documentation 🚧 |
center | DVec3 | No Documentation 🚧 |
up | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | 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
Name | Type | Documentation |
---|---|---|
fov_y_radians | f64 | No Documentation 🚧 |
aspect_ratio | f64 | No Documentation 🚧 |
z_near | f64 | No Documentation 🚧 |
z_far | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
transpose
Returns the transpose of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
from_diagonal
Creates a 4x4 matrix with its diagonal set to
diagonal
and all other entries set to 0.
Arguments
Name | Type | Documentation |
---|---|---|
diagonal | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
mul_scalar
Multiplies a 4x4 matrix by a scalar.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
mul-3
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
row
Returns the matrix row for the given
index
.Panics
Panics if
index
is greater than 3.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | 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
Name | Type | Documentation |
---|---|---|
fov_y_radians | f64 | No Documentation 🚧 |
aspect_ratio | f64 | No Documentation 🚧 |
z_near | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DMat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
div_scalar
Divides a 4x4 matrix by a scalar.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
scale | DVec3 | No Documentation 🚧 |
rotation | DQuat | No Documentation 🚧 |
translation | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
fov_y_radians | f64 | No Documentation 🚧 |
aspect_ratio | f64 | No Documentation 🚧 |
z_near | f64 | No Documentation 🚧 |
z_far | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
eye | DVec3 | No Documentation 🚧 |
dir | DVec3 | No Documentation 🚧 |
up | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DMat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f64; 16] | 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
Name | Type | Documentation |
---|---|---|
order | EulerRot | No Documentation 🚧 |
a | f64 | No Documentation 🚧 |
b | f64 | No Documentation 🚧 |
c | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
eye | DVec3 | No Documentation 🚧 |
center | DVec3 | No Documentation 🚧 |
up | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DMat4 | No Documentation 🚧 |
rhs | DMat4 | No Documentation 🚧 |
max_abs_diff | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
sub_mat4
Subtracts two 4x4 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
add_mat4
Adds two 4x4 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
fov_y_radians | f64 | No Documentation 🚧 |
aspect_ratio | f64 | No Documentation 🚧 |
z_near | f64 | No Documentation 🚧 |
z_far | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
translation | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
fov_y_radians | f64 | No Documentation 🚧 |
aspect_ratio | f64 | No Documentation 🚧 |
z_near | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
mul_vec4
Transforms a 4D vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
determinant
Returns the determinant of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | 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
Name | Type | Documentation |
---|---|---|
scale | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | 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
Name | Type | Documentation |
---|---|---|
_self | DMat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [[f64; 4]; 4] | No Documentation 🚧 |
abs
Takes the absolute value of each element in
self
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DMat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
fov_y_radians | f64 | No Documentation 🚧 |
aspect_ratio | f64 | No Documentation 🚧 |
z_near | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DMat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
from_cols
Creates a 4x4 matrix from four column vectors.
Arguments
Name | Type | Documentation |
---|---|---|
x_axis | DVec4 | No Documentation 🚧 |
y_axis | DVec4 | No Documentation 🚧 |
z_axis | DVec4 | No Documentation 🚧 |
w_axis | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
fov_y_radians | f64 | No Documentation 🚧 |
aspect_ratio | f64 | No Documentation 🚧 |
z_near | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
DQuat
DQuat
- x:f64
- y:f64
- z:f64
- w:f64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
from_mat3 | Creates a quaternion from a 3x3 rotation matrix. Note if the input matrix contain scales, shears, ... |
xyz | Returns the vector part of the quaternion. |
add | Adds two quaternions. The sum is not guaranteed to be normalized. Note that addition is not the s... |
eq | No Documentation 🚧 |
is_near_identity | No Documentation 🚧 |
mul | Multiplies two quaternions. If they each represent a rotation, the result will represent the combi... |
from_vec4 | Creates a new rotation quaternion from a 4D vector. # Preconditions This function does not check ... |
from_mat4 | Creates a quaternion from the upper 3x3 rotation matrix inside a homogeneous 4x4 matrix. Note if t... |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
dot | Computes the dot product of `self` and `rhs`. The dot product is equal to the cosine of the angle ... |
to_euler | Returns the rotation angles for the given euler rotation sequence. |
length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0... |
from_rotation_y | Creates a quaternion from the `angle` (in radians) around the y axis. |
from_rotation_arc_colinear | Gets the minimal rotation for transforming `from` to either `to` or `-to`. This means that the re... |
mul_quat | Multiplies two quaternions. If they each represent a rotation, the result will represent the combi... |
clone | No Documentation 🚧 |
from_rotation_x | Creates a quaternion from the `angle` (in radians) around the x axis. |
is_nan | Returns `true` if any elements are `NAN`. |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
mul-2 | No Documentation 🚧 |
from_affine3 | Creates a quaternion from a 3x3 rotation matrix inside a 3D affine transform. Note if the input af... |
length_squared | Computes the squared length of `self`. This is generally faster than `length()` as it avoids a squ... |
slerp | Performs a spherical linear interpolation between `self` and `end` based on the value `s`. When `s`... |
mul-1 | No Documentation 🚧 |
from_rotation_arc_2d | Gets the minimal rotation for transforming `from` to `to`. The resulting rotation is around the z... |
sub | Subtracts the `rhs` quaternion from `self`. The difference is not guaranteed to be normalized. |
normalize | Returns `self` normalized to length 1.0. For valid results, `self` must _not_ be of length zero. ... |
as_quat | No Documentation 🚧 |
div | Divides a quaternion by a scalar value. The quotient is not guaranteed to be normalized. |
angle_between | Returns the angle (in radians) for the minimal rotation for transforming this quaternion into anot... |
conjugate | Returns the quaternion conjugate of `self`. For a unit quaternion the conjugate is also the invers... |
is_normalized | Returns whether `self` of length `1.0` or not. Uses a precision threshold of `1e-6`. |
length | Computes the length of `self`. |
from_array | Creates a rotation quaternion from an array. # Preconditions This function does not check if the ... |
rotate_towards | Rotates towards `rhs` up to `max_angle` (in radians). When `max_angle` is `0.0`, the result will b... |
from_rotation_arc | Gets the minimal rotation for transforming `from` to `to`. The rotation is in the plane spanned b... |
from_scaled_axis | Create a quaternion that rotates `v.length()` radians around `v.normalize()`. `from_scaled_axis(Vec3::ZERO)`... |
neg | No Documentation 🚧 |
to_scaled_axis | Returns the rotation axis scaled by the rotation in radians. |
to_array | `[x, y, z, w]` |
from_euler | Creates a quaternion from the given Euler rotation sequence and the angles (in radians). |
from_rotation_z | Creates a quaternion from the `angle` (in radians) around the z axis. |
from_axis_angle | Create a quaternion for a normalized rotation `axis` and `angle` (in radians). The axis must be a ... |
mul_vec3 | Multiplies a quaternion and a 3D vector, returning the rotated vector. # Panics Will panic if `self`... |
inverse | Returns the inverse of a normalized quaternion. Typically quaternion inverse returns the conjugate... |
from_xyzw | Creates a new rotation quaternion. This should generally not be called manually unless you know wh... |
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
Name | Type | Documentation |
---|---|---|
mat | DMat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | No Documentation 🚧 |
xyz
Returns the vector part of the quaternion.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
is_near_identity
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
v | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
mat | DMat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | 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 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
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
rhs | DQuat | No Documentation 🚧 |
max_abs_diff | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
to_euler
Returns the rotation angles for the given euler rotation sequence.
Arguments
Returns
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
end | DQuat | No Documentation 🚧 |
s | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | No Documentation 🚧 |
from_rotation_y
Creates a quaternion from the
angle
(in radians) around the y axis.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | No Documentation 🚧 |
from_rotation_x
Creates a quaternion from the
angle
(in radians) around the x axis.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNAN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | 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
Name | Type | Documentation |
---|---|---|
a | DAffine3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | No Documentation 🚧 |
length_squared
Computes the squared length of
self
. This is generally faster thanlength()
as it avoids a square root operation.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | 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
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
end | DQuat | No Documentation 🚧 |
s | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | No Documentation 🚧 |
sub
Subtracts the
rhs
quaternion fromself
. The difference is not guaranteed to be normalized.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | No Documentation 🚧 |
as_quat
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
div
Divides a quaternion by a scalar value. The quotient is not guaranteed to be normalized.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
conjugate
Returns the quaternion conjugate of
self
. For a unit quaternion the conjugate is also the inverse.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | No Documentation 🚧 |
is_normalized
Returns whether
self
of length1.0
or not. Uses a precision threshold of1e-6
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
length
Computes the length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | 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
Name | Type | Documentation |
---|---|---|
a | [f64; 4] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
rhs | DQuat | No Documentation 🚧 |
max_angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
v | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | No Documentation 🚧 |
to_scaled_axis
Returns the rotation axis scaled by the rotation in radians.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f64; 4] | No Documentation 🚧 |
from_euler
Creates a quaternion from the given Euler rotation sequence and the angles (in radians).
Arguments
Name | Type | Documentation |
---|---|---|
euler | EulerRot | No Documentation 🚧 |
a | f64 | No Documentation 🚧 |
b | f64 | No Documentation 🚧 |
c | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | No Documentation 🚧 |
from_rotation_z
Creates a quaternion from the
angle
(in radians) around the z axis.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | 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
Name | Type | Documentation |
---|---|---|
_self | DQuat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
x | f64 | No Documentation 🚧 |
y | f64 | No Documentation 🚧 |
z | f64 | No Documentation 🚧 |
w | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | No Documentation 🚧 |
DVec2
DVec2
- x:f64
- y:f64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
div-2 | No Documentation 🚧 |
length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
new | Creates a new vector. |
is_nan | Returns `true` if any elements are `NaN`. |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
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. |
fract_gl | Returns a vector containing the fractional part of the vector as `self - self.floor()`. Note that ... |
with_y | Creates a 2D vector from `self` with the given value of `y`. |
abs | Returns a vector containing the absolute value of each element of `self`. |
trunc | Returns a vector containing the integer part each element of `self`. This means numbers are always... |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive... |
from_array | Creates a new vector from an array. |
length_squared | Computes the squared length of `self`. This is faster than `length()` as it avoids a square root o... |
project_onto | Returns the vector projection of `self` onto `rhs`. `rhs` must be of non-zero length. # Panics W... |
round | Returns a vector containing the nearest integer to a number for each element of `self`. Round half... |
distance | Computes the Euclidean distance between two points in space. |
reflect | Returns the reflection vector for a given incident vector `self` and surface normal `normal`. `normal`... |
div | No Documentation 🚧 |
project_onto_normalized | Returns the vector projection of `self` onto `rhs`. `rhs` must be normalized. # Panics Will pani... |
normalize_or | Returns `self` normalized to length 1.0 if possible, else returns a fallback value. In particular... |
reject_from | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
reject_from_normalized | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
midpoint | Calculates the midpoint between `self` and `rhs`. The midpoint is the average of, or halfway point... |
rem-2 | No Documentation 🚧 |
angle_between | No Documentation 🚧 |
is_normalized | Returns whether `self` is length `1.0` or not. Uses a precision threshold of approximately `1e-4`. |
extend | Creates a 3D vector from `self` and the given `z` value. |
distance_squared | Compute the squared euclidean distance between two points in space. |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
normalize | Returns `self` normalized to length 1.0. For valid results, `self` must be finite and _not_ of len... |
as_i64vec2 | Casts all elements of `self` to `i64`. |
signum | Returns a vector with elements representing the sign of `self`. - `1.0` if the number is positive,... |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
add-1 | 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(), ...]... |
sub-1 | No Documentation 🚧 |
perp_dot | The perpendicular dot product of `self` and `rhs`. Also known as the wedge product, 2D cross produ... |
add-2 | No Documentation 🚧 |
with_x | Creates a 2D vector from `self` with the given value of `x`. |
as_ivec2 | Casts all elements of `self` to `i32`. |
mul | No Documentation 🚧 |
length | Computes the length of `self`. |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
clone | No Documentation 🚧 |
floor | Returns a vector containing the largest integer less than or equal to a number for each element of... |
eq | No Documentation 🚧 |
rotate | Returns `rhs` rotated by the angle of `self`. If `self` is normalized, then this just rotation. Th... |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
powf | Returns a vector containing each element of `self` raised to the power of `n`. |
rem | No Documentation 🚧 |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
sub-2 | No Documentation 🚧 |
recip | Returns a vector containing the reciprocal `1.0/n` of each element of `self`. |
normalize_or_zero | Returns `self` normalized to length 1.0 if possible, else returns zero. In particular, if the inpu... |
div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. |
clamp_length | Returns a vector with a length no less than `min` and no more than `max`. # Panics Will panic if `min`... |
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. Using `mul_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. |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
copysign | Returns a vector with signs of `rhs` and the magnitudes of `self`. |
exp | Returns a vector containing `e^self` (the exponential function) for each element of `self`. |
as_u64vec2 | Casts all elements of `self` to `u64`. |
perp | Returns a vector that is equal to `self` rotated by 90 degrees. |
refract | Returns the refraction direction for a given incident vector `self`, surface normal `normal` and r... |
splat | Creates a vector with all elements set to `v`. |
to_array | `[x, y]` |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
ceil | Returns a vector containing the smallest integer greater than or equal to a number for each elemen... |
add | No Documentation 🚧 |
as_vec2 | Casts all elements of `self` to `f32`. |
is_negative_bitmask | Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. A negat... |
rem-1 | No Documentation 🚧 |
sub | No Documentation 🚧 |
clamp_length_max | Returns a vector with a length no more than `max`. # Panics Will panic if `max` is negative when `glam_assert` is enabled. |
angle_to | Returns the angle of rotation (in radians) from `self` to `rhs` in the range `[-π, +π]`. The inputs do not need to be unit vectors however they must be non-zero. |
fract | Returns a vector containing the fractional part of the vector as `self - self.trunc()`. Note that ... |
neg | No Documentation 🚧 |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
rotate_towards | Rotates towards `rhs` up to `max_angle` (in radians). When `max_angle` is `0.0`, the result will b... |
dot | Computes the dot product of `self` and `rhs`. |
mul-2 | No Documentation 🚧 |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
div-1 | No Documentation 🚧 |
move_towards | Moves towards `rhs` based on the value `d`. When `d` is `0.0`, the result will be equal to `self`.... |
lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0`... |
as_uvec2 | Casts all elements of `self` to `u32`. |
from_angle | Creates a 2D vector containing `[angle.cos(), angle.sin()]`. This can be used in conjunction with the [`rotate()`]... |
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(), ...]... |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
mul-1 | No Documentation 🚧 |
clamp_length_min | Returns a vector with a length no less than `min`. # Panics Will panic if `min` is negative when `glam_assert` is enabled. |
rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. [Euclidean division... |
clamp | Component-wise clamping of values, similar to [`f64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
mask | BVec2 | No Documentation 🚧 |
if_true | DVec2 | No Documentation 🚧 |
if_false | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
with_y
Creates a 2D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
trunc
Returns a vector containing the integer part each element of
self
. This means numbers are always truncated towards zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [f64; 2] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
. This is faster thanlength()
as it avoids a square root operation.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
distance
Computes the Euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
angle_between
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
is_normalized
Returns whether
self
is length1.0
or not. Uses a precision threshold of approximately1e-4
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
extend
Creates a 3D vector from
self
and the givenz
value.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
as_i64vec2
Casts all elements of
self
toi64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
with_x
Creates a 2D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
as_ivec2
Casts all elements of
self
toi32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
length
Computes the length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
powf
Returns a vector containing each element of
self
raised to the power ofn
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
recip
Returns a vector containing the reciprocal
1.0/n
of each element ofself
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
min | f64 | No Documentation 🚧 |
max | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
a | DVec2 | No Documentation 🚧 |
b | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
copysign
Returns a vector with signs of
rhs
and the magnitudes ofself
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
exp
Returns a vector containing
e^self
(the exponential function) for each element ofself
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
as_u64vec2
Casts all elements of
self
tou64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
perp
Returns a vector that is equal to
self
rotated by 90 degrees.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
normal | DVec2 | No Documentation 🚧 |
eta | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
to_array
[x, y]
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f64; 2] | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
as_vec2
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
rhs | DVec2 | No Documentation 🚧 |
max_angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
rhs | DVec2 | No Documentation 🚧 |
d | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
rhs | DVec2 | No Documentation 🚧 |
s | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
as_uvec2
Casts all elements of
self
tou32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | 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
Name | Type | Documentation |
---|---|---|
angle | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
. [Euclidean division]: f64::rem_euclid
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
min | DVec2 | No Documentation 🚧 |
max | DVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec2 | No Documentation 🚧 |
rhs | DVec2 | No Documentation 🚧 |
max_abs_diff | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
DVec3
DVec3
- x:f64
- y:f64
- z:f64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clamp_length_min | Returns a vector with a length no less than `min`. # Panics Will panic if `min` is negative when `glam_assert` is enabled. |
with_x | Creates a 3D vector from `self` with the given value of `x`. |
to_array | `[x, y, z]` |
rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. [Euclidean division... |
any_orthonormal_vector | Returns any unit vector that is orthogonal to the given one. The input vector must be unit length.... |
mul-2 | No Documentation 🚧 |
as_vec3a | Casts all elements of `self` to `f32`. |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
fract | Returns a vector containing the fractional part of the vector as `self - self.trunc()`. Note that ... |
clamp | Component-wise clamping of values, similar to [`f64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
floor | Returns a vector containing the largest integer less than or equal to a number for each element of... |
as_uvec3 | Casts all elements of `self` to `u32`. |
splat | Creates a vector with all elements set to `v`. |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
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(), ...]... |
reject_from_normalized | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
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(), ...]... |
any_orthogonal_vector | Returns some vector that is orthogonal to the given one. The input vector must be finite and non-z... |
truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
with_y | Creates a 3D vector from `self` with the given value of `y`. |
clone | No Documentation 🚧 |
normalize | Returns `self` normalized to length 1.0. For valid results, `self` must be finite and _not_ of len... |
mul-1 | No Documentation 🚧 |
project_onto | Returns the vector projection of `self` onto `rhs`. `rhs` must be of non-zero length. # Panics W... |
distance | Computes the Euclidean distance between two points in space. |
fract_gl | Returns a vector containing the fractional part of the vector as `self - self.floor()`. Note that ... |
add | No Documentation 🚧 |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
div-1 | No Documentation 🚧 |
mul | No Documentation 🚧 |
sub-2 | No Documentation 🚧 |
rem-2 | No Documentation 🚧 |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive... |
new | Creates a new vector. |
refract | Returns the refraction direction for a given incident vector `self`, surface normal `normal` and r... |
recip | Returns a vector containing the reciprocal `1.0/n` of each element of `self`. |
abs | Returns a vector containing the absolute value of each element of `self`. |
distance_squared | Compute the squared euclidean distance between two points in space. |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
normalize_or | Returns `self` normalized to length 1.0 if possible, else returns a fallback value. In particular... |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
length | Computes the length of `self`. |
ceil | Returns a vector containing the smallest integer greater than or equal to a number for each elemen... |
from_array | Creates a new vector from an array. |
trunc | Returns a vector containing the integer part each element of `self`. This means numbers are always... |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
as_i64vec3 | Casts all elements of `self` to `i64`. |
clamp_length | Returns a vector with a length no less than `min` and no more than `max`. # Panics Will panic if `min`... |
midpoint | Calculates the midpoint between `self` and `rhs`. The midpoint is the average of, or halfway point... |
neg | No Documentation 🚧 |
as_ivec3 | Casts all elements of `self` to `i32`. |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
is_normalized | Returns whether `self` is length `1.0` or not. Uses a precision threshold of approximately `1e-4`. |
is_negative_bitmask | Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. A negat... |
div-2 | No Documentation 🚧 |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
as_u64vec3 | Casts all elements of `self` to `u64`. |
length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
exp | Returns a vector containing `e^self` (the exponential function) for each element of `self`. |
length_squared | Computes the squared length of `self`. This is faster than `length()` as it avoids a square root o... |
add-2 | No Documentation 🚧 |
cross | Computes the cross product of `self` and `rhs`. |
is_nan | Returns `true` if any elements are `NaN`. |
move_towards | Moves towards `rhs` based on the value `d`. When `d` is `0.0`, the result will be equal to `self`.... |
rem-1 | No Documentation 🚧 |
reject_from | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
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. Using `mul_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. |
dot | Computes the dot product of `self` and `rhs`. |
signum | Returns a vector with elements representing the sign of `self`. - `1.0` if the number is positive,... |
reflect | Returns the reflection vector for a given incident vector `self` and surface normal `normal`. `normal`... |
clamp_length_max | Returns a vector with a length no more than `max`. # Panics Will panic if `max` is negative when `glam_assert` is enabled. |
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. |
div | No Documentation 🚧 |
round | Returns a vector containing the nearest integer to a number for each element of `self`. Round half... |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
powf | Returns a vector containing each element of `self` raised to the power of `n`. |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
as_vec3 | Casts all elements of `self` to `f32`. |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. |
normalize_or_zero | Returns `self` normalized to length 1.0 if possible, else returns zero. In particular, if the inpu... |
extend | Creates a 4D vector from `self` and the given `w` value. |
copysign | Returns a vector with signs of `rhs` and the magnitudes of `self`. |
with_z | Creates a 3D vector from `self` with the given value of `z`. |
project_onto_normalized | Returns the vector projection of `self` onto `rhs`. `rhs` must be normalized. # Panics Will pani... |
sub-1 | No Documentation 🚧 |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0`... |
eq | No Documentation 🚧 |
sub | No Documentation 🚧 |
add-1 | No Documentation 🚧 |
rem | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
with_x
Creates a 3D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f64; 3] | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
. [Euclidean division]: f64::rem_euclid
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
as_vec3a
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
mask | BVec3 | No Documentation 🚧 |
if_true | DVec3 | No Documentation 🚧 |
if_false | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
min | DVec3 | No Documentation 🚧 |
max | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
as_uvec3
Casts all elements of
self
tou32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
with_y
Creates a 3D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
distance
Computes the Euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
normal | DVec3 | No Documentation 🚧 |
eta | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
recip
Returns a vector containing the reciprocal
1.0/n
of each element ofself
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
length
Computes the length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [f64; 3] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
trunc
Returns a vector containing the integer part each element of
self
. This means numbers are always truncated towards zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
as_i64vec3
Casts all elements of
self
toi64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
min | f64 | No Documentation 🚧 |
max | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
as_ivec3
Casts all elements of
self
toi32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
rhs | DVec3 | No Documentation 🚧 |
max_abs_diff | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
is_normalized
Returns whether
self
is length1.0
or not. Uses a precision threshold of approximately1e-4
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
as_u64vec3
Casts all elements of
self
tou64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
exp
Returns a vector containing
e^self
(the exponential function) for each element ofself
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
. This is faster thanlength()
as it avoids a square root operation.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
cross
Computes the cross product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
rhs | DVec3 | No Documentation 🚧 |
d | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
a | DVec3 | No Documentation 🚧 |
b | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
powf
Returns a vector containing each element of
self
raised to the power ofn
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
as_vec3
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
extend
Creates a 4D vector from
self
and the givenw
value.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
copysign
Returns a vector with signs of
rhs
and the magnitudes ofself
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
with_z
Creates a 3D vector from
self
with the given value ofz
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec3 | No Documentation 🚧 |
rhs | DVec3 | No Documentation 🚧 |
s | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
DVec4
DVec4
- x:f64
- y:f64
- z:f64
- w:f64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. [Euclidean division... |
div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. |
dot | Computes the dot product of `self` and `rhs`. |
distance_squared | Compute the squared euclidean distance between two points in space. |
sub-1 | No Documentation 🚧 |
with_x | Creates a 4D vector from `self` with the given value of `x`. |
is_negative_bitmask | Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. A negat... |
length | Computes the length of `self`. |
reject_from | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
truncate | Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. Truncation to [`DVec3`]... |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
mul-1 | No Documentation 🚧 |
project_onto_normalized | Returns the vector projection of `self` onto `rhs`. `rhs` must be normalized. # Panics Will pani... |
move_towards | Moves towards `rhs` based on the value `d`. When `d` is `0.0`, the result will be equal to `self`.... |
as_vec4 | Casts all elements of `self` to `f32`. |
length_squared | Computes the squared length of `self`. This is faster than `length()` as it avoids a square root o... |
clamp | Component-wise clamping of values, similar to [`f64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
add-1 | No Documentation 🚧 |
fract | Returns a vector containing the fractional part of the vector as `self - self.trunc()`. Note that ... |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
eq | No Documentation 🚧 |
neg | No Documentation 🚧 |
new | Creates a new vector. |
project_onto | Returns the vector projection of `self` onto `rhs`. `rhs` must be of non-zero length. # Panics W... |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
add-2 | No Documentation 🚧 |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
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(), ...]... |
with_w | Creates a 4D vector from `self` with the given value of `w`. |
splat | Creates a vector with all elements set to `v`. |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
rem-1 | No Documentation 🚧 |
round | Returns a vector containing the nearest integer to a number for each element of `self`. Round half... |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
trunc | Returns a vector containing the integer part each element of `self`. This means numbers are always... |
sub-2 | No Documentation 🚧 |
is_normalized | Returns whether `self` is length `1.0` or not. Uses a precision threshold of approximately `1e-4`. |
as_uvec4 | Casts all elements of `self` to `u32`. |
mul-2 | No Documentation 🚧 |
mul | No Documentation 🚧 |
clamp_length_min | Returns a vector with a length no less than `min`. # Panics Will panic if `min` is negative when `glam_assert` is enabled. |
exp | Returns a vector containing `e^self` (the exponential function) for each element of `self`. |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
add | No Documentation 🚧 |
recip | Returns a vector containing the reciprocal `1.0/n` of each element of `self`. |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
div-1 | No Documentation 🚧 |
abs | Returns a vector containing the absolute value of each element of `self`. |
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. Using `mul_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. |
lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0`... |
reject_from_normalized | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
with_z | Creates a 4D vector from `self` with the given value of `z`. |
fract_gl | Returns a vector containing the fractional part of the vector as `self - self.floor()`. Note that ... |
clamp_length_max | Returns a vector with a length no more than `max`. # Panics Will panic if `max` is negative when `glam_assert` is enabled. |
with_y | Creates a 4D vector from `self` with the given value of `y`. |
div-2 | No Documentation 🚧 |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
from_array | Creates a new vector from an array. |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
clone | No Documentation 🚧 |
normalize | Returns `self` normalized to length 1.0. For valid results, `self` must be finite and _not_ of len... |
as_i64vec4 | Casts all elements of `self` to `i64`. |
distance | Computes the Euclidean distance between two points in space. |
as_u64vec4 | Casts all elements of `self` to `u64`. |
normalize_or_zero | Returns `self` normalized to length 1.0 if possible, else returns zero. In particular, if the inpu... |
rem-2 | No Documentation 🚧 |
clamp_length | Returns a vector with a length no less than `min` and no more than `max`. # Panics Will panic if `min`... |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive... |
refract | Returns the refraction direction for a given incident vector `self`, surface normal `normal` and r... |
rem | 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(), ...]... |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
signum | Returns a vector with elements representing the sign of `self`. - `1.0` if the number is positive,... |
normalize_or | Returns `self` normalized to length 1.0 if possible, else returns a fallback value. In particular... |
floor | Returns a vector containing the largest integer less than or equal to a number for each element of... |
midpoint | Calculates the midpoint between `self` and `rhs`. The midpoint is the average of, or halfway point... |
to_array | `[x, y, z, w]` |
ceil | Returns a vector containing the smallest integer greater than or equal to a number for each elemen... |
copysign | Returns a vector with signs of `rhs` and the magnitudes of `self`. |
reflect | Returns the reflection vector for a given incident vector `self` and surface normal `normal`. `normal`... |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
as_ivec4 | Casts all elements of `self` to `i32`. |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
powf | Returns a vector containing each element of `self` raised to the power of `n`. |
sub | No Documentation 🚧 |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
is_nan | Returns `true` if any elements are `NaN`. |
length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
div | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
. [Euclidean division]: f64::rem_euclid
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
with_x
Creates a 4D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
length
Computes the length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
rhs | DVec4 | No Documentation 🚧 |
d | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
as_vec4
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
. This is faster thanlength()
as it avoids a square root operation.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
min | DVec4 | No Documentation 🚧 |
max | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Name | Type | Documentation |
---|---|---|
x | f64 | No Documentation 🚧 |
y | f64 | No Documentation 🚧 |
z | f64 | No Documentation 🚧 |
w | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
with_w
Creates a 4D vector from
self
with the given value ofw
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
trunc
Returns a vector containing the integer part each element of
self
. This means numbers are always truncated towards zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
is_normalized
Returns whether
self
is length1.0
or not. Uses a precision threshold of approximately1e-4
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
as_uvec4
Casts all elements of
self
tou32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
exp
Returns a vector containing
e^self
(the exponential function) for each element ofself
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
recip
Returns a vector containing the reciprocal
1.0/n
of each element ofself
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
rhs | DVec4 | No Documentation 🚧 |
max_abs_diff | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
a | DVec4 | No Documentation 🚧 |
b | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
rhs | DVec4 | No Documentation 🚧 |
s | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
with_z
Creates a 4D vector from
self
with the given value ofz
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
with_y
Creates a 4D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [f64; 4] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
mask | BVec4 | No Documentation 🚧 |
if_true | DVec4 | No Documentation 🚧 |
if_false | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
as_i64vec4
Casts all elements of
self
toi64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
distance
Computes the Euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
as_u64vec4
Casts all elements of
self
tou64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
min | f64 | No Documentation 🚧 |
max | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
normal | DVec4 | No Documentation 🚧 |
eta | f64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | 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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f64; 4] | No Documentation 🚧 |
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
copysign
Returns a vector with signs of
rhs
and the magnitudes ofself
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
as_ivec4
Casts all elements of
self
toi32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
powf
Returns a vector containing each element of
self
raised to the power ofn
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | DVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f64 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
assert_receiver_is_total_eq | No Documentation 🚧 |
eq | No Documentation 🚧 |
clone | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | EulerRot | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | EulerRot | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | EulerRot | No Documentation 🚧 |
I64Vec2
I64Vec2
- x:i64
- y:i64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
div-1 | No Documentation 🚧 |
saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
as_u64vec2 | Casts all elements of `self` to `u64`. |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
mul | No Documentation 🚧 |
clone | No Documentation 🚧 |
wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
rem-1 | No Documentation 🚧 |
wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
as_uvec2 | Casts all elements of `self` to `u32`. |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
from_array | Creates a new vector from an array. |
saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
with_x | Creates a 2D vector from `self` with the given value of `x`. |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
perp_dot | The perpendicular dot product of `self` and `rhs`. Also known as the wedge product, 2D cross produ... |
mul-2 | No Documentation 🚧 |
div-2 | No Documentation 🚧 |
sub-1 | No Documentation 🚧 |
saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
dot | Computes the dot product of `self` and `rhs`. |
rotate | Returns `rhs` rotated by the angle of `self`. If `self` is normalized, then this just rotation. Th... |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
sub | No Documentation 🚧 |
wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
distance_squared | Compute the squared euclidean distance between two points in space. |
perp | Returns a vector that is equal to `self` rotated by 90 degrees. |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
extend | Creates a 3D vector from `self` and the given `z` value. |
rem-2 | No Documentation 🚧 |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
as_ivec2 | Casts all elements of `self` to `i32`. |
abs | Returns a vector containing the absolute value of each element of `self`. |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
splat | Creates a vector with all elements set to `v`. |
is_negative_bitmask | Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. A negat... |
saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
new | Creates a new vector. |
clamp | Component-wise clamping of values, similar to [`i64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
with_y | Creates a 2D vector from `self` with the given value of `y`. |
sub-2 | No Documentation 🚧 |
length_squared | Computes the squared length of `self`. |
neg | No Documentation 🚧 |
div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
eq | No Documentation 🚧 |
add | No Documentation 🚧 |
as_vec2 | Casts all elements of `self` to `f32`. |
add-1 | No Documentation 🚧 |
rem | No Documentation 🚧 |
assert_receiver_is_total_eq | No Documentation 🚧 |
add-2 | No Documentation 🚧 |
to_array | `[x, y]` |
div | No Documentation 🚧 |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
as_dvec2 | Casts all elements of `self` to `f64`. |
mul-1 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
as_u64vec2
Casts all elements of
self
tou64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
as_uvec2
Casts all elements of
self
tou32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [i64; 2] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
with_x
Creates a 2D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
mask | BVec2 | No Documentation 🚧 |
if_true | I64Vec2 | No Documentation 🚧 |
if_false | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
perp_dot
The perpendicular dot product of
self
andrhs
. Also known as the wedge product, 2D cross product, and determinant.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | No Documentation 🚧 |
perp
Returns a vector that is equal to
self
rotated by 90 degrees.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | No Documentation 🚧 |
extend
Creates a 3D vector from
self
and the givenz
value.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | No Documentation 🚧 |
as_ivec2
Casts all elements of
self
toi32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | i64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | 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
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
min | I64Vec2 | No Documentation 🚧 |
max | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
with_y
Creates a 2D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
as_vec2
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
to_array
[x, y]
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [i64; 2] | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
as_dvec2
Casts all elements of
self
tof64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
I64Vec3
I64Vec3
- x:i64
- y:i64
- z:i64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
as_ivec3 | Casts all elements of `self` to `i32`. |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
rem-2 | No Documentation 🚧 |
as_u64vec3 | Casts all elements of `self` to `u64`. |
wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
div-1 | No Documentation 🚧 |
mul | No Documentation 🚧 |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
with_z | Creates a 3D vector from `self` with the given value of `z`. |
mul-2 | No Documentation 🚧 |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
mul-1 | No Documentation 🚧 |
to_array | `[x, y, z]` |
from_array | Creates a new vector from an array. |
wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
new | Creates a new vector. |
sub-1 | No Documentation 🚧 |
eq | No Documentation 🚧 |
saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
clamp | Component-wise clamping of values, similar to [`i64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
cross | Computes the cross product of `self` and `rhs`. |
as_uvec3 | Casts all elements of `self` to `u32`. |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
with_y | Creates a 3D vector from `self` with the given value of `y`. |
assert_receiver_is_total_eq | No Documentation 🚧 |
rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
as_dvec3 | Casts all elements of `self` to `f64`. |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
rem | No Documentation 🚧 |
length_squared | Computes the squared length of `self`. |
rem-1 | No Documentation 🚧 |
extend | Creates a 4D vector from `self` and the given `w` value. |
splat | Creates a vector with all elements set to `v`. |
abs | Returns a vector containing the absolute value of each element of `self`. |
dot | Computes the dot product of `self` and `rhs`. |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
with_x | Creates a 3D vector from `self` with the given value of `x`. |
saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
distance_squared | Compute the squared euclidean distance between two points in space. |
sub | No Documentation 🚧 |
add | No Documentation 🚧 |
add-1 | No Documentation 🚧 |
neg | No Documentation 🚧 |
div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
div-2 | No Documentation 🚧 |
as_vec3a | Casts all elements of `self` to `f32`. |
is_negative_bitmask | Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. A negat... |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
as_vec3 | Casts all elements of `self` to `f32`. |
add-2 | No Documentation 🚧 |
div | No Documentation 🚧 |
wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
clone | No Documentation 🚧 |
sub-2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
as_ivec3
Casts all elements of
self
toi32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
as_u64vec3
Casts all elements of
self
tou64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | No Documentation 🚧 |
with_z
Creates a 3D vector from
self
with the given value ofz
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [i64; 3] | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [i64; 3] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | 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
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
min | I64Vec3 | No Documentation 🚧 |
max | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
cross
Computes the cross product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
as_uvec3
Casts all elements of
self
tou32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
with_y
Creates a 3D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
as_dvec3
Casts all elements of
self
tof64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | 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
Name | Type | Documentation |
---|---|---|
mask | BVec3 | No Documentation 🚧 |
if_true | I64Vec3 | No Documentation 🚧 |
if_false | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
extend
Creates a 4D vector from
self
and the givenw
value.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | i64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | 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
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | No Documentation 🚧 |
with_x
Creates a 3D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
as_vec3a
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
as_vec3
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
I64Vec4
I64Vec4
- x:i64
- y:i64
- z:i64
- w:i64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clamp | Component-wise clamping of values, similar to [`i64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
as_u64vec4 | Casts all elements of `self` to `u64`. |
wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
add-1 | No Documentation 🚧 |
mul-1 | No Documentation 🚧 |
add | No Documentation 🚧 |
distance_squared | Compute the squared euclidean distance between two points in space. |
clone | No Documentation 🚧 |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
div-1 | No Documentation 🚧 |
div | No Documentation 🚧 |
splat | Creates a vector with all elements set to `v`. |
rem-1 | No Documentation 🚧 |
as_ivec4 | Casts all elements of `self` to `i32`. |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
new | Creates a new vector. |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
as_dvec4 | Casts all elements of `self` to `f64`. |
as_vec4 | Casts all elements of `self` to `f32`. |
with_x | Creates a 4D vector from `self` with the given value of `x`. |
truncate | Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. Truncation to [`I64Vec3`]... |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
abs | Returns a vector containing the absolute value of each element of `self`. |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
dot | Computes the dot product of `self` and `rhs`. |
mul-2 | No Documentation 🚧 |
to_array | `[x, y, z, w]` |
rem | No Documentation 🚧 |
rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
rem-2 | No Documentation 🚧 |
length_squared | Computes the squared length of `self`. |
is_negative_bitmask | Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. A negat... |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
div-2 | No Documentation 🚧 |
neg | No Documentation 🚧 |
saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
eq | No Documentation 🚧 |
signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
sub | No Documentation 🚧 |
from_array | Creates a new vector from an array. |
with_w | Creates a 4D vector from `self` with the given value of `w`. |
with_y | Creates a 4D vector from `self` with the given value of `y`. |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
with_z | Creates a 4D vector from `self` with the given value of `z`. |
assert_receiver_is_total_eq | No Documentation 🚧 |
as_uvec4 | Casts all elements of `self` to `u32`. |
wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
add-2 | No Documentation 🚧 |
sub-2 | No Documentation 🚧 |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
mul | No Documentation 🚧 |
saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
sub-1 | No Documentation 🚧 |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
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
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
min | I64Vec4 | No Documentation 🚧 |
max | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
as_u64vec4
Casts all elements of
self
tou64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | i64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
as_ivec4
Casts all elements of
self
toi32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Name | Type | Documentation |
---|---|---|
x | i64 | No Documentation 🚧 |
y | i64 | No Documentation 🚧 |
z | i64 | No Documentation 🚧 |
w | i64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
as_dvec4
Casts all elements of
self
tof64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
as_vec4
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
with_x
Creates a 4D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | 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
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [i64; 4] | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | 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
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | 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
Name | Type | Documentation |
---|---|---|
mask | BVec4 | No Documentation 🚧 |
if_true | I64Vec4 | No Documentation 🚧 |
if_false | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [i64; 4] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
with_w
Creates a 4D vector from
self
with the given value ofw
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
with_y
Creates a 4D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
with_z
Creates a 4D vector from
self
with the given value ofz
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
as_uvec4
Casts all elements of
self
tou32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | I64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i64 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
IVec2
IVec2
- x:i32
- y:i32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
clone | No Documentation 🚧 |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
clamp | Component-wise clamping of values, similar to [`i32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
div | No Documentation 🚧 |
sub-2 | No Documentation 🚧 |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
sub-1 | No Documentation 🚧 |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
perp_dot | The perpendicular dot product of `self` and `rhs`. Also known as the wedge product, 2D cross produ... |
rem-2 | No Documentation 🚧 |
from_array | Creates a new vector from an array. |
distance_squared | Compute the squared euclidean distance between two points in space. |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
add | No Documentation 🚧 |
assert_receiver_is_total_eq | No Documentation 🚧 |
neg | No Documentation 🚧 |
length_squared | Computes the squared length of `self`. |
wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
as_vec2 | Casts all elements of `self` to `f32`. |
saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
div-2 | No Documentation 🚧 |
as_dvec2 | Casts all elements of `self` to `f64`. |
add-2 | No Documentation 🚧 |
as_uvec2 | Casts all elements of `self` to `u32`. |
with_y | Creates a 2D vector from `self` with the given value of `y`. |
wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
eq | No Documentation 🚧 |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
add-1 | No Documentation 🚧 |
abs | Returns a vector containing the absolute value of each element of `self`. |
extend | Creates a 3D vector from `self` and the given `z` value. |
sub | No Documentation 🚧 |
div-1 | No Documentation 🚧 |
splat | Creates a vector with all elements set to `v`. |
saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
mul | No Documentation 🚧 |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
new | Creates a new vector. |
perp | Returns a vector that is equal to `self` rotated by 90 degrees. |
saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
as_i64vec2 | Casts all elements of `self` to `i64`. |
to_array | `[x, y]` |
mul-2 | No Documentation 🚧 |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
rem-1 | No Documentation 🚧 |
with_x | Creates a 2D vector from `self` with the given value of `x`. |
is_negative_bitmask | Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. A negat... |
saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
rem | No Documentation 🚧 |
wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
as_u64vec2 | Casts all elements of `self` to `u64`. |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
dot | Computes the dot product of `self` and `rhs`. |
rotate | Returns `rhs` rotated by the angle of `self`. If `self` is normalized, then this just rotation. Th... |
mul-1 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
mask | BVec2 | No Documentation 🚧 |
if_true | IVec2 | No Documentation 🚧 |
if_false | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | 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
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
min | IVec2 | No Documentation 🚧 |
max | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
perp_dot
The perpendicular dot product of
self
andrhs
. Also known as the wedge product, 2D cross product, and determinant.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [i32; 2] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
as_vec2
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
as_dvec2
Casts all elements of
self
tof64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
as_uvec2
Casts all elements of
self
tou32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
with_y
Creates a 2D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
extend
Creates a 3D vector from
self
and the givenz
value.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | i32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
perp
Returns a vector that is equal to
self
rotated by 90 degrees.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
as_i64vec2
Casts all elements of
self
toi64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
to_array
[x, y]
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [i32; 2] | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
with_x
Creates a 2D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
as_u64vec2
Casts all elements of
self
tou64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
IVec3
IVec3
- x:i32
- y:i32
- z:i32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
sub-1 | No Documentation 🚧 |
wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
mul-2 | No Documentation 🚧 |
wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
as_uvec3 | Casts all elements of `self` to `u32`. |
rem-1 | No Documentation 🚧 |
sub | No Documentation 🚧 |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
div-1 | No Documentation 🚧 |
signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
add | No Documentation 🚧 |
eq | No Documentation 🚧 |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
splat | Creates a vector with all elements set to `v`. |
as_vec3 | Casts all elements of `self` to `f32`. |
clone | No Documentation 🚧 |
as_i64vec3 | Casts all elements of `self` to `i64`. |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
clamp | Component-wise clamping of values, similar to [`i32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
mul | No Documentation 🚧 |
saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
new | Creates a new vector. |
as_vec3a | Casts all elements of `self` to `f32`. |
rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
add-1 | No Documentation 🚧 |
saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
div | No Documentation 🚧 |
to_array | `[x, y, z]` |
length_squared | Computes the squared length of `self`. |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
as_u64vec3 | Casts all elements of `self` to `u64`. |
as_dvec3 | Casts all elements of `self` to `f64`. |
div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
with_z | Creates a 3D vector from `self` with the given value of `z`. |
cross | Computes the cross product of `self` and `rhs`. |
rem | No Documentation 🚧 |
with_x | Creates a 3D vector from `self` with the given value of `x`. |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
assert_receiver_is_total_eq | No Documentation 🚧 |
extend | Creates a 4D vector from `self` and the given `w` value. |
wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
with_y | Creates a 3D vector from `self` with the given value of `y`. |
saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
rem-2 | No Documentation 🚧 |
saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
mul-1 | No Documentation 🚧 |
truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
add-2 | No Documentation 🚧 |
from_array | Creates a new vector from an array. |
neg | No Documentation 🚧 |
wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
dot | Computes the dot product of `self` and `rhs`. |
abs | Returns a vector containing the absolute value of each element of `self`. |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
sub-2 | No Documentation 🚧 |
distance_squared | Compute the squared euclidean distance between two points in space. |
wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
is_negative_bitmask | Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. A negat... |
div-2 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | No Documentation 🚧 |
as_uvec3
Casts all elements of
self
tou32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | i32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
as_vec3
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
as_i64vec3
Casts all elements of
self
toi64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | 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
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
min | IVec3 | No Documentation 🚧 |
max | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
as_vec3a
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [i32; 3] | No Documentation 🚧 |
length_squared
Computes the squared length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | 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
Name | Type | Documentation |
---|---|---|
mask | BVec3 | No Documentation 🚧 |
if_true | IVec3 | No Documentation 🚧 |
if_false | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
as_u64vec3
Casts all elements of
self
tou64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
as_dvec3
Casts all elements of
self
tof64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
with_z
Creates a 3D vector from
self
with the given value ofz
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
cross
Computes the cross product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
with_x
Creates a 3D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
extend
Creates a 4D vector from
self
and the givenw
value.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
with_y
Creates a 3D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | 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
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [i32; 3] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | IVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
IVec4
IVec4
- x:i32
- y:i32
- z:i32
- w:i32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
from_array | Creates a new vector from an array. |
clone | No Documentation 🚧 |
as_dvec4 | Casts all elements of `self` to `f64`. |
sub-1 | No Documentation 🚧 |
new | Creates a new vector. |
wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
length_squared | Computes the squared length of `self`. |
add | No Documentation 🚧 |
assert_receiver_is_total_eq | No Documentation 🚧 |
rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
with_y | Creates a 4D vector from `self` with the given value of `y`. |
clamp | Component-wise clamping of values, similar to [`i32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
add-1 | No Documentation 🚧 |
rem-2 | No Documentation 🚧 |
wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
div-1 | No Documentation 🚧 |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
add-2 | No Documentation 🚧 |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
distance_squared | Compute the squared euclidean distance between two points in space. |
signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
div | No Documentation 🚧 |
mul | No Documentation 🚧 |
sub-2 | No Documentation 🚧 |
as_u64vec4 | Casts all elements of `self` to `u64`. |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
div-2 | No Documentation 🚧 |
rem-1 | No Documentation 🚧 |
as_i64vec4 | Casts all elements of `self` to `i64`. |
with_x | Creates a 4D vector from `self` with the given value of `x`. |
wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
mul-2 | No Documentation 🚧 |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
abs | Returns a vector containing the absolute value of each element of `self`. |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
rem | No Documentation 🚧 |
splat | Creates a vector with all elements set to `v`. |
truncate | Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. Truncation to [`IVec3`]... |
saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
as_vec4 | Casts all elements of `self` to `f32`. |
saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
as_uvec4 | Casts all elements of `self` to `u32`. |
with_w | Creates a 4D vector from `self` with the given value of `w`. |
dot | Computes the dot product of `self` and `rhs`. |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
neg | No Documentation 🚧 |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
mul-1 | No Documentation 🚧 |
eq | No Documentation 🚧 |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
to_array | `[x, y, z, w]` |
is_negative_bitmask | Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. A negat... |
sub | No Documentation 🚧 |
saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
with_z | Creates a 4D vector from `self` with the given value of `z`. |
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
Name | Type | Documentation |
---|---|---|
mask | BVec4 | No Documentation 🚧 |
if_true | IVec4 | No Documentation 🚧 |
if_false | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [i32; 4] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
as_dvec4
Casts all elements of
self
tof64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Name | Type | Documentation |
---|---|---|
x | i32 | No Documentation 🚧 |
y | i32 | No Documentation 🚧 |
z | i32 | No Documentation 🚧 |
w | i32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
with_y
Creates a 4D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | 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
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
min | IVec4 | No Documentation 🚧 |
max | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | 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
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
as_u64vec4
Casts all elements of
self
tou64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
as_i64vec4
Casts all elements of
self
toi64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
with_x
Creates a 4D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | i32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | 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
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
as_vec4
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
as_uvec4
Casts all elements of
self
tou32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
with_w
Creates a 4D vector from
self
with the given value ofw
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [i32; 4] | 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
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | IVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | i32 | No Documentation 🚧 |
with_z
Creates a 4D vector from
self
with the given value ofz
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
Mat2
Mat2
- x_axis:glam::Vec2
- y_axis:glam::Vec2
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
determinant | Returns the determinant of `self`. |
neg | No Documentation 🚧 |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
mul-2 | No Documentation 🚧 |
from_diagonal | Creates a 2x2 matrix with its diagonal set to `diagonal` and all other entries set to 0. |
clone | No Documentation 🚧 |
mul-1 | No Documentation 🚧 |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
div_scalar | Divides a 2x2 matrix by a scalar. |
inverse | Returns the inverse of `self`. If the matrix is not invertible the returned matrix will be invalid... |
abs | Takes the absolute value of each element in `self` |
col | Returns the matrix column for the given `index`. # Panics Panics if `index` is greater than 1. |
from_scale_angle | Creates a 2x2 matrix containing the combining non-uniform `scale` and rotation of `angle` (in radi... |
mul_mat2 | Multiplies two 2x2 matrices. |
add_mat2 | Adds two 2x2 matrices. |
row | Returns the matrix row for the given `index`. # Panics Panics if `index` is greater than 1. |
sub_mat2 | Subtracts two 2x2 matrices. |
eq | No Documentation 🚧 |
add | No Documentation 🚧 |
is_nan | Returns `true` if any elements are `NaN`. |
as_dmat2 | No Documentation 🚧 |
mul_scalar | Multiplies a 2x2 matrix by a scalar. |
from_mat3_minor | Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the `i`th column and `j`th... |
from_mat3a_minor | Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the `i`th column and `j`th... |
sub | No Documentation 🚧 |
transpose | Returns the transpose of `self`. |
div | No Documentation 🚧 |
from_mat3a | Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. |
from_cols | Creates a 2x2 matrix from two column vectors. |
to_cols_array | Creates a `[f32; 4]` array storing data in column major order. If you require data in row major order `transpose` the matrix first. |
mul | No Documentation 🚧 |
mul_vec2 | Transforms a 2D vector. |
from_angle | Creates a 2x2 matrix containing a rotation of `angle` (in radians). |
to_cols_array_2d | Creates a `[[f32; 2]; 2]` 2D array storing data in column major order. If you require data in row ... |
from_mat3 | Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. |
determinant
Returns the determinant of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Mat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
from_diagonal
Creates a 2x2 matrix with its diagonal set to
diagonal
and all other entries set to 0.
Arguments
Name | Type | Documentation |
---|---|---|
diagonal | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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 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
Name | Type | Documentation |
---|---|---|
_self | Mat2 | No Documentation 🚧 |
rhs | Mat2 | No Documentation 🚧 |
max_abs_diff | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
div_scalar
Divides a 2x2 matrix by a scalar.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Mat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
abs
Takes the absolute value of each element in
self
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
col
Returns the matrix column for the given
index
.Panics
Panics if
index
is greater than 1.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
from_scale_angle
Creates a 2x2 matrix containing the combining non-uniform
scale
and rotation ofangle
(in radians).
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
mul_mat2
Multiplies two 2x2 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
add_mat2
Adds two 2x2 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
row
Returns the matrix row for the given
index
.Panics
Panics if
index
is greater than 1.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
sub_mat2
Subtracts two 2x2 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
as_dmat2
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat2 | No Documentation 🚧 |
mul_scalar
Multiplies a 2x2 matrix by a scalar.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
transpose
Returns the transpose of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
from_mat3a
Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column.
Arguments
Name | Type | Documentation |
---|---|---|
m | Mat3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
from_cols
Creates a 2x2 matrix from two column vectors.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Mat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f32; 4] | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
mul_vec2
Transforms a 2D vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
from_angle
Creates a 2x2 matrix containing a rotation of
angle
(in radians).
Arguments
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | 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
Name | Type | Documentation |
---|---|---|
_self | Mat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [[f32; 2]; 2] | No Documentation 🚧 |
from_mat3
Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column.
Arguments
Name | Type | Documentation |
---|---|---|
m | Mat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat2 | No Documentation 🚧 |
Mat3
Mat3
- x_axis:glam::Vec3
- y_axis:glam::Vec3
- z_axis:glam::Vec3
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
from_rotation_y | Creates a 3D rotation matrix from `angle` (in radians) around the y axis. |
mul_scalar | Multiplies a 3x3 matrix by a scalar. |
abs | Takes the absolute value of each element in `self` |
mul_vec3a | Transforms a [`Vec3A`]. |
from_scale | Creates an affine transformation matrix from the given non-uniform 2D `scale`. The resulting matri... |
from_rotation_z | Creates a 3D rotation matrix from `angle` (in radians) around the z axis. |
inverse | Returns the inverse of `self`. If the matrix is not invertible the returned matrix will be invalid... |
add_mat3 | Adds two 3x3 matrices. |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
from_mat2 | Creates an affine transformation matrix from the given 2x2 matrix. The resulting matrix can be use... |
from_quat | Creates a 3D rotation matrix from the given quaternion. # Panics Will panic if `rotation` is not ... |
eq | No Documentation 🚧 |
transpose | Returns the transpose of `self`. |
row | Returns the matrix row for the given `index`. # Panics Panics if `index` is greater than 2. |
mul-1 | No Documentation 🚧 |
to_euler | Extract Euler angles with the given Euler rotation order. Note if the input matrix contains scales... |
mul_mat3 | Multiplies two 3x3 matrices. |
div | No Documentation 🚧 |
from_mat4 | Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. |
mul | No Documentation 🚧 |
from_rotation_x | Creates a 3D rotation matrix from `angle` (in radians) around the x axis. |
to_cols_array | Creates a `[f32; 9]` array storing data in column major order. If you require data in row major order `transpose` the matrix first. |
to_cols_array_2d | Creates a `[[f32; 3]; 3]` 3D array storing data in column major order. If you require data in row ... |
from_translation | Creates an affine transformation matrix from the given 2D `translation`. The resulting matrix can ... |
mul-2 | No Documentation 🚧 |
add | No Documentation 🚧 |
from_axis_angle | Creates a 3D rotation matrix from a normalized rotation `axis` and `angle` (in radians). # Panics... |
from_euler | Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in radians). |
mul-4 | No Documentation 🚧 |
from_angle | Creates an affine transformation matrix from the given 2D rotation `angle` (in radians). The resu... |
clone | No Documentation 🚧 |
from_cols | Creates a 3x3 matrix from three column vectors. |
col | Returns the matrix column for the given `index`. # Panics Panics if `index` is greater than 2. |
sub | No Documentation 🚧 |
from_mat4_minor | Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the `i`th column and `j`th... |
sub_mat3 | Subtracts two 3x3 matrices. |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
div_scalar | Divides a 3x3 matrix by a scalar. |
mul_vec3 | Transforms a 3D vector. |
from_scale_angle_translation | Creates an affine transformation matrix from the given 2D `scale`, rotation `angle` (in radians) a... |
as_dmat3 | No Documentation 🚧 |
determinant | Returns the determinant of `self`. |
from_diagonal | Creates a 3x3 matrix with its diagonal set to `diagonal` and all other entries set to 0. |
transform_point2 | Transforms the given 2D vector as a point. This is the equivalent of multiplying `rhs` as a 3D vec... |
mul-3 | No Documentation 🚧 |
is_nan | Returns `true` if any elements are `NaN`. |
neg | No Documentation 🚧 |
transform_vector2 | Rotates the given 2D vector. This is the equivalent of multiplying `rhs` as a 3D vector where `z` ... |
from_rotation_y
Creates a 3D rotation matrix from
angle
(in radians) around the y axis.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
mul_scalar
Multiplies a 3x3 matrix by a scalar.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
abs
Takes the absolute value of each element in
self
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
mul_vec3a
Transforms a [
Vec3A
].
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
Name | Type | Documentation |
---|---|---|
scale | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
from_rotation_z
Creates a 3D rotation matrix from
angle
(in radians) around the z axis.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Mat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
add_mat3
Adds two 3x3 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Mat3 | No Documentation 🚧 |
rhs | Mat3 | No Documentation 🚧 |
max_abs_diff | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
m | Mat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
rotation | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
transpose
Returns the transpose of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
row
Returns the matrix row for the given
index
.Panics
Panics if
index
is greater than 2.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | 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
Returns
mul_mat3
Multiplies two 3x3 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
from_mat4
Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column.
Arguments
Name | Type | Documentation |
---|---|---|
m | Mat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
from_rotation_x
Creates a 3D rotation matrix from
angle
(in radians) around the x axis.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Mat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Mat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [[f32; 3]; 3] | 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
Name | Type | Documentation |
---|---|---|
translation | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
from_euler
Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in radians).
Arguments
Name | Type | Documentation |
---|---|---|
order | EulerRot | No Documentation 🚧 |
a | f32 | No Documentation 🚧 |
b | f32 | No Documentation 🚧 |
c | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
mul-4
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | 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
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
from_cols
Creates a 3x3 matrix from three column vectors.
Arguments
Name | Type | Documentation |
---|---|---|
x_axis | Vec3 | No Documentation 🚧 |
y_axis | Vec3 | No Documentation 🚧 |
z_axis | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
col
Returns the matrix column for the given
index
.Panics
Panics if
index
is greater than 2.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
sub_mat3
Subtracts two 3x3 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Mat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
div_scalar
Divides a 3x3 matrix by a scalar.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
mul_vec3
Transforms a 3D vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | 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
Name | Type | Documentation |
---|---|---|
scale | Vec2 | No Documentation 🚧 |
angle | f32 | No Documentation 🚧 |
translation | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | No Documentation 🚧 |
as_dmat3
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
determinant
Returns the determinant of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
from_diagonal
Creates a 3x3 matrix with its diagonal set to
diagonal
and all other entries set to 0.
Arguments
Name | Type | Documentation |
---|---|---|
diagonal | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
mul-3
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
Mat3A
Mat3A
- x_axis:glam::Vec3A
- y_axis:glam::Vec3A
- z_axis:glam::Vec3A
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
determinant | Returns the determinant of `self`. |
mul-4 | No Documentation 🚧 |
abs | Takes the absolute value of each element in `self` |
inverse | Returns the inverse of `self`. If the matrix is not invertible the returned matrix will be invalid... |
from_scale_angle_translation | Creates an affine transformation matrix from the given 2D `scale`, rotation `angle` (in radians) a... |
from_mat2 | Creates an affine transformation matrix from the given 2x2 matrix. The resulting matrix can be use... |
from_rotation_y | Creates a 3D rotation matrix from `angle` (in radians) around the y axis. |
to_euler | Extract Euler angles with the given Euler rotation order. Note if the input matrix contains scales... |
mul_vec3 | Transforms a 3D vector. |
from_angle | Creates an affine transformation matrix from the given 2D rotation `angle` (in radians). The resu... |
from_euler | Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in radians). |
eq | No Documentation 🚧 |
as_dmat3 | No Documentation 🚧 |
mul-3 | No Documentation 🚧 |
clone | No Documentation 🚧 |
mul | No Documentation 🚧 |
neg | No Documentation 🚧 |
col | Returns the matrix column for the given `index`. # Panics Panics if `index` is greater than 2. |
from_rotation_x | Creates a 3D rotation matrix from `angle` (in radians) around the x axis. |
is_nan | Returns `true` if any elements are `NaN`. |
row | Returns the matrix row for the given `index`. # Panics Panics if `index` is greater than 2. |
sub_mat3 | Subtracts two 3x3 matrices. |
add_mat3 | Adds two 3x3 matrices. |
from_cols | Creates a 3x3 matrix from three column vectors. |
div_scalar | Divides a 3x3 matrix by a scalar. |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
mul_mat3 | Multiplies two 3x3 matrices. |
sub | No Documentation 🚧 |
from_translation | Creates an affine transformation matrix from the given 2D `translation`. The resulting matrix can ... |
mul-2 | No Documentation 🚧 |
from_mat4 | Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. |
transform_vector2 | Rotates the given 2D vector. This is the equivalent of multiplying `rhs` as a 3D vector where `z` ... |
mul_scalar | Multiplies a 3x3 matrix by a scalar. |
to_cols_array | Creates a `[f32; 9]` array storing data in column major order. If you require data in row major order `transpose` the matrix first. |
from_diagonal | Creates a 3x3 matrix with its diagonal set to `diagonal` and all other entries set to 0. |
from_quat | Creates a 3D rotation matrix from the given quaternion. # Panics Will panic if `rotation` is not ... |
transform_point2 | Transforms the given 2D vector as a point. This is the equivalent of multiplying `rhs` as a 3D vec... |
div | No Documentation 🚧 |
mul-1 | No Documentation 🚧 |
from_mat4_minor | Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the `i`th column and `j`th... |
from_rotation_z | Creates a 3D rotation matrix from `angle` (in radians) around the z axis. |
from_scale | Creates an affine transformation matrix from the given non-uniform 2D `scale`. The resulting matri... |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
from_axis_angle | Creates a 3D rotation matrix from a normalized rotation `axis` and `angle` (in radians). # Panics... |
add | 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 ... |
mul_vec3a | Transforms a [`Vec3A`]. |
transpose | Returns the transpose of `self`. |
determinant
Returns the determinant of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
mul-4
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
abs
Takes the absolute value of each element in
self
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Mat3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
scale | Vec2 | No Documentation 🚧 |
angle | f32 | No Documentation 🚧 |
translation | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
m | Mat2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
from_rotation_y
Creates a 3D rotation matrix from
angle
(in radians) around the y axis.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | 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
Returns
mul_vec3
Transforms a 3D vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | 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
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
from_euler
Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in radians).
Arguments
Name | Type | Documentation |
---|---|---|
order | EulerRot | No Documentation 🚧 |
a | f32 | No Documentation 🚧 |
b | f32 | No Documentation 🚧 |
c | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
as_dmat3
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat3 | No Documentation 🚧 |
mul-3
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
col
Returns the matrix column for the given
index
.Panics
Panics if
index
is greater than 2.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
from_rotation_x
Creates a 3D rotation matrix from
angle
(in radians) around the x axis.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
row
Returns the matrix row for the given
index
.Panics
Panics if
index
is greater than 2.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
sub_mat3
Subtracts two 3x3 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
add_mat3
Adds two 3x3 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
from_cols
Creates a 3x3 matrix from three column vectors.
Arguments
Name | Type | Documentation |
---|---|---|
x_axis | Vec3A | No Documentation 🚧 |
y_axis | Vec3A | No Documentation 🚧 |
z_axis | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
div_scalar
Divides a 3x3 matrix by a scalar.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Mat3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
mul_mat3
Multiplies two 3x3 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
translation | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
from_mat4
Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column.
Arguments
Name | Type | Documentation |
---|---|---|
m | Mat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
mul_scalar
Multiplies a 3x3 matrix by a scalar.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Mat3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f32; 9] | No Documentation 🚧 |
from_diagonal
Creates a 3x3 matrix with its diagonal set to
diagonal
and all other entries set to 0.
Arguments
Name | Type | Documentation |
---|---|---|
diagonal | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
rotation | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
from_rotation_z
Creates a 3D rotation matrix from
angle
(in radians) around the z axis.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
scale | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Mat3A | No Documentation 🚧 |
rhs | Mat3A | No Documentation 🚧 |
max_abs_diff | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat3A | 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
Name | Type | Documentation |
---|---|---|
_self | Mat3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [[f32; 3]; 3] | No Documentation 🚧 |
mul_vec3a
Transforms a [
Vec3A
].
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
transpose
Returns the transpose of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
from_rotation_z | Creates an affine transformation matrix containing a 3D rotation around the z axis of `angle` (in ... |
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. |
from_scale_rotation_translation | Creates an affine transformation matrix from the given 3D `scale`, `rotation` and `translation`. ... |
perspective_infinite_reverse_lh | Creates an infinite reverse left-handed perspective projection matrix with `[0,1]` depth range. Similar to `perspective_infinite_lh`, but maps `Z = z_near` to a depth of `1` and `Z = infinity` to a depth of `0`. # Panics Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. |
from_translation | Creates an affine transformation matrix from the given 3D `translation`. The resulting matrix can ... |
transform_vector3a | Transforms the give [`Vec3A`] as 3D vector. This is the equivalent of multiplying the [`Vec3A`] as... |
mul_vec4 | Transforms a 4D vector. |
perspective_infinite_lh | Creates an infinite left-handed perspective projection matrix with `[0,1]` depth range. Like `perspective_lh`, but with an infinite value for `z_far`. The result is that points near `z_near` are mapped to depth `0`, and as they move towards infinity the depth approaches `1`. # Panics Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is enabled. |
mul-3 | No Documentation 🚧 |
transform_point3a | Transforms the given [`Vec3A`] as 3D point. This is the equivalent of multiplying the [`Vec3A`] as... |
from_mat3 | Creates an affine transformation matrix from the given 3x3 linear transformation matrix. The resu... |
as_dmat4 | No Documentation 🚧 |
add_mat4 | Adds two 4x4 matrices. |
neg | No Documentation 🚧 |
project_point3 | Transforms the given 3D vector as a point, applying perspective correction. This is the equivalent... |
from_rotation_y | Creates an affine transformation matrix containing a 3D rotation around the y axis of `angle` (in ... |
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 OpenGL `gluPerspective` function. See https://www\.khronos\.org/registry/OpenGL\-Refpages/gl2\.1/xhtml/gluPerspective\.xml |
div_scalar | Divides a 4x4 matrix by a scalar. |
from_mat3a | Creates an affine transformation matrix from the given 3x3 linear transformation matrix. The resu... |
eq | No Documentation 🚧 |
col | Returns the matrix column for the given `index`. # Panics Panics if `index` is greater than 3. |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
determinant | Returns the determinant of `self`. |
mul-2 | No Documentation 🚧 |
orthographic_rh_gl | Creates a right-handed orthographic projection matrix with `[-1,1]` depth range. This is the same as the OpenGL `glOrtho` 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. |
to_euler | Extract Euler angles with the given Euler rotation order. Note if the upper 3x3 matrix contain sca... |
look_to_lh | Creates a left-handed view matrix using a camera position, an up direction, and a facing direction... |
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. |
to_cols_array_2d | Creates a `[[f32; 4]; 4]` 4D array storing data in column major order. If you require data in row ... |
from_diagonal | Creates a 4x4 matrix with its diagonal set to `diagonal` and all other entries set to 0. |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
from_quat | Creates an affine transformation matrix from the given `rotation` quaternion. The resulting matrix... |
div | No Documentation 🚧 |
clone | No Documentation 🚧 |
from_rotation_x | Creates an affine transformation matrix containing a 3D rotation around the x axis of `angle` (in ... |
mul_mat4 | Multiplies two 4x4 matrices. |
abs | Takes the absolute value of each element in `self` |
perspective_infinite_rh | Creates an infinite right-handed perspective projection matrix with `[0,1]` depth range. Like `perspective_rh`, but with an infinite value for `z_far`. The result is that points near `z_near` are mapped to depth `0`, and as they move towards infinity the depth approaches `1`. # Panics Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is enabled. |
inverse | Returns the inverse of `self`. If the matrix is not invertible the returned matrix will be invalid... |
look_to_rh | Creates a right-handed view matrix using a camera position, an up direction, and a facing directio... |
transform_point3 | Transforms the given 3D vector as a point. This is the equivalent of multiplying the 3D vector as ... |
mul-1 | No Documentation 🚧 |
mul | No Documentation 🚧 |
look_at_rh | Creates a right-handed view matrix using a camera position, an up direction, and a focal point. F... |
perspective_infinite_reverse_rh | Creates an infinite reverse right-handed perspective projection matrix with `[0,1]` depth range. Similar to `perspective_infinite_rh`, but maps `Z = z_near` to a depth of `1` and `Z = infinity` to a depth of `0`. # Panics Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. |
mul_scalar | Multiplies a 4x4 matrix by a scalar. |
from_rotation_translation | Creates an affine transformation matrix from the given 3D `translation`. The resulting matrix can ... |
transpose | Returns the transpose of `self`. |
look_at_lh | Creates a left-handed view matrix using a camera position, an up direction, and a focal point. Fo... |
add | No Documentation 🚧 |
from_cols | Creates a 4x4 matrix from four column vectors. |
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` or `z_far` are less than or equal to zero when `glam_assert` is enabled. |
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` or `z_far` are less than or equal to zero when `glam_assert` is enabled. |
from_scale | Creates an affine transformation matrix containing the given 3D non-uniform `scale`. The resulting... |
row | Returns the matrix row for the given `index`. # Panics Panics if `index` is greater than 3. |
transform_vector3 | Transforms the give 3D vector as a direction. This is the equivalent of multiplying the 3D vector ... |
to_cols_array | Creates a `[f32; 16]` array storing data in column major order. If you require data in row major order `transpose` the matrix first. |
from_euler | Creates a affine transformation matrix containing a rotation from the given euler rotation sequenc... |
project_point3a | Transforms the given [`Vec3A`] as a 3D point, applying perspective correction. This is the equivalent of multiplying the [`Vec3A`]... |
from_axis_angle | Creates an affine transformation matrix containing a 3D rotation around a normalized rotation `axis`... |
sub | No Documentation 🚧 |
sub_mat4 | Subtracts two 4x4 matrices. |
is_nan | Returns `true` if any elements are `NaN`. |
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
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
scale | Vec3 | No Documentation 🚧 |
rotation | Quat | No Documentation 🚧 |
translation | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
fov_y_radians | f32 | No Documentation 🚧 |
aspect_ratio | f32 | No Documentation 🚧 |
z_near | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
translation | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
mul_vec4
Transforms a 4D vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | 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
Name | Type | Documentation |
---|---|---|
fov_y_radians | f32 | No Documentation 🚧 |
aspect_ratio | f32 | No Documentation 🚧 |
z_near | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
mul-3
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
Name | Type | Documentation |
---|---|---|
m | Mat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
as_dmat4
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DMat4 | No Documentation 🚧 |
add_mat4
Adds two 4x4 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | 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
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
fov_y_radians | f32 | No Documentation 🚧 |
aspect_ratio | f32 | No Documentation 🚧 |
z_near | f32 | No Documentation 🚧 |
z_far | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
div_scalar
Divides a 4x4 matrix by a scalar.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
m | Mat3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
col
Returns the matrix column for the given
index
.Panics
Panics if
index
is greater than 3.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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 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
Name | Type | Documentation |
---|---|---|
_self | Mat4 | No Documentation 🚧 |
rhs | Mat4 | No Documentation 🚧 |
max_abs_diff | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
determinant
Returns the determinant of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | 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
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | 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
Returns
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | 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
Name | Type | Documentation |
---|---|---|
_self | Mat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [[f32; 4]; 4] | No Documentation 🚧 |
from_diagonal
Creates a 4x4 matrix with its diagonal set to
diagonal
and all other entries set to 0.
Arguments
Name | Type | Documentation |
---|---|---|
diagonal | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Mat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
rotation | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
mul_mat4
Multiplies two 4x4 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
abs
Takes the absolute value of each element in
self
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
fov_y_radians | f32 | No Documentation 🚧 |
aspect_ratio | f32 | No Documentation 🚧 |
z_near | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Mat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
eye | Vec3 | No Documentation 🚧 |
center | Vec3 | No Documentation 🚧 |
up | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
fov_y_radians | f32 | No Documentation 🚧 |
aspect_ratio | f32 | No Documentation 🚧 |
z_near | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
mul_scalar
Multiplies a 4x4 matrix by a scalar.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
transpose
Returns the transpose of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | 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
Name | Type | Documentation |
---|---|---|
eye | Vec3 | No Documentation 🚧 |
center | Vec3 | No Documentation 🚧 |
up | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
from_cols
Creates a 4x4 matrix from four column vectors.
Arguments
Name | Type | Documentation |
---|---|---|
x_axis | Vec4 | No Documentation 🚧 |
y_axis | Vec4 | No Documentation 🚧 |
z_axis | Vec4 | No Documentation 🚧 |
w_axis | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
fov_y_radians | f32 | No Documentation 🚧 |
aspect_ratio | f32 | No Documentation 🚧 |
z_near | f32 | No Documentation 🚧 |
z_far | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
fov_y_radians | f32 | No Documentation 🚧 |
aspect_ratio | f32 | No Documentation 🚧 |
z_near | f32 | No Documentation 🚧 |
z_far | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
scale | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
row
Returns the matrix row for the given
index
.Panics
Panics if
index
is greater than 3.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | 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
Name | Type | Documentation |
---|---|---|
_self | Mat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f32; 16] | 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
Name | Type | Documentation |
---|---|---|
order | EulerRot | No Documentation 🚧 |
a | f32 | No Documentation 🚧 |
b | f32 | No Documentation 🚧 |
c | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
sub_mat4
Subtracts two 4x4 matrices.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Mat4 | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Mat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
Quat
Quat
- x:f32
- y:f32
- z:f32
- w:f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
from_affine3 | Creates a quaternion from a 3x3 rotation matrix inside a 3D affine transform. Note if the input af... |
clone | No Documentation 🚧 |
from_mat3 | Creates a quaternion from a 3x3 rotation matrix. Note if the input matrix contain scales, shears, ... |
mul-1 | No Documentation 🚧 |
from_vec4 | Creates a new rotation quaternion from a 4D vector. # Preconditions This function does not check ... |
normalize | Returns `self` normalized to length 1.0. For valid results, `self` must _not_ be of length zero. ... |
length | Computes the length of `self`. |
to_array | `[x, y, z, w]` |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
to_euler | Returns the rotation angles for the given euler rotation sequence. |
mul | Multiplies two quaternions. If they each represent a rotation, the result will represent the combi... |
from_rotation_z | Creates a quaternion from the `angle` (in radians) around the z axis. |
from_rotation_arc | Gets the minimal rotation for transforming `from` to `to`. The rotation is in the plane spanned b... |
inverse | Returns the inverse of a normalized quaternion. Typically quaternion inverse returns the conjugate... |
is_nan | Returns `true` if any elements are `NAN`. |
dot | Computes the dot product of `self` and `rhs`. The dot product is equal to the cosine of the angle ... |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
from_rotation_y | Creates a quaternion from the `angle` (in radians) around the y axis. |
to_scaled_axis | Returns the rotation axis scaled by the rotation in radians. |
xyz | Returns the vector part of the quaternion. |
length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
angle_between | Returns the angle (in radians) for the minimal rotation for transforming this quaternion into anot... |
from_xyzw | Creates a new rotation quaternion. This should generally not be called manually unless you know wh... |
mul_vec3a | Multiplies a quaternion and a 3D vector, returning the rotated vector. |
is_normalized | Returns whether `self` of length `1.0` or not. Uses a precision threshold of `1e-6`. |
from_rotation_arc_2d | Gets the minimal rotation for transforming `from` to `to`. The resulting rotation is around the z... |
from_axis_angle | Create a quaternion for a normalized rotation `axis` and `angle` (in radians). The axis must be a ... |
mul_quat | Multiplies two quaternions. If they each represent a rotation, the result will represent the combi... |
eq | No Documentation 🚧 |
conjugate | Returns the quaternion conjugate of `self`. For a unit quaternion the conjugate is also the invers... |
as_dquat | No Documentation 🚧 |
sub | Subtracts the `rhs` quaternion from `self`. The difference is not guaranteed to be normalized. |
add | Adds two quaternions. The sum is not guaranteed to be normalized. Note that addition is not the s... |
lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0... |
from_scaled_axis | Create a quaternion that rotates `v.length()` radians around `v.normalize()`. `from_scaled_axis(Vec3::ZERO)`... |
length_squared | Computes the squared length of `self`. This is generally faster than `length()` as it avoids a squ... |
from_array | Creates a rotation quaternion from an array. # Preconditions This function does not check if the ... |
from_mat3a | Creates a quaternion from a 3x3 SIMD aligned rotation matrix. Note if the input matrix contain sca... |
neg | No Documentation 🚧 |
rotate_towards | Rotates towards `rhs` up to `max_angle` (in radians). When `max_angle` is `0.0`, the result will b... |
div | Divides a quaternion by a scalar value. The quotient is not guaranteed to be normalized. |
mul-2 | No Documentation 🚧 |
from_mat4 | Creates a quaternion from the upper 3x3 rotation matrix inside a homogeneous 4x4 matrix. Note if t... |
is_near_identity | No Documentation 🚧 |
mul_vec3 | Multiplies a quaternion and a 3D vector, returning the rotated vector. # Panics Will panic if `self`... |
from_rotation_arc_colinear | Gets the minimal rotation for transforming `from` to either `to` or `-to`. This means that the re... |
mul-3 | No Documentation 🚧 |
from_rotation_x | Creates a quaternion from the `angle` (in radians) around the x axis. |
from_euler | Creates a quaternion from the given Euler rotation sequence and the angles (in radians). |
slerp | Performs a spherical linear interpolation between `self` and `end` based on the value `s`. When `s`... |
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
Name | Type | Documentation |
---|---|---|
a | Affine3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
mat | Mat3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | 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
Name | Type | Documentation |
---|---|---|
v | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
length
Computes the length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f32; 4] | 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
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
to_euler
Returns the rotation angles for the given euler rotation sequence.
Arguments
Returns
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
from_rotation_z
Creates a quaternion from the
angle
(in radians) around the z axis.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNAN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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 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
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
rhs | Quat | No Documentation 🚧 |
max_abs_diff | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
from_rotation_y
Creates a quaternion from the
angle
(in radians) around the y axis.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
to_scaled_axis
Returns the rotation axis scaled by the rotation in radians.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
xyz
Returns the vector part of the quaternion.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Name | Type | Documentation |
---|---|---|
x | f32 | No Documentation 🚧 |
y | f32 | No Documentation 🚧 |
z | f32 | No Documentation 🚧 |
w | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
mul_vec3a
Multiplies a quaternion and a 3D vector, returning the rotated vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
is_normalized
Returns whether
self
of length1.0
or not. Uses a precision threshold of1e-6
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
conjugate
Returns the quaternion conjugate of
self
. For a unit quaternion the conjugate is also the inverse.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
as_dquat
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DQuat | No Documentation 🚧 |
sub
Subtracts the
rhs
quaternion fromself
. The difference is not guaranteed to be normalized.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
v | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
length_squared
Computes the squared length of
self
. This is generally faster thanlength()
as it avoids a square root operation.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Name | Type | Documentation |
---|---|---|
a | [f32; 4] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
mat | Mat3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
rhs | Quat | No Documentation 🚧 |
max_angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
div
Divides a quaternion by a scalar value. The quotient is not guaranteed to be normalized.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
Name | Type | Documentation |
---|---|---|
mat | Mat4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
is_near_identity
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Quat | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
mul-3
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
from_rotation_x
Creates a quaternion from the
angle
(in radians) around the x axis.
Arguments
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
from_euler
Creates a quaternion from the given Euler rotation sequence and the angles (in radians).
Arguments
Name | Type | Documentation |
---|---|---|
euler | EulerRot | No Documentation 🚧 |
a | f32 | No Documentation 🚧 |
b | f32 | No Documentation 🚧 |
c | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Quat | No Documentation 🚧 |
U64Vec2
U64Vec2
- x:u64
- y:u64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
with_y | Creates a 2D vector from `self` with the given value of `y`. |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
splat | Creates a vector with all elements set to `v`. |
saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
with_x | Creates a 2D vector from `self` with the given value of `x`. |
dot | Computes the dot product of `self` and `rhs`. |
as_i64vec2 | Casts all elements of `self` to `i64`. |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
sub-2 | No Documentation 🚧 |
clamp | Component-wise clamping of values, similar to [`u64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
assert_receiver_is_total_eq | No Documentation 🚧 |
sub | No Documentation 🚧 |
div-2 | No Documentation 🚧 |
as_vec2 | Casts all elements of `self` to `f32`. |
wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
mul | No Documentation 🚧 |
add | No Documentation 🚧 |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
clone | No Documentation 🚧 |
rem | No Documentation 🚧 |
new | Creates a new vector. |
sub-1 | No Documentation 🚧 |
mul-1 | No Documentation 🚧 |
div | No Documentation 🚧 |
to_array | `[x, y]` |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
length_squared | Computes the squared length of `self`. |
rem-1 | No Documentation 🚧 |
wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
eq | No Documentation 🚧 |
as_ivec2 | Casts all elements of `self` to `i32`. |
as_uvec2 | Casts all elements of `self` to `u32`. |
wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
add-2 | No Documentation 🚧 |
add-1 | No Documentation 🚧 |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
div-1 | No Documentation 🚧 |
as_dvec2 | Casts all elements of `self` to `f64`. |
mul-2 | No Documentation 🚧 |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
rem-2 | No Documentation 🚧 |
from_array | Creates a new vector from an array. |
extend | Creates a 3D vector from `self` and the given `z` value. |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
with_y
Creates a 2D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | 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
Name | Type | Documentation |
---|---|---|
mask | BVec2 | No Documentation 🚧 |
if_true | U64Vec2 | No Documentation 🚧 |
if_false | U64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | u64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
with_x
Creates a 2D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | No Documentation 🚧 |
as_i64vec2
Casts all elements of
self
toi64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | 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
Name | Type | Documentation |
---|---|---|
_self | U64Vec2 | No Documentation 🚧 |
min | U64Vec2 | No Documentation 🚧 |
max | U64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
as_vec2
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
to_array
[x, y]
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [u64; 2] | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
as_ivec2
Casts all elements of
self
toi32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
as_uvec2
Casts all elements of
self
tou32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
as_dvec2
Casts all elements of
self
tof64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [u64; 2] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
extend
Creates a 3D vector from
self
and the givenz
value.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
U64Vec3
U64Vec3
- x:u64
- y:u64
- z:u64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
div | No Documentation 🚧 |
as_i64vec3 | Casts all elements of `self` to `i64`. |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
as_vec3a | Casts all elements of `self` to `f32`. |
div-2 | No Documentation 🚧 |
saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
sub | No Documentation 🚧 |
eq | No Documentation 🚧 |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
splat | Creates a vector with all elements set to `v`. |
saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
rem-1 | No Documentation 🚧 |
as_uvec3 | Casts all elements of `self` to `u32`. |
sub-2 | No Documentation 🚧 |
wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
with_z | Creates a 3D vector from `self` with the given value of `z`. |
wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
as_dvec3 | Casts all elements of `self` to `f64`. |
length_squared | Computes the squared length of `self`. |
to_array | `[x, y, z]` |
clone | No Documentation 🚧 |
with_y | Creates a 3D vector from `self` with the given value of `y`. |
assert_receiver_is_total_eq | No Documentation 🚧 |
as_ivec3 | Casts all elements of `self` to `i32`. |
div-1 | No Documentation 🚧 |
mul-1 | No Documentation 🚧 |
sub-1 | No Documentation 🚧 |
from_array | Creates a new vector from an array. |
with_x | Creates a 3D vector from `self` with the given value of `x`. |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
rem | No Documentation 🚧 |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
rem-2 | No Documentation 🚧 |
mul-2 | No Documentation 🚧 |
wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
add-1 | No Documentation 🚧 |
new | Creates a new vector. |
saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
clamp | Component-wise clamping of values, similar to [`u64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
dot | Computes the dot product of `self` and `rhs`. |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
mul | No Documentation 🚧 |
as_vec3 | Casts all elements of `self` to `f32`. |
add-2 | No Documentation 🚧 |
add | No Documentation 🚧 |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
extend | Creates a 4D vector from `self` and the given `w` value. |
cross | Computes the cross product of `self` and `rhs`. |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
as_i64vec3
Casts all elements of
self
toi64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
as_vec3a
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | u64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
as_uvec3
Casts all elements of
self
tou32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
with_z
Creates a 3D vector from
self
with the given value ofz
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
as_dvec3
Casts all elements of
self
tof64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [u64; 3] | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
with_y
Creates a 3D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
as_ivec3
Casts all elements of
self
toi32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [u64; 3] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
with_x
Creates a 3D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
mask | BVec3 | No Documentation 🚧 |
if_true | U64Vec3 | No Documentation 🚧 |
if_false | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | 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
Name | Type | Documentation |
---|---|---|
_self | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | 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
Name | Type | Documentation |
---|---|---|
_self | U64Vec3 | No Documentation 🚧 |
min | U64Vec3 | No Documentation 🚧 |
max | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
as_vec3
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
extend
Creates a 4D vector from
self
and the givenw
value.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
cross
Computes the cross product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
U64Vec4
U64Vec4
- x:u64
- y:u64
- z:u64
- w:u64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
add | No Documentation 🚧 |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
sub-1 | No Documentation 🚧 |
splat | Creates a vector with all elements set to `v`. |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
mul-1 | No Documentation 🚧 |
wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
as_ivec4 | Casts all elements of `self` to `i32`. |
assert_receiver_is_total_eq | No Documentation 🚧 |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
with_y | Creates a 4D vector from `self` with the given value of `y`. |
clamp | Component-wise clamping of values, similar to [`u64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
as_uvec4 | Casts all elements of `self` to `u32`. |
mul-2 | No Documentation 🚧 |
add-2 | No Documentation 🚧 |
div | No Documentation 🚧 |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
with_x | Creates a 4D vector from `self` with the given value of `x`. |
sub-2 | No Documentation 🚧 |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
rem-2 | No Documentation 🚧 |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
with_w | Creates a 4D vector from `self` with the given value of `w`. |
saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
new | Creates a new vector. |
div-1 | No Documentation 🚧 |
saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
dot | Computes the dot product of `self` and `rhs`. |
as_dvec4 | Casts all elements of `self` to `f64`. |
as_vec4 | Casts all elements of `self` to `f32`. |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
add-1 | No Documentation 🚧 |
as_i64vec4 | Casts all elements of `self` to `i64`. |
div-2 | No Documentation 🚧 |
eq | No Documentation 🚧 |
sub | No Documentation 🚧 |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
to_array | `[x, y, z, w]` |
rem-1 | No Documentation 🚧 |
length_squared | Computes the squared length of `self`. |
truncate | Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. Truncation to [`U64Vec3`]... |
with_z | Creates a 4D vector from `self` with the given value of `z`. |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
from_array | Creates a new vector from an array. |
rem | No Documentation 🚧 |
saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
mul | No Documentation 🚧 |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
clone | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | u64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
as_ivec4
Casts all elements of
self
toi32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
with_y
Creates a 4D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | 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
Name | Type | Documentation |
---|---|---|
_self | U64Vec4 | No Documentation 🚧 |
min | U64Vec4 | No Documentation 🚧 |
max | U64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
as_uvec4
Casts all elements of
self
tou32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | 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
Name | Type | Documentation |
---|---|---|
mask | BVec4 | No Documentation 🚧 |
if_true | U64Vec4 | No Documentation 🚧 |
if_false | U64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
with_x
Creates a 4D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
with_w
Creates a 4D vector from
self
with the given value ofw
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Name | Type | Documentation |
---|---|---|
x | u64 | No Documentation 🚧 |
y | u64 | No Documentation 🚧 |
z | u64 | No Documentation 🚧 |
w | u64 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | No Documentation 🚧 |
as_dvec4
Casts all elements of
self
tof64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
as_vec4
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
as_i64vec4
Casts all elements of
self
toi64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [u64; 4] | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | 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
Name | Type | Documentation |
---|---|---|
_self | U64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
with_z
Creates a 4D vector from
self
with the given value ofz
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u64 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [u64; 4] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | U64Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
UVec2
UVec2
- x:u32
- y:u32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
mul | No Documentation 🚧 |
mul-2 | No Documentation 🚧 |
rem-2 | No Documentation 🚧 |
add-1 | No Documentation 🚧 |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
with_x | Creates a 2D vector from `self` with the given value of `x`. |
saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
as_dvec2 | Casts all elements of `self` to `f64`. |
add-2 | No Documentation 🚧 |
rem-1 | No Documentation 🚧 |
with_y | Creates a 2D vector from `self` with the given value of `y`. |
wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
length_squared | Computes the squared length of `self`. |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
new | Creates a new vector. |
eq | No Documentation 🚧 |
add | No Documentation 🚧 |
extend | Creates a 3D vector from `self` and the given `z` value. |
rem | No Documentation 🚧 |
saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
as_i64vec2 | Casts all elements of `self` to `i64`. |
sub-1 | No Documentation 🚧 |
from_array | Creates a new vector from an array. |
wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
clone | No Documentation 🚧 |
wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
div | No Documentation 🚧 |
as_vec2 | Casts all elements of `self` to `f32`. |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
clamp | Component-wise clamping of values, similar to [`u32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
dot | Computes the dot product of `self` and `rhs`. |
sub | No Documentation 🚧 |
wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
to_array | `[x, y]` |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
div-2 | No Documentation 🚧 |
splat | Creates a vector with all elements set to `v`. |
as_u64vec2 | Casts all elements of `self` to `u64`. |
assert_receiver_is_total_eq | No Documentation 🚧 |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
sub-2 | No Documentation 🚧 |
saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
div-1 | No Documentation 🚧 |
mul-1 | No Documentation 🚧 |
as_ivec2 | Casts all elements of `self` to `i32`. |
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
with_x
Creates a 2D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
as_dvec2
Casts all elements of
self
tof64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
with_y
Creates a 2D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
extend
Creates a 3D vector from
self
and the givenz
value.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
as_i64vec2
Casts all elements of
self
toi64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [u32; 2] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
as_vec2
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
mask | BVec2 | No Documentation 🚧 |
if_true | UVec2 | No Documentation 🚧 |
if_false | UVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | 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
Name | Type | Documentation |
---|---|---|
_self | UVec2 | No Documentation 🚧 |
min | UVec2 | No Documentation 🚧 |
max | UVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
to_array
[x, y]
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [u32; 2] | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | u32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
as_u64vec2
Casts all elements of
self
tou64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
as_ivec2
Casts all elements of
self
toi32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | No Documentation 🚧 |
UVec3
UVec3
- x:u32
- y:u32
- z:u32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
clamp | Component-wise clamping of values, similar to [`u32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
add-2 | No Documentation 🚧 |
with_x | Creates a 3D vector from `self` with the given value of `x`. |
rem | No Documentation 🚧 |
cross | Computes the cross product of `self` and `rhs`. |
saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
sub-2 | No Documentation 🚧 |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
clone | No Documentation 🚧 |
wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
as_ivec3 | Casts all elements of `self` to `i32`. |
as_i64vec3 | Casts all elements of `self` to `i64`. |
add | No Documentation 🚧 |
mul-1 | No Documentation 🚧 |
div-1 | No Documentation 🚧 |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
as_dvec3 | Casts all elements of `self` to `f64`. |
wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
div-2 | No Documentation 🚧 |
wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
extend | Creates a 4D vector from `self` and the given `w` value. |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
splat | Creates a vector with all elements set to `v`. |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
div | No Documentation 🚧 |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
from_array | Creates a new vector from an array. |
as_u64vec3 | Casts all elements of `self` to `u64`. |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
dot | Computes the dot product of `self` and `rhs`. |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
sub-1 | No Documentation 🚧 |
truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
mul-2 | No Documentation 🚧 |
assert_receiver_is_total_eq | No Documentation 🚧 |
saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
length_squared | Computes the squared length of `self`. |
to_array | `[x, y, z]` |
eq | No Documentation 🚧 |
as_vec3 | Casts all elements of `self` to `f32`. |
rem-1 | No Documentation 🚧 |
saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
sub | No Documentation 🚧 |
mul | No Documentation 🚧 |
with_z | Creates a 3D vector from `self` with the given value of `z`. |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
as_vec3a | Casts all elements of `self` to `f32`. |
new | Creates a new vector. |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
add-1 | No Documentation 🚧 |
wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
with_y | Creates a 3D vector from `self` with the given value of `y`. |
wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
rem-2 | No Documentation 🚧 |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
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
Name | Type | Documentation |
---|---|---|
_self | UVec3 | No Documentation 🚧 |
min | UVec3 | No Documentation 🚧 |
max | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
with_x
Creates a 3D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
cross
Computes the cross product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
as_ivec3
Casts all elements of
self
toi32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
as_i64vec3
Casts all elements of
self
toi64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
mask | BVec3 | No Documentation 🚧 |
if_true | UVec3 | No Documentation 🚧 |
if_false | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
as_dvec3
Casts all elements of
self
tof64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
extend
Creates a 4D vector from
self
and the givenw
value.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | u32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [u32; 3] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
as_u64vec3
Casts all elements of
self
tou64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | 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
Name | Type | Documentation |
---|---|---|
_self | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [u32; 3] | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
as_vec3
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
with_z
Creates a 3D vector from
self
with the given value ofz
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
as_vec3a
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
with_y
Creates a 3D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
UVec4
UVec4
- x:u32
- y:u32
- z:u32
- w:u32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
truncate | Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. Truncation to [`UVec3`]... |
with_x | Creates a 4D vector from `self` with the given value of `x`. |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
add | No Documentation 🚧 |
with_z | Creates a 4D vector from `self` with the given value of `z`. |
wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
div | No Documentation 🚧 |
saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
as_i64vec4 | Casts all elements of `self` to `i64`. |
as_dvec4 | Casts all elements of `self` to `f64`. |
eq | No Documentation 🚧 |
add-1 | No Documentation 🚧 |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
with_w | Creates a 4D vector from `self` with the given value of `w`. |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
assert_receiver_is_total_eq | No Documentation 🚧 |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
sub | No Documentation 🚧 |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
splat | Creates a vector with all elements set to `v`. |
clamp | Component-wise clamping of values, similar to [`u32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
dot | Computes the dot product of `self` and `rhs`. |
saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
as_u64vec4 | Casts all elements of `self` to `u64`. |
wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
sub-1 | No Documentation 🚧 |
rem-2 | No Documentation 🚧 |
rem-1 | No Documentation 🚧 |
saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
as_ivec4 | Casts all elements of `self` to `i32`. |
as_vec4 | Casts all elements of `self` to `f32`. |
length_squared | Computes the squared length of `self`. |
add-2 | No Documentation 🚧 |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
rem | No Documentation 🚧 |
new | Creates a new vector. |
mul-1 | No Documentation 🚧 |
to_array | `[x, y, z, w]` |
mul | No Documentation 🚧 |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
clone | No Documentation 🚧 |
with_y | Creates a 4D vector from `self` with the given value of `y`. |
from_array | Creates a new vector from an array. |
div-2 | No Documentation 🚧 |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
sub-2 | No Documentation 🚧 |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
div-1 | No Documentation 🚧 |
mul-2 | No Documentation 🚧 |
wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
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
Name | Type | Documentation |
---|---|---|
_self | UVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | No Documentation 🚧 |
with_x
Creates a 4D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
with_z
Creates a 4D vector from
self
with the given value ofz
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
as_i64vec4
Casts all elements of
self
toi64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | No Documentation 🚧 |
as_dvec4
Casts all elements of
self
tof64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
with_w
Creates a 4D vector from
self
with the given value ofw
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | u32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | 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
Name | Type | Documentation |
---|---|---|
_self | UVec4 | No Documentation 🚧 |
min | UVec4 | No Documentation 🚧 |
max | UVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
as_u64vec4
Casts all elements of
self
tou64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
as_ivec4
Casts all elements of
self
toi32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | No Documentation 🚧 |
as_vec4
Casts all elements of
self
tof32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Name | Type | Documentation |
---|---|---|
x | u32 | No Documentation 🚧 |
y | u32 | No Documentation 🚧 |
z | u32 | No Documentation 🚧 |
w | u32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [u32; 4] | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
with_y
Creates a 4D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [u32; 4] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
mask | BVec4 | No Documentation 🚧 |
if_true | UVec4 | No Documentation 🚧 |
if_false | UVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | UVec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
Vec2
Vec2
- x:f32
- y:f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
fract_gl | Returns a vector containing the fractional part of the vector as `self - self.floor()`. Note that ... |
fract | Returns a vector containing the fractional part of the vector as `self - self.trunc()`. Note that ... |
as_uvec2 | Casts all elements of `self` to `u32`. |
project_onto | Returns the vector projection of `self` onto `rhs`. `rhs` must be of non-zero length. # Panics W... |
perp_dot | The perpendicular dot product of `self` and `rhs`. Also known as the wedge product, 2D cross produ... |
clone | No Documentation 🚧 |
mul-2 | No Documentation 🚧 |
with_y | Creates a 2D vector from `self` with the given value of `y`. |
div-2 | No Documentation 🚧 |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
angle_between | No Documentation 🚧 |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
trunc | Returns a vector containing the integer part each element of `self`. This means numbers are always... |
refract | Returns the refraction direction for a given incident vector `self`, surface normal `normal` and r... |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
length | Computes the length of `self`. |
as_u64vec2 | Casts all elements of `self` to `u64`. |
angle_to | Returns the angle of rotation (in radians) from `self` to `rhs` in the range `[-π, +π]`. The inputs do not need to be unit vectors however they must be non-zero. |
as_dvec2 | Casts all elements of `self` to `f64`. |
div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. |
to_array | `[x, y]` |
is_normalized | Returns whether `self` is length `1.0` or not. Uses a precision threshold of approximately `1e-4`. |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
abs | Returns a vector containing the absolute value of each element of `self`. |
ceil | Returns a vector containing the smallest integer greater than or equal to a number for each elemen... |
dot | Computes the dot product of `self` and `rhs`. |
from_angle | Creates a 2D vector containing `[angle.cos(), angle.sin()]`. This can be used in conjunction with the [`rotate()`]... |
rem-1 | No Documentation 🚧 |
add-2 | No Documentation 🚧 |
add-1 | No Documentation 🚧 |
recip | Returns a vector containing the reciprocal `1.0/n` of each element of `self`. |
distance | Computes the Euclidean distance between two points in space. |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
from_array | Creates a new vector from an array. |
midpoint | Calculates the midpoint between `self` and `rhs`. The midpoint is the average of, or halfway point... |
div-1 | No Documentation 🚧 |
as_i64vec2 | Casts all elements of `self` to `i64`. |
extend | Creates a 3D vector from `self` and the given `z` value. |
reflect | Returns the reflection vector for a given incident vector `self` and surface normal `normal`. `normal`... |
new | Creates a new vector. |
lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0`... |
project_onto_normalized | Returns the vector projection of `self` onto `rhs`. `rhs` must be normalized. # Panics Will pani... |
div | No Documentation 🚧 |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
rotate | Returns `rhs` rotated by the angle of `self`. If `self` is normalized, then this just rotation. Th... |
move_towards | Moves towards `rhs` based on the value `d`. When `d` is `0.0`, the result will be equal to `self`.... |
neg | No Documentation 🚧 |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. [Euclidean division... |
normalize_or | Returns `self` normalized to length 1.0 if possible, else returns a fallback value. In particular... |
normalize | Returns `self` normalized to length 1.0. For valid results, `self` must be finite and _not_ of len... |
round | Returns a vector containing the nearest integer to a number for each element of `self`. Round half... |
rem | No Documentation 🚧 |
normalize_or_zero | Returns `self` normalized to length 1.0 if possible, else returns zero. In particular, if the inpu... |
rotate_towards | Rotates towards `rhs` up to `max_angle` (in radians). When `max_angle` is `0.0`, the result will b... |
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(), ...]... |
copysign | Returns a vector with signs of `rhs` and the magnitudes of `self`. |
sub-2 | No Documentation 🚧 |
length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive... |
with_x | Creates a 2D vector from `self` with the given value of `x`. |
exp | Returns a vector containing `e^self` (the exponential function) for each element of `self`. |
add | No Documentation 🚧 |
as_ivec2 | Casts all elements of `self` to `i32`. |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
distance_squared | Compute the squared euclidean distance between two points in space. |
clamp_length | Returns a vector with a length no less than `min` and no more than `max`. # Panics Will panic if `min`... |
is_nan | Returns `true` if any elements are `NaN`. |
powf | Returns a vector containing each element of `self` raised to the power of `n`. |
eq | No Documentation 🚧 |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
clamp_length_max | Returns a vector with a length no more than `max`. # Panics Will panic if `max` is negative when `glam_assert` is enabled. |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
length_squared | Computes the squared length of `self`. This is faster than `length()` as it avoids a square root o... |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
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. |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
mul | No Documentation 🚧 |
clamp | Component-wise clamping of values, similar to [`f32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
mul-1 | No Documentation 🚧 |
splat | Creates a vector with all elements set to `v`. |
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. Using `mul_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. |
clamp_length_min | Returns a vector with a length no less than `min`. # Panics Will panic if `min` is negative when `glam_assert` is enabled. |
sub-1 | No Documentation 🚧 |
floor | Returns a vector containing the largest integer less than or equal to a number for each element of... |
sub | No Documentation 🚧 |
rem-2 | No Documentation 🚧 |
reject_from_normalized | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
is_negative_bitmask | Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. A negat... |
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(), ...]... |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
reject_from | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
perp | Returns a vector that is equal to `self` rotated by 90 degrees. |
signum | Returns a vector with elements representing the sign of `self`. - `1.0` if the number is positive,... |
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
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
as_uvec2
Casts all elements of
self
tou32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
with_y
Creates a 2D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
angle_between
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Name | Type | Documentation |
---|---|---|
mask | BVec2 | No Documentation 🚧 |
if_true | Vec2 | No Documentation 🚧 |
if_false | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
trunc
Returns a vector containing the integer part each element of
self
. This means numbers are always truncated towards zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
normal | Vec2 | No Documentation 🚧 |
eta | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
length
Computes the length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
as_u64vec2
Casts all elements of
self
tou64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
as_dvec2
Casts all elements of
self
tof64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec2 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
to_array
[x, y]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f32; 2] | No Documentation 🚧 |
is_normalized
Returns whether
self
is length1.0
or not. Uses a precision threshold of approximately1e-4
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Name | Type | Documentation |
---|---|---|
angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
recip
Returns a vector containing the reciprocal
1.0/n
of each element ofself
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
distance
Computes the Euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [f32; 2] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
as_i64vec2
Casts all elements of
self
toi64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec2 | No Documentation 🚧 |
extend
Creates a 3D vector from
self
and the givenz
value.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
. [Euclidean division]: f32::rem_euclid
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
rhs | Vec2 | No Documentation 🚧 |
max_angle | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
copysign
Returns a vector with signs of
rhs
and the magnitudes ofself
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
with_x
Creates a 2D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
exp
Returns a vector containing
e^self
(the exponential function) for each element ofself
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
as_ivec2
Casts all elements of
self
toi32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec2 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
rhs | Vec2 | No Documentation 🚧 |
max_abs_diff | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
powf
Returns a vector containing each element of
self
raised to the power ofn
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
. This is faster thanlength()
as it avoids a square root operation.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
min | Vec2 | No Documentation 🚧 |
max | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec2 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
perp
Returns a vector that is equal to
self
rotated by 90 degrees.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec2 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
Vec3
Vec3
- x:f32
- y:f32
- z:f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
as_u64vec3 | Casts all elements of `self` to `u64`. |
trunc | Returns a vector containing the integer part each element of `self`. This means numbers are always... |
mul-2 | No Documentation 🚧 |
reflect | Returns the reflection vector for a given incident vector `self` and surface normal `normal`. `normal`... |
recip | Returns a vector containing the reciprocal `1.0/n` of each element of `self`. |
fract_gl | Returns a vector containing the fractional part of the vector as `self - self.floor()`. Note that ... |
as_i64vec3 | Casts all elements of `self` to `i64`. |
new | Creates a new vector. |
signum | Returns a vector with elements representing the sign of `self`. - `1.0` if the number is positive,... |
distance | Computes the Euclidean distance between two points in space. |
project_onto | Returns the vector projection of `self` onto `rhs`. `rhs` must be of non-zero length. # Panics W... |
neg | No Documentation 🚧 |
add-1 | No Documentation 🚧 |
div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
move_towards | Moves towards `rhs` based on the value `d`. When `d` is `0.0`, the result will be equal to `self`.... |
powf | Returns a vector containing each element of `self` raised to the power of `n`. |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
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. Using `mul_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. |
sub-1 | No Documentation 🚧 |
reject_from_normalized | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
mul | No Documentation 🚧 |
with_y | Creates a 3D vector from `self` with the given value of `y`. |
clone | No Documentation 🚧 |
to_array | `[x, y, z]` |
splat | Creates a vector with all elements set to `v`. |
is_negative_bitmask | Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. A negat... |
from_array | Creates a new vector from an array. |
exp | Returns a vector containing `e^self` (the exponential function) for each element of `self`. |
floor | Returns a vector containing the largest integer less than or equal to a number for each element of... |
normalize_or | Returns `self` normalized to length 1.0 if possible, else returns a fallback value. In particular... |
clamp | Component-wise clamping of values, similar to [`f32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
normalize_or_zero | Returns `self` normalized to length 1.0 if possible, else returns zero. In particular, if the inpu... |
project_onto_normalized | Returns the vector projection of `self` onto `rhs`. `rhs` must be normalized. # Panics Will pani... |
clamp_length_max | Returns a vector with a length no more than `max`. # Panics Will panic if `max` is negative when `glam_assert` is enabled. |
dot | Computes the dot product of `self` and `rhs`. |
midpoint | Calculates the midpoint between `self` and `rhs`. The midpoint is the average of, or halfway point... |
as_dvec3 | Casts all elements of `self` to `f64`. |
round | Returns a vector containing the nearest integer to a number for each element of `self`. Round half... |
length | Computes the length of `self`. |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
eq | No Documentation 🚧 |
copysign | Returns a vector with signs of `rhs` and the magnitudes of `self`. |
is_nan | Returns `true` if any elements are `NaN`. |
is_normalized | Returns whether `self` is length `1.0` or not. Uses a precision threshold of approximately `1e-4`. |
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(), ...]... |
ceil | Returns a vector containing the smallest integer greater than or equal to a number for each elemen... |
length_squared | Computes the squared length of `self`. This is faster than `length()` as it avoids a square root o... |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
add | No Documentation 🚧 |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
distance_squared | Compute the squared euclidean distance between two points in space. |
length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
any_orthogonal_vector | Returns some vector that is orthogonal to the given one. The input vector must be finite and non-z... |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
cross | Computes the cross product of `self` and `rhs`. |
with_z | Creates a 3D vector from `self` with the given value of `z`. |
div | No Documentation 🚧 |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
as_ivec3 | Casts all elements of `self` to `i32`. |
any_orthonormal_vector | Returns any unit vector that is orthogonal to the given one. The input vector must be unit length.... |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
clamp_length | Returns a vector with a length no less than `min` and no more than `max`. # Panics Will panic if `min`... |
abs | Returns a vector containing the absolute value of each element of `self`. |
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. |
rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. [Euclidean division... |
rem-1 | No Documentation 🚧 |
mul-1 | No Documentation 🚧 |
refract | Returns the refraction direction for a given incident vector `self`, surface normal `normal` and r... |
clamp_length_min | Returns a vector with a length no less than `min`. # Panics Will panic if `min` is negative when `glam_assert` is enabled. |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive... |
rem | No Documentation 🚧 |
with_x | Creates a 3D vector from `self` with the given value of `x`. |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
add-2 | No Documentation 🚧 |
div-1 | No Documentation 🚧 |
sub | No Documentation 🚧 |
extend | Creates a 4D vector from `self` and the given `w` value. |
reject_from | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
sub-2 | No Documentation 🚧 |
as_uvec3 | Casts all elements of `self` to `u32`. |
fract | Returns a vector containing the fractional part of the vector as `self - self.trunc()`. Note that ... |
div-2 | No Documentation 🚧 |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
rem-2 | 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(), ...]... |
normalize | Returns `self` normalized to length 1.0. For valid results, `self` must be finite and _not_ of len... |
lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0`... |
as_u64vec3
Casts all elements of
self
tou64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
trunc
Returns a vector containing the integer part each element of
self
. This means numbers are always truncated towards zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
recip
Returns a vector containing the reciprocal
1.0/n
of each element ofself
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
as_i64vec3
Casts all elements of
self
toi64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
distance
Computes the Euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
powf
Returns a vector containing each element of
self
raised to the power ofn
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
with_y
Creates a 3D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f32; 3] | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [f32; 3] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
exp
Returns a vector containing
e^self
(the exponential function) for each element ofself
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
min | Vec3 | No Documentation 🚧 |
max | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
as_dvec3
Casts all elements of
self
tof64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
length
Computes the length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
copysign
Returns a vector with signs of
rhs
and the magnitudes ofself
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
is_normalized
Returns whether
self
is length1.0
or not. Uses a precision threshold of approximately1e-4
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
. This is faster thanlength()
as it avoids a square root operation.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
rhs | Vec3 | No Documentation 🚧 |
max_abs_diff | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec2 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
cross
Computes the cross product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
with_z
Creates a 3D vector from
self
with the given value ofz
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | No Documentation 🚧 |
as_ivec3
Casts all elements of
self
toi32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
. [Euclidean division]: f32::rem_euclid
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
normal | Vec3 | No Documentation 🚧 |
eta | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
with_x
Creates a 3D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
extend
Creates a 4D vector from
self
and the givenw
value.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
as_uvec3
Casts all elements of
self
tou32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
mask | BVec3 | No Documentation 🚧 |
if_true | Vec3 | No Documentation 🚧 |
if_false | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec3 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3 | No Documentation 🚧 |
Vec3A
Vec3A
- x:f32
- y:f32
- z:f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
as_i64vec3 | Casts all elements of `self` to `i64`. |
to_array | `[x, y, z]` |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
dot | Computes the dot product of `self` and `rhs`. |
add-1 | No Documentation 🚧 |
any_orthogonal_vector | Returns some vector that is orthogonal to the given one. The input vector must be finite and non-z... |
with_z | Creates a 3D vector from `self` with the given value of `z`. |
normalize_or | Returns `self` normalized to length 1.0 if possible, else returns a fallback value. In particular... |
is_negative_bitmask | Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. A negat... |
midpoint | Calculates the midpoint between `self` and `rhs`. The midpoint is the average of, or halfway point... |
rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. [Euclidean division... |
truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
fract | Returns a vector containing the fractional part of the vector as `self - self.trunc()`. Note that ... |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
rem | 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. Using `mul_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. |
project_onto | Returns the vector projection of `self` onto `rhs`. `rhs` must be of non-zero length. # Panics W... |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
length | Computes the length of `self`. |
lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0`... |
cross | Computes the cross product of `self` and `rhs`. |
length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
floor | Returns a vector containing the largest integer less than or equal to a number for each element of... |
as_u64vec3 | Casts all elements of `self` to `u64`. |
new | Creates a new vector. |
project_onto_normalized | Returns the vector projection of `self` onto `rhs`. `rhs` must be normalized. # Panics Will pani... |
length_squared | Computes the squared length of `self`. This is faster than `length()` as it avoids a square root o... |
reflect | Returns the reflection vector for a given incident vector `self` and surface normal `normal`. `normal`... |
sub | No Documentation 🚧 |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
move_towards | Moves towards `rhs` based on the value `d`. When `d` is `0.0`, the result will be equal to `self`.... |
from_array | Creates a new vector from an array. |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
clone | No Documentation 🚧 |
powf | Returns a vector containing each element of `self` raised to the power of `n`. |
as_dvec3 | Casts all elements of `self` to `f64`. |
trunc | Returns a vector containing the integer part each element of `self`. This means numbers are always... |
div-2 | No Documentation 🚧 |
exp | Returns a vector containing `e^self` (the exponential function) for each element of `self`. |
reject_from | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
is_nan | Returns `true` if any elements are `NaN`. |
div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. |
as_uvec3 | Casts all elements of `self` to `u32`. |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
clamp | Component-wise clamping of values, similar to [`f32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
mul-1 | No Documentation 🚧 |
with_x | Creates a 3D vector from `self` with the given value of `x`. |
any_orthonormal_vector | Returns any unit vector that is orthogonal to the given one. The input vector must be unit length.... |
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(), ...]... |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive... |
clamp_length_max | Returns a vector with a length no more than `max`. # Panics Will panic if `max` is negative when `glam_assert` is enabled. |
refract | Returns the refraction direction for a given incident vector `self`, surface normal `normal` and r... |
distance | Computes the Euclidean distance between two points in space. |
neg | No Documentation 🚧 |
sub-2 | No Documentation 🚧 |
add-2 | No Documentation 🚧 |
abs | Returns a vector containing the absolute value of each element of `self`. |
recip | Returns a vector containing the reciprocal `1.0/n` of each element of `self`. |
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(), ...]... |
add | No Documentation 🚧 |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
mul-2 | No Documentation 🚧 |
rem-1 | No Documentation 🚧 |
div | No Documentation 🚧 |
normalize | Returns `self` normalized to length 1.0. For valid results, `self` must be finite and _not_ of len... |
distance_squared | Compute the squared euclidean distance between two points in space. |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
fract_gl | Returns a vector containing the fractional part of the vector as `self - self.floor()`. Note that ... |
clamp_length | Returns a vector with a length no less than `min` and no more than `max`. # Panics Will panic if `min`... |
copysign | Returns a vector with signs of `rhs` and the magnitudes of `self`. |
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. |
ceil | Returns a vector containing the smallest integer greater than or equal to a number for each elemen... |
rem-2 | No Documentation 🚧 |
splat | Creates a vector with all elements set to `v`. |
eq | No Documentation 🚧 |
div-1 | No Documentation 🚧 |
signum | Returns a vector with elements representing the sign of `self`. - `1.0` if the number is positive,... |
round | Returns a vector containing the nearest integer to a number for each element of `self`. Round half... |
with_y | Creates a 3D vector from `self` with the given value of `y`. |
normalize_or_zero | Returns `self` normalized to length 1.0 if possible, else returns zero. In particular, if the inpu... |
reject_from_normalized | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
mul | No Documentation 🚧 |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
is_normalized | Returns whether `self` is length `1.0` or not. Uses a precision threshold of approximately `1e-4`. |
clamp_length_min | Returns a vector with a length no less than `min`. # Panics Will panic if `min` is negative when `glam_assert` is enabled. |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
extend | Creates a 4D vector from `self` and the given `w` value. |
sub-1 | No Documentation 🚧 |
from_vec4 | Creates a [`Vec3A`] from the `x`, `y` and `z` elements of `self` discarding `w`. On architectures where SIMD is supported such as SSE2 on `x86_64` this conversion is a noop. |
as_ivec3 | Casts all elements of `self` to `i32`. |
as_i64vec3
Casts all elements of
self
toi64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec3 | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f32; 3] | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
with_z
Creates a 3D vector from
self
with the given value ofz
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
. [Euclidean division]: f32::rem_euclid
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3A | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
a | Vec3A | No Documentation 🚧 |
b | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
rhs | Vec3A | No Documentation 🚧 |
max_abs_diff | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3A | No Documentation 🚧 |
length
Computes the length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
rhs | Vec3A | No Documentation 🚧 |
s | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
cross
Computes the cross product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
as_u64vec3
Casts all elements of
self
tou64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec3 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
length_squared
Computes the squared length of
self
. This is faster thanlength()
as it avoids a square root operation.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3A | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
rhs | Vec3A | No Documentation 🚧 |
d | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [f32; 3] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3A | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
powf
Returns a vector containing each element of
self
raised to the power ofn
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
as_dvec3
Casts all elements of
self
tof64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec3 | No Documentation 🚧 |
trunc
Returns a vector containing the integer part each element of
self
. This means numbers are always truncated towards zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
exp
Returns a vector containing
e^self
(the exponential function) for each element ofself
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
as_uvec3
Casts all elements of
self
tou32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec3 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3A | 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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
min | Vec3A | No Documentation 🚧 |
max | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3A | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
with_x
Creates a 3D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3A | 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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
normal | Vec3A | No Documentation 🚧 |
eta | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
distance
Computes the Euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
recip
Returns a vector containing the reciprocal
1.0/n
of each element ofself
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | 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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec3A | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
mask | BVec3A | No Documentation 🚧 |
if_true | Vec3A | No Documentation 🚧 |
if_false | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
min | f32 | No Documentation 🚧 |
max | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
copysign
Returns a vector with signs of
rhs
and the magnitudes ofself
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
with_y
Creates a 3D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
is_normalized
Returns whether
self
is length1.0
or not. Uses a precision threshold of approximately1e-4
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
extend
Creates a 4D vector from
self
and the givenw
value.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
v | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec3A | No Documentation 🚧 |
as_ivec3
Casts all elements of
self
toi32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec3A | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec3 | No Documentation 🚧 |
Vec4
Vec4
- x:f32
- y:f32
- z:f32
- w:f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
is_nan | Returns `true` if any elements are `NaN`. |
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(), ...]... |
to_array | `[x, y, z, w]` |
cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
div | No Documentation 🚧 |
cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
as_i64vec4 | Casts all elements of `self` to `i64`. |
move_towards | Moves towards `rhs` based on the value `d`. When `d` is `0.0`, the result will be equal to `self`.... |
new | Creates a new vector. |
rem-2 | No Documentation 🚧 |
cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
as_uvec4 | Casts all elements of `self` to `u32`. |
add | No Documentation 🚧 |
rem | No Documentation 🚧 |
floor | Returns a vector containing the largest integer less than or equal to a number for each element of... |
sub-1 | No Documentation 🚧 |
distance | Computes the Euclidean distance between two points in space. |
div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. |
copysign | Returns a vector with signs of `rhs` and the magnitudes of `self`. |
is_normalized | Returns whether `self` is length `1.0` or not. Uses a precision threshold of approximately `1e-4`. |
dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
clamp_length_min | Returns a vector with a length no less than `min`. # Panics Will panic if `min` is negative when `glam_assert` is enabled. |
div-2 | No Documentation 🚧 |
exp | Returns a vector containing `e^self` (the exponential function) for each element of `self`. |
with_w | Creates a 4D vector from `self` with the given value of `w`. |
eq | No Documentation 🚧 |
element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
sub-2 | No Documentation 🚧 |
rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. [Euclidean division... |
clone | No Documentation 🚧 |
from_array | Creates a new vector from an array. |
normalize | Returns `self` normalized to length 1.0. For valid results, `self` must be finite and _not_ of len... |
add-1 | No Documentation 🚧 |
as_ivec4 | Casts all elements of `self` to `i32`. |
truncate | Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. Truncation to [`Vec3`]... |
fract_gl | Returns a vector containing the fractional part of the vector as `self - self.floor()`. Note that ... |
is_negative_bitmask | Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. A negat... |
div-1 | No Documentation 🚧 |
splat | Creates a vector with all elements set to `v`. |
max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
rem-1 | No Documentation 🚧 |
normalize_or_zero | Returns `self` normalized to length 1.0 if possible, else returns zero. In particular, if the inpu... |
recip | Returns a vector containing the reciprocal `1.0/n` of each element of `self`. |
reject_from_normalized | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
project_onto | Returns the vector projection of `self` onto `rhs`. `rhs` must be of non-zero length. # Panics W... |
length | Computes the length of `self`. |
refract | Returns the refraction direction for a given incident vector `self`, surface normal `normal` and r... |
is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive... |
element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
midpoint | Calculates the midpoint between `self` and `rhs`. The midpoint is the average of, or halfway point... |
signum | Returns a vector with elements representing the sign of `self`. - `1.0` if the number is positive,... |
clamp_length | Returns a vector with a length no less than `min` and no more than `max`. # Panics Will panic if `min`... |
with_z | Creates a 4D vector from `self` with the given value of `z`. |
cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
mul-1 | 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. Using `mul_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. |
mul | No Documentation 🚧 |
length_squared | Computes the squared length of `self`. This is faster than `length()` as it avoids a square root o... |
add-2 | No Documentation 🚧 |
as_dvec4 | Casts all elements of `self` to `f64`. |
neg | No Documentation 🚧 |
cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
reject_from | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
as_u64vec4 | Casts all elements of `self` to `u64`. |
distance_squared | Compute the squared euclidean distance between two points in space. |
dot | Computes the dot product of `self` and `rhs`. |
abs | Returns a vector containing the absolute value of each element of `self`. |
lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0`... |
with_x | Creates a 4D vector from `self` with the given value of `x`. |
abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
reflect | Returns the reflection vector for a given incident vector `self` and surface normal `normal`. `normal`... |
round | Returns a vector containing the nearest integer to a number for each element of `self`. Round half... |
with_y | Creates a 4D vector from `self` with the given value of `y`. |
mul-2 | No Documentation 🚧 |
sub | 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(), ...]... |
clamp | Component-wise clamping of values, similar to [`f32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
trunc | Returns a vector containing the integer part each element of `self`. This means numbers are always... |
fract | Returns a vector containing the fractional part of the vector as `self - self.trunc()`. Note that ... |
clamp_length_max | Returns a vector with a length no more than `max`. # Panics Will panic if `max` is negative when `glam_assert` is enabled. |
project_onto_normalized | Returns the vector projection of `self` onto `rhs`. `rhs` must be normalized. # Panics Will pani... |
min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
normalize_or | Returns `self` normalized to length 1.0 if possible, else returns a fallback value. In particular... |
powf | Returns a vector containing each element of `self` raised to the power of `n`. |
ceil | Returns a vector containing the smallest integer greater than or equal to a number for each elemen... |
min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
is_nan
Returns
true
if any elements areNaN
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4A | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [f32; 4] | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4A | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4A | No Documentation 🚧 |
as_i64vec4
Casts all elements of
self
toi64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | I64Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Name | Type | Documentation |
---|---|---|
x | f32 | No Documentation 🚧 |
y | f32 | No Documentation 🚧 |
z | f32 | No Documentation 🚧 |
w | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4A | No Documentation 🚧 |
as_uvec4
Casts all elements of
self
tou32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | UVec4 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
distance
Computes the Euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
self
byrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
copysign
Returns a vector with signs of
rhs
and the magnitudes ofself
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
is_normalized
Returns whether
self
is length1.0
or not. Uses a precision threshold of approximately1e-4
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
exp
Returns a vector containing
e^self
(the exponential function) for each element ofself
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
with_w
Creates a 4D vector from
self
with the given value ofw
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
element_product
Returns the product of all elements of
self
. In other words, this computesself.x * self.y * ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
self
byrhs
. [Euclidean division]: f32::rem_euclid
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
Name | Type | Documentation |
---|---|---|
a | [f32; 4] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
as_ivec4
Casts all elements of
self
toi32
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | IVec4 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u32 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v
.
Arguments
Name | Type | Documentation |
---|---|---|
v | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
recip
Returns a vector containing the reciprocal
1.0/n
of each element ofself
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
length
Computes the length of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
normal | Vec4 | No Documentation 🚧 |
eta | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self
. In other words, this computesself.x + self.y + ..
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Name | Type | Documentation |
---|---|---|
mask | BVec4A | No Documentation 🚧 |
if_true | Vec4 | No Documentation 🚧 |
if_false | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
with_z
Creates a 4D vector from
self
with the given value ofz
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4A | No Documentation 🚧 |
length_recip
Computes
1.0 / length()
. For valid results,self
must not be of length zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
length_squared
Computes the squared length of
self
. This is faster thanlength()
as it avoids a square root operation.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
as_dvec4
Casts all elements of
self
tof64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | DVec4 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4A | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
as_u64vec4
Casts all elements of
self
tou64
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | U64Vec4 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
dot
Computes the dot product of
self
andrhs
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
with_x
Creates a 4D vector from
self
with the given value ofx
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
rhs | Vec4 | No Documentation 🚧 |
max_abs_diff | f32 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
with_y
Creates a 4D vector from
self
with the given value ofy
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | 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
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4A | 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
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
min | Vec4 | No Documentation 🚧 |
max | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | BVec4A | No Documentation 🚧 |
trunc
Returns a vector containing the integer part each element of
self
. This means numbers are always truncated towards zero.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self
. In other words this computesmin(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | 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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
powf
Returns a vector containing each element of
self
raised to the power ofn
.
Arguments
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Vec4 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self
. In other words this computesmax(x, y, ..)
.
Arguments
Name | Type | Documentation |
---|---|---|
_self | Vec4 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | f32 | No Documentation 🚧 |
SmolStr
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
is_heap_allocated | No Documentation 🚧 |
eq | No Documentation 🚧 |
is_empty | No Documentation 🚧 |
to_string | No Documentation 🚧 |
len | No Documentation 🚧 |
clone | No Documentation 🚧 |
is_heap_allocated
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | SmolStr | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
is_empty
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | SmolStr | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
to_string
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | SmolStr | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | String | No Documentation 🚧 |
len
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | SmolStr | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | usize | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | SmolStr | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | SmolStr | No Documentation 🚧 |
Uuid
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Function | Summary |
---|---|
to_bytes_le | Returns the bytes of the UUID in little-endian order. The bytes will be flipped to convert into li... |
assert_receiver_is_total_eq | No Documentation 🚧 |
to_u128_le | Returns a 128bit little-endian value containing the value. The bytes in the `u128` will be flipped... |
get_node_id | If the UUID is the correct version (v1, or v6) this will return the node value as a 6-byte array. ... |
as_u128 | Returns a 128bit value containing the value. The bytes in the UUID will be packed directly into a `u128`... |
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`]... |
is_nil | Tests if the UUID is nil (all zeros). |
eq | 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(), ); ``` |
max | The 'max UUID' (all ones). The max UUID is a special form of UUID that is specified to have all 1... |
as_u64_pair | Returns two 64bit values containing the value. The bytes in the UUID will be split into two `u64`.... |
from_u128_le | Creates a UUID from a 128bit value in little-endian order. The entire value will be flipped to con... |
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(()) # } ``` |
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_... |
is_max | Tests if the UUID is max (all ones). |
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(), ); `... |
nil | The 'nil UUID' (all zeros). The nil UUID is a special form of UUID that is specified to have all ... |
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()); ``` |
from_bytes_le | Creates a UUID using the supplied bytes in little endian order. The individual fields encoded in t... |
get_version_num | Returns the version number of the UUID. This represents the algorithm used to generate the value. ... |
clone | 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
Name | Type | Documentation |
---|---|---|
_self | Uuid | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [u8; 16] | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Uuid | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | () | 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
Name | Type | Documentation |
---|---|---|
_self | Uuid | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u128 | 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
Name | Type | Documentation |
---|---|---|
_self | Uuid | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Optional<[u8; 6]> | No Documentation 🚧 |
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
Name | Type | Documentation |
---|---|---|
_self | Uuid | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | u128 | 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
Name | Type | Documentation |
---|---|---|
arg0 | Uuid | No Documentation 🚧 |
is_nil
Tests if the UUID is nil (all zeros).
Arguments
Name | Type | Documentation |
---|---|---|
_self | Uuid | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Name | Type | Documentation |
---|---|---|
v | u128 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Uuid | 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
Name | Type | Documentation |
---|---|---|
arg0 | Uuid | 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
Name | Type | Documentation |
---|---|---|
_self | Uuid | No Documentation 🚧 |
Returns
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
Name | Type | Documentation |
---|---|---|
v | u128 | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Uuid | 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
Name | Type | Documentation |
---|---|---|
bytes | [u8; 16] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
arg0 | [u8; 45] | No Documentation 🚧 |
is_max
Tests if the UUID is max (all ones).
Arguments
Name | Type | Documentation |
---|---|---|
_self | Uuid | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | bool | 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
Returns
Name | Type | Documentation |
---|---|---|
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
Name | Type | Documentation |
---|---|---|
arg0 | Uuid | 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
Name | Type | Documentation |
---|---|---|
_self | Uuid | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | [u8; 16] | 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
Name | Type | Documentation |
---|---|---|
b | [u8; 16] | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Uuid | 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
Name | Type | Documentation |
---|---|---|
_self | Uuid | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | usize | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
Name | Type | Documentation |
---|---|---|
_self | Uuid | No Documentation 🚧 |
Returns
Name | Type | Documentation |
---|---|---|
arg0 | Uuid | No Documentation 🚧 |
DynamicFunctionMut
Opaque Type. 🔒
Description
A dynamic mutable script function.
Associated Functions
For function details and documentation, click on the function link.
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
Associated Functions
For function details and documentation, click on the function link.
PathBuf
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
String
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Focus
Focus
- core::option::Option<bevy_ecs::entity::Entity>
Description
Resource representing which entity has keyboard focus, if any.
Associated Functions
For function details and documentation, click on the function link.
ActiveAnimation
ActiveAnimation
- weight:f32
- repeat:bevy_animation::RepeatAnimation
- speed:f32
- elapsed:f32
- seek_time:f32
- last_seek_time:core::option::Option
- completions:u32
- just_completed:bool
- paused:bool
Description
An animation that an [
AnimationPlayer
] is currently either playing or was playing, but is presently paused.An stopped animation is considered no longer active.
Associated Functions
For function details and documentation, click on the function link.
AnimationClip
AnimationClip
- events:bevy_utils::hashbrown::HashMap<bevy_animation::AnimationEventTarget, alloc::vec::Vec<bevy_animation::TimedAnimationEvent>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>
- duration:f32
Description
A list of [
VariableCurve
]s and the [AnimationTargetId
]s to which they apply.Because animation clips refer to targets by UUID, they can target any [
AnimationTarget
] with that ID.
Associated Functions
For function details and documentation, click on the function link.
AnimationEvent
AnimationEvent
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
AnimationEventTarget
Root
Node
- bevy_animation::AnimationTargetId
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
AnimationPlayer
AnimationPlayer
- active_animations:bevy_utils::hashbrown::HashMap<petgraph::graph::NodeIndex, bevy_animation::ActiveAnimation, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>
- blend_weights:bevy_utils::hashbrown::HashMap<petgraph::graph::NodeIndex, f32, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>
Description
Animation controls.
Automatically added to any root animations of a scene when it is spawned.
Associated Functions
For function details and documentation, click on the function link.
AnimationTarget
AnimationTarget
- id:bevy_animation::AnimationTargetId
- player:bevy_ecs::entity::Entity
Description
An entity that can be animated by an [
AnimationPlayer
].These are frequently referred to as bones or joints, because they often refer to individually-animatable parts of an armature.
Asset loaders for armatures are responsible for adding these as necessary. Typically, they're generated from hashed versions of the entire name path from the root of the armature to the bone. See the [
AnimationTargetId
] documentation for more details.By convention, asset loaders add [
AnimationTarget
] components to the descendants of an [AnimationPlayer
], as well as to the [AnimationPlayer
] entity itself, but Bevy doesn't require this in any way. So, for example, it's entirely possible for an [AnimationPlayer
] to animate a target that it isn't an ancestor of. If you add a new bone to or delete a bone from an armature at runtime, you may want to update the [AnimationTarget
] component as appropriate, as Bevy won't do this automatically.Note that each entity can only be animated by one animation player at a time. However, you can change [
AnimationTarget
]'splayer
property at runtime to change which player is responsible for animating the entity.
Associated Functions
For function details and documentation, click on the function link.
AnimationTargetId
AnimationTargetId
- uuid::Uuid
Description
A unique UUID for an animation target (e.g. bone in a skinned mesh).
The [
AnimationClip
] asset and the [AnimationTarget
] component both use this to refer to targets (e.g. bones in a skinned mesh) to be animated.When importing an armature or an animation clip, asset loaders typically use the full path name from the armature to the bone to generate these UUIDs. The ID is unique to the full path name and based only on the names. So, for example, any imported armature with a bone at the root named
Hips
will assign the same [AnimationTargetId
] to its root bone. Likewise, any imported animation clip that animates a root bone namedHips
will reference the same [AnimationTargetId
]. Any animation is playable on any armature as long as the bone names match, which allows for easy animation retargeting.Note that asset loaders generally use the full path name to generate the [
AnimationTargetId
]. Thus a bone namedChest
directly connected to a bone namedHips
will have a different ID from a bone namedChest
that's connected to a bone namedStomach
.
Associated Functions
For function details and documentation, click on the function link.
RepeatAnimation
Never
Count
- u32
Forever
Description
Repetition behavior of an animation.
Associated Functions
For function details and documentation, click on the function link.
TimedAnimationEvent
TimedAnimationEvent
- time:f32
- event:bevy_animation::AnimationEvent
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
AnimationGraph
AnimationGraph
- graph:petgraph::graph::DiGraph<bevy_animation::graph::AnimationGraphNode, (), u32>
- root:petgraph::graph::NodeIndex
- mask_groups:bevy_utils::hashbrown::HashMap<bevy_animation::AnimationTargetId, u64, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>
Description
A graph structure that describes how animation clips are to be blended together.
Applications frequently want to be able to play multiple animations at once and to fine-tune the influence that animations have on a skinned mesh. Bevy uses an animation graph to store this information. Animation graphs are a directed acyclic graph (DAG) that describes how animations are to be weighted and combined together. Every frame, Bevy evaluates the graph from the root and blends the animations together in a bottom-up fashion to produce the final pose.
There are three types of nodes: blend nodes, add nodes, and clip nodes, all of which can have an associated weight. Blend nodes and add nodes have no associated animation clip and combine the animations of their children according to those children's weights. Clip nodes specify an animation clip to play. When a graph is created, it starts with only a single blend node, the root node.
For example, consider the following graph:
┌────────────┐ │ │ │ Idle ├─────────────────────┐ │ │ │ └────────────┘ │ │ ┌────────────┐ │ ┌────────────┐ │ │ │ │ │ │ Run ├──┐ ├──┤ Root │ │ │ │ ┌────────────┐ │ │ │ └────────────┘ │ │ Blend │ │ └────────────┘ ├──┤ ├──┘ ┌────────────┐ │ │ 0.5 │ │ │ │ └────────────┘ │ Walk ├──┘ │ │ └────────────┘
In this case, assuming that Idle, Run, and Walk are all playing with weight 1.0, the Run and Walk animations will be equally blended together, then their weights will be halved and finally blended with the Idle animation. Thus the weight of Run and Walk are effectively half of the weight of Idle.
Nodes can optionally have a mask, a bitfield that restricts the set of animation targets that the node and its descendants affect. Each bit in the mask corresponds to a mask group, which is a set of animation targets (bones). An animation target can belong to any number of mask groups within the context of an animation graph.
When the appropriate bit is set in a node's mask, neither the node nor its descendants will animate any animation targets belonging to that mask group. That is, setting a mask bit to 1 disables the animation targets in that group. If an animation target belongs to multiple mask groups, masking any one of the mask groups that it belongs to will mask that animation target. (Thus an animation target will only be animated if all of its mask groups are unmasked.)
A common use of masks is to allow characters to hold objects. For this, the typical workflow is to assign each character's hand to a mask group. Then, when the character picks up an object, the application masks out the hand that the object is held in for the character's animation set, then positions the hand's digits as necessary to grasp the object. The character's animations will continue to play but will not affect the hand, which will continue to be depicted as holding the object.
Animation graphs are assets and can be serialized to and loaded from RON files. Canonically, such files have an
.animgraph.ron
extension.The animation graph implements RFC 51. See that document for more information.
Associated Functions
For function details and documentation, click on the function link.
AnimationGraphHandle
AnimationGraphHandle
- bevy_asset::handle::Handle<bevy_animation::graph::AnimationGraph>
Description
A [
Handle
] to the [AnimationGraph
] to be used by theAnimationPlayer
on the same entity.
Associated Functions
For function details and documentation, click on the function link.
ThreadedAnimationGraph
ThreadedAnimationGraph
- threaded_graph:alloc::vec::Vecpetgraph::graph::NodeIndex
- sorted_edge_ranges:alloc::vec::Vec<core::ops::Range
> - sorted_edges:alloc::vec::Vecpetgraph::graph::NodeIndex
- computed_masks:alloc::vec::Vec
Description
An acceleration structure for an animation graph that allows Bevy to evaluate it quickly.
This is kept up to date as the associated [
AnimationGraph
] instance is added, modified, or removed.
Associated Functions
For function details and documentation, click on the function link.
ThreadedAnimationGraphs
ThreadedAnimationGraphs
- bevy_utils::hashbrown::HashMap<bevy_asset::id::AssetId<bevy_animation::graph::AnimationGraph>, bevy_animation::graph::ThreadedAnimationGraph, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>
Description
Acceleration structures for animation graphs that allows Bevy to evaluate them quickly.
These are kept up to date as [
AnimationGraph
] instances are added, modified, and removed.
Associated Functions
For function details and documentation, click on the function link.
AnimationTransition
AnimationTransition
- current_weight:f32
- weight_decline_per_sec:f32
- animation:petgraph::graph::NodeIndex
Description
An animation that is being faded out as part of a transition
Associated Functions
For function details and documentation, click on the function link.
AnimationTransitions
AnimationTransitions
- main_animation:core::option::Optionpetgraph::graph::NodeIndex
- transitions:alloc::vec::Vec<bevy_animation::transition::AnimationTransition>
Description
Manages fade-out of animation blend factors, allowing for smooth transitions between animations.
To use this component, place it on the same entity as the [
AnimationPlayer
] andAnimationGraphHandle
. It'll take responsibility for adjusting the weight on the [ActiveAnimation
] in order to fade out animations smoothly.When using an [
AnimationTransitions
] component, you should play all animations through the [AnimationTransitions::play
] method, rather than by directly manipulating the [AnimationPlayer
]. Playing animations through the [AnimationPlayer
] directly will cause the [AnimationTransitions
] component to get confused about which animation is the "main" animation, and transitions will usually be incorrect as a result.
Associated Functions
For function details and documentation, click on the function link.
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.
Associated Functions
For function details and documentation, click on the function link.
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.
Associated Functions
For function details and documentation, click on the function link.
RenderAssetUsages
Opaque Type. 🔒
Description
Defines where the asset will be used.
If an asset is set to the
RENDER_WORLD
but not theMAIN_WORLD
, the asset will be unloaded from the asset server once it's been extracted and prepared in the render world.Unloading the asset saves on memory, as for most cases it is no longer necessary to keep it in RAM once it's been uploaded to the GPU's VRAM. However, this means you can no longer access the asset from the CPU (via the
Assets<T>
resource) once unloaded (without re-loading it).If you never need access to the asset from the CPU past the first frame it's loaded on, or only need very infrequent access, then set this to
RENDER_WORLD
. Otherwise, set this toRENDER_WORLD | MAIN_WORLD
.If you have an asset that doesn't actually need to end up in the render world, like an Image that will be decoded into another Image asset, use
MAIN_WORLD
only.Platform-specific
On Wasm, it is not possible for now to free reserved memory. To control memory usage, load assets in sequence and unload one before loading the next. See this discussion about memory management for more details.
Associated Functions
For function details and documentation, click on the function link.
DefaultSpatialScale
DefaultSpatialScale
- bevy_audio::audio::SpatialScale
Description
The default scale factor applied to the positions of audio sources and listeners for spatial audio. Can be overridden for individual sounds in [
PlaybackSettings
].You may need to adjust this scale to fit your world's units.
Default is
Vec3::ONE
.
Associated Functions
For function details and documentation, click on the function link.
GlobalVolume
GlobalVolume
- volume:bevy_audio::audio::Volume
Description
Use this [
Resource
] to control the global volume of all audio.Note: changing this value will not affect already playing audio.
Associated Functions
For function details and documentation, click on the function link.
PlaybackMode
Once
Loop
Despawn
Remove
Description
The way Bevy manages the sound playback.
Associated Functions
For function details and documentation, click on the function link.
PlaybackSettings
PlaybackSettings
- mode:bevy_audio::audio::PlaybackMode
- volume:bevy_audio::audio::Volume
- speed:f32
- paused:bool
- spatial:bool
- spatial_scale:core::option::Option<bevy_audio::audio::SpatialScale>
Description
Initial settings to be used when audio starts playing.
If you would like to control the audio while it is playing, query for the [
AudioSink
][crate::AudioSink] or [SpatialAudioSink
][crate::SpatialAudioSink] components. Changes to this component will not be applied to already-playing audio.
Associated Functions
For function details and documentation, click on the function link.
SpatialListener
SpatialListener
- left_ear_offset:glam::Vec3
- right_ear_offset:glam::Vec3
Description
Settings for the listener for spatial audio sources.
This must be accompanied by
Transform
andGlobalTransform
. Only one entity with aSpatialListener
should be present at any given time.
Associated Functions
For function details and documentation, click on the function link.
SpatialScale
SpatialScale
- glam::Vec3
Description
A scale factor applied to the positions of audio sources and listeners for spatial audio.
Default is
Vec3::ONE
.
Associated Functions
For function details and documentation, click on the function link.
Volume
Volume
- f32
Description
A volume level equivalent to a non-negative float.
Associated Functions
For function details and documentation, click on the function link.
Color
Srgba
- bevy_color::srgba::Srgba
LinearRgba
- bevy_color::linear_rgba::LinearRgba
Hsla
- bevy_color::hsla::Hsla
Hsva
- bevy_color::hsva::Hsva
Hwba
- bevy_color::hwba::Hwba
Laba
- bevy_color::laba::Laba
Lcha
- bevy_color::lcha::Lcha
Oklaba
- bevy_color::oklaba::Oklaba
Oklcha
- bevy_color::oklcha::Oklcha
Xyza
- bevy_color::xyza::Xyza
Description
An enumerated type that can represent any of the color types in this crate.
This is useful when you need to store a color in a data structure that can't be generic over the color type.
Operations
[
Color
] supports all the standard color operations, such as mixing, luminance and hue adjustment, and diffing. These operations delegate to the concrete color space contained by [Color
], but will convert toOklch
for operations which aren't supported in the current space. After performing the operation, if a conversion was required, the result will be converted back into the original color space.#![allow(unused)] fn main() { use bevy_color::{Hue, Color}; let red_hsv = Color::hsv(0., 1., 1.); let red_srgb = Color::srgb(1., 0., 0.); // HSV has a definition of hue, so it will be returned. red_hsv.hue(); // SRGB doesn't have a native definition for hue. // Converts to Oklch and returns that result. red_srgb.hue(); }
Oklch
has been chosen as the intermediary space in cases where conversion is required due to its perceptual uniformity and broad support for Bevy's color operations. To avoid the cost of repeated conversion, and ensure consistent results where that is desired, first convert this [Color
] into your desired color space.
Associated Functions
For function details and documentation, click on the function link.
Hsla
Hsla
- hue:f32
- saturation:f32
- lightness:f32
- alpha:f32
Description
Color in Hue-Saturation-Lightness (HSL) color space with alpha. Further information on this color model can be found on Wikipedia.
Associated Functions
For function details and documentation, click on the function link.
Hsva
Hsva
- hue:f32
- saturation:f32
- value:f32
- alpha:f32
Description
Color in Hue-Saturation-Value (HSV) color space with alpha. Further information on this color model can be found on Wikipedia.
Associated Functions
For function details and documentation, click on the function link.
Hwba
Hwba
- hue:f32
- whiteness:f32
- blackness:f32
- alpha:f32
Description
Color in Hue-Whiteness-Blackness (HWB) color space with alpha. Further information on this color model can be found on Wikipedia.
Associated Functions
For function details and documentation, click on the function link.
Laba
Laba
- lightness:f32
- a:f32
- b:f32
- alpha:f32
Description
Color in LAB color space, with alpha
Associated Functions
For function details and documentation, click on the function link.
Lcha
Lcha
- lightness:f32
- chroma:f32
- hue:f32
- alpha:f32
Description
Color in LCH color space, with alpha
Associated Functions
For function details and documentation, click on the function link.
LinearRgba
LinearRgba
- red:f32
- green:f32
- blue:f32
- alpha:f32
Description
Linear RGB color with alpha.
Associated Functions
For function details and documentation, click on the function link.
Oklaba
Oklaba
- lightness:f32
- a:f32
- b:f32
- alpha:f32
Description
Color in Oklab color space, with alpha
Associated Functions
For function details and documentation, click on the function link.
Oklcha
Oklcha
- lightness:f32
- chroma:f32
- hue:f32
- alpha:f32
Description
Color in Oklch color space, with alpha
Associated Functions
For function details and documentation, click on the function link.
Srgba
Srgba
- red:f32
- green:f32
- blue:f32
- alpha:f32
Description
Non-linear standard RGB with alpha.
Associated Functions
For function details and documentation, click on the function link.
Xyza
Xyza
- x:f32
- y:f32
- z:f32
- alpha:f32
Description
CIE 1931 color space, also known as XYZ, with an alpha channel.
Associated Functions
For function details and documentation, click on the function link.
Bloom
Bloom
- intensity:f32
- low_frequency_boost:f32
- low_frequency_boost_curvature:f32
- high_pass_frequency:f32
- prefilter:bevy_core_pipeline::bloom::settings::BloomPrefilter
- composite_mode:bevy_core_pipeline::bloom::settings::BloomCompositeMode
- max_mip_dimension:u32
- uv_offset:f32
Description
Applies a bloom effect to an HDR-enabled 2d or 3d camera.
Bloom emulates an effect found in real cameras and the human eye, causing halos to appear around very bright parts of the scene.
See also https://en.wikipedia.org/wiki/Bloom_(shader_effect).
Usage Notes
Bloom is currently not compatible with WebGL2.
Often used in conjunction with
bevy_pbr::StandardMaterial::emissive
for 3d meshes.Bloom is best used alongside a tonemapping function that desaturates bright colors, such as [
crate::tonemapping::Tonemapping::TonyMcMapface
].Bevy's implementation uses a parametric curve to blend between a set of blurred (lower frequency) images generated from the camera's view. See https://starlederer.github.io/bloom/ for a visualization of the parametric curve used in Bevy as well as a visualization of the curve's respective scattering profile.
Associated Functions
For function details and documentation, click on the function link.
BloomCompositeMode
EnergyConserving
Additive
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
BloomPrefilter
BloomPrefilter
- threshold:f32
- threshold_softness:f32
Description
Applies a threshold filter to the input image to extract the brightest regions before blurring them and compositing back onto the original image. These settings are useful when emulating the 1990s-2000s game look.
Considerations
- Changing these settings creates a physically inaccurate image
- Changing these settings makes it easy to make the final result look worse
- Non-default prefilter settings should be used in conjunction with [
BloomCompositeMode::Additive
]
Associated Functions
For function details and documentation, click on the function link.
ContrastAdaptiveSharpening
ContrastAdaptiveSharpening
- enabled:bool
- sharpening_strength:f32
- denoise:bool
Description
Applies a contrast adaptive sharpening (CAS) filter to the camera.
CAS is usually used in combination with shader based anti-aliasing methods such as FXAA or TAA to regain some of the lost detail from the blurring that they introduce.
CAS is designed to adjust the amount of sharpening applied to different areas of an image based on the local contrast. This can help avoid over-sharpening areas with high contrast and under-sharpening areas with low contrast.
To use this, add the [
ContrastAdaptiveSharpening
] component to a 2D or 3D camera.
Associated Functions
For function details and documentation, click on the function link.
Camera2d
Camera2d
Description
A 2D camera component. Enables the 2D render graph for a [
Camera
].
Associated Functions
For function details and documentation, click on the function link.
Camera3d
Camera3d
- depth_load_op:bevy_core_pipeline::core_3d::camera_3d::Camera3dDepthLoadOp
- depth_texture_usages:bevy_core_pipeline::core_3d::camera_3d::Camera3dDepthTextureUsage
- screen_space_specular_transmission_steps:usize
- screen_space_specular_transmission_quality:bevy_core_pipeline::core_3d::camera_3d::ScreenSpaceTransmissionQuality
Description
A 3D camera component. Enables the main 3D render graph for a [
Camera
].The camera coordinate space is right-handed X-right, Y-up, Z-back. This means "forward" is -Z.
Associated Functions
For function details and documentation, click on the function link.
Camera3dDepthLoadOp
Clear
- f32
Load
Description
The depth clear operation to perform for the main 3d pass.
Associated Functions
For function details and documentation, click on the function link.
Camera3dDepthTextureUsage
Camera3dDepthTextureUsage
- u32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
ScreenSpaceTransmissionQuality
Low
Medium
High
Ultra
Description
The quality of the screen space transmission blur effect, applied to whatever's “behind” transmissive objects when their
roughness
is greater than0.0
.Higher qualities are more GPU-intensive.
Note: You can get better-looking results at any quality level by enabling TAA. See:
TemporalAntiAliasPlugin
.
Associated Functions
For function details and documentation, click on the function link.
DepthOfField
DepthOfField
- mode:bevy_core_pipeline::dof::DepthOfFieldMode
- focal_distance:f32
- sensor_height:f32
- aperture_f_stops:f32
- max_circle_of_confusion_diameter:f32
- max_depth:f32
Description
A component that enables a depth of field postprocessing effect when attached to a [
Camera3d
], simulating the focus of a camera lens.
Associated Functions
For function details and documentation, click on the function link.
DepthOfFieldMode
Bokeh
Gaussian
Description
Controls the appearance of the effect.
Associated Functions
For function details and documentation, click on the function link.
Fxaa
Fxaa
- enabled:bool
- edge_threshold:bevy_core_pipeline::fxaa::Sensitivity
- edge_threshold_min:bevy_core_pipeline::fxaa::Sensitivity
Description
A component for enabling Fast Approximate Anti-Aliasing (FXAA) for a [
bevy_render::camera::Camera
].
Associated Functions
For function details and documentation, click on the function link.
Sensitivity
Low
Medium
High
Ultra
Extreme
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
OrderIndependentTransparencySettings
OrderIndependentTransparencySettings
- layer_count:i32
- alpha_threshold:f32
Description
Used to identify which camera will use OIT to render transparent meshes and to configure OIT.
Associated Functions
For function details and documentation, click on the function link.
ChromaticAberration
ChromaticAberration
- color_lut:bevy_asset::handle::Handle<bevy_image::image::Image>
- intensity:f32
- max_samples:u32
Description
Adds colored fringes to the edges of objects in the scene.
Chromatic aberration simulates the effect when lenses fail to focus all colors of light toward a single point. It causes rainbow-colored streaks to appear, which are especially apparent on the edges of objects. Chromatic aberration is commonly used for collision effects, especially in horror games.
Bevy's implementation is based on that of Inside (Gjøl & Svendsen 2016). It's based on a customizable lookup texture, which allows for changing the color pattern. By default, the color pattern is simply a 3×1 pixel texture consisting of red, green, and blue, in that order, but you can change it to any image in order to achieve different effects.
Associated Functions
For function details and documentation, click on the function link.
DeferredPrepass
DeferredPrepass
Description
If added to a [
crate::prelude::Camera3d
] then deferred materials will be rendered to the deferred gbuffer texture and will be available to subsequent passes. Note the default deferred lighting plugin also requiresDepthPrepass
to work correctly.
Associated Functions
For function details and documentation, click on the function link.
DepthPrepass
DepthPrepass
Description
If added to a [
crate::prelude::Camera3d
] then depth values will be copied to a separate texture available to the main pass.
Associated Functions
For function details and documentation, click on the function link.
MotionVectorPrepass
MotionVectorPrepass
Description
If added to a [
crate::prelude::Camera3d
] then screen space motion vectors will be copied to a separate texture available to the main pass.
Associated Functions
For function details and documentation, click on the function link.
NormalPrepass
NormalPrepass
Description
If added to a [
crate::prelude::Camera3d
] then vertex world normals will be copied to a separate texture available to the main pass. Normals will have normal map textures already applied.
Associated Functions
For function details and documentation, click on the function link.
Smaa
Smaa
- preset:bevy_core_pipeline::smaa::SmaaPreset
Description
A component for enabling Subpixel Morphological Anti-Aliasing (SMAA) for a [
bevy_render::camera::Camera
].
Associated Functions
For function details and documentation, click on the function link.
SmaaPreset
Low
Medium
High
Ultra
Description
A preset quality level for SMAA.
Higher values are slower but result in a higher-quality image.
The default value is high.
Associated Functions
For function details and documentation, click on the function link.
DebandDither
Disabled
Enabled
Description
Enables a debanding shader that applies dithering to mitigate color banding in the final image for a given [
Camera
] entity.
Associated Functions
For function details and documentation, click on the function link.
Tonemapping
None
Reinhard
ReinhardLuminance
AcesFitted
AgX
SomewhatBoringDisplayTransform
TonyMcMapface
BlenderFilmic
Description
Optionally enables a tonemapping shader that attempts to map linear input stimulus into a perceptually uniform image for a given [
Camera
] entity.
Associated Functions
For function details and documentation, click on the function link.
SystemIdMarker
SystemIdMarker
Description
Marker
Component
for identifying [SystemId
] [Entity
]s.
Associated Functions
For function details and documentation, click on the function link.
OnAdd
OnAdd
Description
Trigger emitted when a component is added to an entity. See [
crate::component::ComponentHooks::on_add
] for more information.
Associated Functions
For function details and documentation, click on the function link.
OnInsert
OnInsert
Description
Trigger emitted when a component is inserted onto an entity. See [
crate::component::ComponentHooks::on_insert
] for more information.
Associated Functions
For function details and documentation, click on the function link.
OnRemove
OnRemove
Description
Trigger emitted when a component is removed from an entity. See [
crate::component::ComponentHooks::on_remove
] for more information.
Associated Functions
For function details and documentation, click on the function link.
OnReplace
OnReplace
Description
Trigger emitted when a component is replaced on an entity. See [
crate::component::ComponentHooks::on_replace
] for more information.
Associated Functions
For function details and documentation, click on the function link.
AabbGizmoConfigGroup
AabbGizmoConfigGroup
- draw_all:bool
- default_color:core::option::Option<bevy_color::color::Color>
Description
The [
GizmoConfigGroup
] used for debug visualizations of [Aabb
] components on entities
Associated Functions
For function details and documentation, click on the function link.
GizmoConfig
GizmoConfig
- enabled:bool
- line_width:f32
- line_perspective:bool
- line_style:bevy_gizmos::config::GizmoLineStyle
- depth_bias:f32
- render_layers:bevy_render::view::visibility::render_layers::RenderLayers
- line_joints:bevy_gizmos::config::GizmoLineJoint
Description
A struct that stores configuration for gizmos.
Associated Functions
For function details and documentation, click on the function link.
GizmoConfigStore
GizmoConfigStore
Description
A [
Resource
] storing [GizmoConfig
] and [GizmoConfigGroup
] structsUse
app.init_gizmo_group::<T>()
to register a custom config group.
Associated Functions
For function details and documentation, click on the function link.
GizmoLineJoint
None
Miter
Round
- u32
Bevel
Description
An enum configuring how line joints will be drawn.
Associated Functions
For function details and documentation, click on the function link.
GizmoLineStyle
Solid
Dotted
Description
An enum used to configure the style of gizmo lines, similar to CSS line-style
Associated Functions
For function details and documentation, click on the function link.
LightGizmoColor
Manual
- bevy_color::color::Color
Varied
MatchLightColor
ByLightType
Description
Configures how a color is attributed to a light gizmo.
Associated Functions
For function details and documentation, click on the function link.
LightGizmoConfigGroup
LightGizmoConfigGroup
- draw_all:bool
- color:bevy_gizmos::light::LightGizmoColor
- point_light_color:bevy_color::color::Color
- spot_light_color:bevy_color::color::Color
- directional_light_color:bevy_color::color::Color
Description
The [
GizmoConfigGroup
] used to configure the visualization of lights.
Associated Functions
For function details and documentation, click on the function link.
GltfExtras
GltfExtras
- value:String
Description
Additional untyped data that can be present on most glTF types at the primitive level.
Associated Functions
For function details and documentation, click on the function link.
GltfMaterialExtras
GltfMaterialExtras
- value:String
Description
Additional untyped data that can be present on most glTF types at the material level.
Associated Functions
For function details and documentation, click on the function link.
GltfMaterialName
GltfMaterialName
- String
Description
The material name of a glTF primitive.
Associated Functions
For function details and documentation, click on the function link.
GltfMeshExtras
GltfMeshExtras
- value:String
Description
Additional untyped data that can be present on most glTF types at the mesh level.
Associated Functions
For function details and documentation, click on the function link.
GltfSceneExtras
GltfSceneExtras
- value:String
Description
Additional untyped data that can be present on most glTF types at the scene level.
Associated Functions
For function details and documentation, click on the function link.
Image
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
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.
Associated Functions
For function details and documentation, click on the function link.
Indices
U16
- alloc::vec::Vec
U32
- alloc::vec::Vec
Description
An array of indices into the
VertexAttributeValues
for a mesh.It describes the order in which the vertex attributes should be joined into faces.
Associated Functions
For function details and documentation, click on the function link.
Mesh
Mesh
- indices:core::option::Option<bevy_mesh::index::Indices>
- morph_targets:core::option::Option<bevy_asset::handle::Handle<bevy_image::image::Image>>
- morph_target_names:core::option::Option<alloc::vec::Vecalloc::string::String>
- asset_usage:bevy_asset::render_asset::RenderAssetUsages
Description
A 3D object made out of vertices representing triangles, lines, or points, with "attribute" values for each vertex.
Meshes can be automatically generated by a bevy
AssetLoader
(generally by loading aGltf
file), or by converting a primitive usinginto
. It is also possible to create one manually. They can be edited after creation.Meshes can be rendered with a
Mesh2d
andMeshMaterial2d
orMesh3d
andMeshMaterial3d
for 2D and 3D respectively.A [
Mesh
] in Bevy is equivalent to a "primitive" in the glTF format, for a glTF Mesh representation, seeGltfMesh
.Manual creation
The following function will construct a flat mesh, to be rendered with a
StandardMaterial
orColorMaterial
:# use bevy_mesh::{Mesh, Indices, PrimitiveTopology}; # use bevy_asset::RenderAssetUsages; fn create_simple_parallelogram() -> Mesh { // Create a new mesh using a triangle list topology, where each set of 3 vertices composes a triangle. Mesh::new(PrimitiveTopology::TriangleList, RenderAssetUsages::default()) // Add 4 vertices, each with its own position attribute (coordinate in // 3D space), for each of the corners of the parallelogram. .with_inserted_attribute( Mesh::ATTRIBUTE_POSITION, vec![[0.0, 0.0, 0.0], [1.0, 2.0, 0.0], [2.0, 2.0, 0.0], [1.0, 0.0, 0.0]] ) // Assign a UV coordinate to each vertex. .with_inserted_attribute( Mesh::ATTRIBUTE_UV_0, vec![[0.0, 1.0], [0.5, 0.0], [1.0, 0.0], [0.5, 1.0]] ) // Assign normals (everything points outwards) .with_inserted_attribute( Mesh::ATTRIBUTE_NORMAL, vec![[0.0, 0.0, 1.0], [0.0, 0.0, 1.0], [0.0, 0.0, 1.0], [0.0, 0.0, 1.0]] ) // After defining all the vertices and their attributes, build each triangle using the // indices of the vertices that make it up in a counter-clockwise order. .with_inserted_indices(Indices::U32(vec![ // First triangle 0, 3, 1, // Second triangle 1, 3, 2 ])) }
You can see how it looks like here, used in a
Mesh3d
with a square bevy logo texture, with added axis, points, lines and text for clarity.Other examples
For further visualization, explanation, and examples, see the built-in Bevy examples, and the implementation of the built-in shapes. In particular, generate_custom_mesh teaches you to access and modify the attributes of a [
Mesh
] after creating it.Common points of confusion
- UV maps in Bevy start at the top-left, see
ATTRIBUTE_UV_0
, other APIs can have other conventions,OpenGL
starts at bottom-left.- It is possible and sometimes useful for multiple vertices to have the same position attribute value, it's a common technique in 3D modeling for complex UV mapping or other calculations.
- Bevy performs frustum culling based on the
Aabb
of meshes, which is calculated and added automatically for new meshes only. If a mesh is modified, the entity'sAabb
needs to be updated manually or deleted so that it is re-calculated.Use with
StandardMaterial
To render correctly with
StandardMaterial
, a mesh needs to have properly defined:
UVs
: Bevy needs to know how to map a texture onto the mesh (also true forColorMaterial
).Normals
: Bevy needs to know how light interacts with your mesh. [0.0, 0.0, 1.0] is very common for simple flat meshes on the XY plane, because simple meshes are smooth and they don't require complex light calculations.- Vertex winding order: by default,
StandardMaterial.cull_mode
isSome(Face::Back)
, which means that Bevy would only render the "front" of each triangle, which is the side of the triangle from where the vertices appear in a counter-clockwise order.
Associated Functions
For function details and documentation, click on the function link.
MeshMorphWeights
MeshMorphWeights
- weights:alloc::vec::Vec
Description
Control a specific [
Mesh
] instance's morph targets. These control the weights of specific "mesh primitives" in scene formats like GLTF. They can be set manually, but in most cases they should "automatically" synced by setting the [MorphWeights
] component on a parent entity.See [
MorphWeights
] for more details on Bevy's morph target implementation.Add this to an [
Entity
] with aMesh3d
with a [MorphAttributes
] set to control individual weights of each morph target.
Associated Functions
For function details and documentation, click on the function link.
MorphWeights
MorphWeights
- weights:alloc::vec::Vec
- first_mesh:core::option::Option<bevy_asset::handle::Handle<bevy_mesh::mesh::Mesh>>
Description
Controls the morph targets for all child
Mesh3d
entities. In most cases, [MorphWeights
] should be considered the "source of truth" when writing morph targets for meshes. However you can choose to write child [MeshMorphWeights
] if your situation requires more granularity. Just note that if you set [MorphWeights
], it will overwrite child [MeshMorphWeights
] values.This exists because Bevy's [
Mesh
] corresponds to a single surface / material, whereas morph targets as defined in the GLTF spec exist on "multi-primitive meshes" (where each primitive is its own surface with its own material). Therefore in Bevy [MorphWeights
] an a parent entity are the "canonical weights" from a GLTF perspective, which then synchronized to childMesh3d
/ [MeshMorphWeights
] (which correspond to "primitives" / "surfaces" from a GLTF perspective).Add this to the parent of one or more
Entities
with aMesh3d
with a [MeshMorphWeights
].
Associated Functions
For function details and documentation, click on the function link.
SkinnedMesh
SkinnedMesh
- inverse_bindposes:bevy_asset::handle::Handle<bevy_mesh::skinning::SkinnedMeshInverseBindposes>
- joints:alloc::vec::Vec<bevy_ecs::entity::Entity>
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Namespace
Global
OnType
- core::any::TypeId
Description
A namespace for functions
Associated Functions
For function details and documentation, click on the function link.
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.
Associated Functions
For function details and documentation, click on the function link.
FunctionArgInfo
FunctionArgInfo
- name:core::option::Option<alloc::borrow::Cow
> - arg_index:usize
- type_id:core::any::TypeId
Description
Information about a function argument.
Associated Functions
For function details and documentation, click on the function link.
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.
Associated Functions
For function details and documentation, click on the function link.
FunctionReturnInfo
FunctionReturnInfo
- type_id:core::any::TypeId
Description
Information about a function return value.
Associated Functions
For function details and documentation, click on the function link.
InteropError
Opaque Type. 🔒
Description
An error thrown when interoperating with scripting languages.
Associated Functions
For function details and documentation, click on the function link.
CascadesVisibleEntities
CascadesVisibleEntities
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
CubemapVisibleEntities
CubemapVisibleEntities
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
VisibleMeshEntities
VisibleMeshEntities
Description
Collection of mesh entities visible for 3D lighting.
This component contains all mesh entities visible from the current light view. The collection is updated automatically by [
crate::SimulationLightSystems
].
Associated Functions
For function details and documentation, click on the function link.
ClusterConfig
None
Single
XYZ
- dimensions:glam::UVec3
- z_config:bevy_pbr::cluster::ClusterZConfig
- dynamic_resizing:bool
FixedZ
- total:u32
- z_slices:u32
- z_config:bevy_pbr::cluster::ClusterZConfig
- dynamic_resizing:bool
Description
Configuration of the clustering strategy for clustered forward rendering
Associated Functions
For function details and documentation, click on the function link.
ClusterFarZMode
MaxClusterableObjectRange
Constant
- f32
Description
Configure the far z-plane mode used for the furthest depth slice for clustered forward rendering
Associated Functions
For function details and documentation, click on the function link.
ClusterZConfig
ClusterZConfig
- first_slice_depth:f32
- far_z_mode:bevy_pbr::cluster::ClusterFarZMode
Description
Configure the depth-slicing strategy for clustered forward rendering
Associated Functions
For function details and documentation, click on the function link.
DistanceFog
DistanceFog
- color:bevy_color::color::Color
- directional_light_color:bevy_color::color::Color
- directional_light_exponent:f32
- falloff:bevy_pbr::fog::FogFalloff
Description
Configures the “classic” computer graphics distance fog effect, in which objects appear progressively more covered in atmospheric haze the further away they are from the camera. Affects meshes rendered via the PBR
StandardMaterial
.Falloff
The rate at which fog intensity increases with distance is controlled by the falloff mode. Currently, the following fog falloff modes are supported:
- [
FogFalloff::Linear
]- [
FogFalloff::Exponential
]- [
FogFalloff::ExponentialSquared
]- [
FogFalloff::Atmospheric
]Example
# use bevy_ecs::prelude::*; # use bevy_render::prelude::*; # use bevy_core_pipeline::prelude::*; # use bevy_pbr::prelude::*; # use bevy_color::Color; # fn system(mut commands: Commands) { commands.spawn(( // Setup your camera as usual Camera3d::default(), // Add fog to the same entity DistanceFog { color: Color::WHITE, falloff: FogFalloff::Exponential { density: 1e-3 }, ..Default::default() }, )); # } # bevy_ecs::system::assert_is_system(system);
Material Override
Once enabled for a specific camera, the fog effect can also be disabled for individual
StandardMaterial
instances via thefog_enabled
flag.
Associated Functions
For function details and documentation, click on the function link.
FogFalloff
Linear
- start:f32
- end:f32
Exponential
- density:f32
ExponentialSquared
- density:f32
Atmospheric
- extinction:glam::Vec3
- inscattering:glam::Vec3
Description
Allows switching between different fog falloff modes, and configuring their parameters.
Convenience Methods
When using non-linear fog modes it can be hard to determine the right parameter values for a given scene.
For easier artistic control, instead of creating the enum variants directly, you can use the visibility-based convenience methods:
For
FogFalloff::Exponential
:
- [
FogFalloff::from_visibility()
]- [
FogFalloff::from_visibility_contrast()
]For
FogFalloff::ExponentialSquared
:
- [
FogFalloff::from_visibility_squared()
]- [
FogFalloff::from_visibility_contrast_squared()
]For
FogFalloff::Atmospheric
:
- [
FogFalloff::from_visibility_color()
]- [
FogFalloff::from_visibility_colors()
]- [
FogFalloff::from_visibility_contrast_color()
]- [
FogFalloff::from_visibility_contrast_colors()
]
Associated Functions
For function details and documentation, click on the function link.
Cascade
Cascade
- world_from_cascade:glam::Mat4
- clip_from_cascade:glam::Mat4
- clip_from_world:glam::Mat4
- texel_size:f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
CascadeShadowConfig
CascadeShadowConfig
- bounds:alloc::vec::Vec
- overlap_proportion:f32
- minimum_distance:f32
Description
Controls how cascaded shadow mapping works. Prefer using [
CascadeShadowConfigBuilder
] to construct an instance.# use bevy_pbr::CascadeShadowConfig; # use bevy_pbr::CascadeShadowConfigBuilder; # use bevy_utils::default; # let config: CascadeShadowConfig = CascadeShadowConfigBuilder { maximum_distance: 100.0, ..default() }.into();
Associated Functions
For function details and documentation, click on the function link.
Cascades
Cascades
- cascades:bevy_utils::hashbrown::HashMap<bevy_ecs::entity::Entity, alloc::vec::Vec<bevy_pbr::light::Cascade>, bevy_ecs::entity::hash::EntityHash>
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
DirectionalLightShadowMap
DirectionalLightShadowMap
- size:usize
Description
Controls the resolution of [
DirectionalLight
] shadow maps.
Associated Functions
For function details and documentation, click on the function link.
NotShadowCaster
NotShadowCaster
Description
Add this component to make a [
Mesh3d
] not cast shadows.
Associated Functions
For function details and documentation, click on the function link.
NotShadowReceiver
NotShadowReceiver
Description
Add this component to make a [
Mesh3d
] not receive shadows.Note: If you're using diffuse transmission, setting [
NotShadowReceiver
] will cause both “regular” shadows as well as diffusely transmitted shadows to be disabled, even when [TransmittedShadowReceiver
] is being used.
Associated Functions
For function details and documentation, click on the function link.
PointLightShadowMap
PointLightShadowMap
- size:usize
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
ShadowFilteringMethod
Hardware2x2
Gaussian
Temporal
Description
Add this component to a
Camera3d
to control how to anti-alias shadow edges.The different modes use different approaches to Percentage Closer Filtering.
Associated Functions
For function details and documentation, click on the function link.
AmbientLight
AmbientLight
- color:bevy_color::color::Color
- brightness:f32
Description
An ambient light, which lights the entire scene equally.
This resource is inserted by the [
PbrPlugin
] and by default it is set to a low ambient light.Examples
Make ambient light slightly brighter:
# use bevy_ecs::system::ResMut; # use bevy_pbr::AmbientLight; fn setup_ambient_light(mut ambient_light: ResMut<AmbientLight>) { ambient_light.brightness = 100.0; }
Associated Functions
For function details and documentation, click on the function link.
DirectionalLight
DirectionalLight
- color:bevy_color::color::Color
- illuminance:f32
- shadows_enabled:bool
- shadow_depth_bias:f32
- shadow_normal_bias:f32
Description
A Directional light.
Directional lights don't exist in reality but they are a good approximation for light sources VERY far away, like the sun or the moon.
The light shines along the forward direction of the entity's transform. With a default transform this would be along the negative-Z axis.
Valid values for
illuminance
are:
Illuminance (lux) Surfaces illuminated by 0.0001 Moonless, overcast night sky (starlight) 0.002 Moonless clear night sky with airglow 0.05–0.3 Full moon on a clear night 3.4 Dark limit of civil twilight under a clear sky 20–50 Public areas with dark surroundings 50 Family living room lights 80 Office building hallway/toilet lighting 100 Very dark overcast day 150 Train station platforms 320–500 Office lighting 400 Sunrise or sunset on a clear day. 1000 Overcast day; typical TV studio lighting 10,000–25,000 Full daylight (not direct sun) 32,000–100,000 Direct sunlight Source: Wikipedia
Shadows
To enable shadows, set the
shadows_enabled
property totrue
.Shadows are produced via cascaded shadow maps.
To modify the cascade setup, such as the number of cascades or the maximum shadow distance, change the [
CascadeShadowConfig
] component of the entity with the [DirectionalLight
].To control the resolution of the shadow maps, use the [
DirectionalLightShadowMap
] resource:# use bevy_app::prelude::*; # use bevy_pbr::DirectionalLightShadowMap; App::new() .insert_resource(DirectionalLightShadowMap { size: 2048 });
Associated Functions
For function details and documentation, click on the function link.
PointLight
PointLight
- color:bevy_color::color::Color
- intensity:f32
- range:f32
- radius:f32
- shadows_enabled:bool
- shadow_depth_bias:f32
- shadow_normal_bias:f32
- shadow_map_near_z:f32
Description
A light that emits light in all directions from a central point.
Real-world values for
intensity
(luminous power in lumens) based on the electrical power consumption of the type of real-world light are:
Luminous Power (lumen) (i.e. the intensity member) Incandescent non-halogen (Watts) Incandescent halogen (Watts) Compact fluorescent (Watts) LED (Watts) 200 25 3-5 3 450 40 29 9-11 5-8 800 60 13-15 8-12 1100 75 53 18-20 10-16 1600 100 72 24-28 14-17 2400 150 30-52 24-30 3100 200 49-75 32 4000 300 75-100 40.5 Source: Wikipedia
Associated Functions
For function details and documentation, click on the function link.
SpotLight
SpotLight
- color:bevy_color::color::Color
- intensity:f32
- range:f32
- radius:f32
- shadows_enabled:bool
- shadow_depth_bias:f32
- shadow_normal_bias:f32
- shadow_map_near_z:f32
- outer_angle:f32
- inner_angle:f32
Description
A light that emits light in a given direction from a central point.
Behaves like a point light in a perfectly absorbent housing that shines light only in a given direction. The direction is taken from the transform, and can be specified with
Transform::looking_at
.
Associated Functions
For function details and documentation, click on the function link.
LightProbe
LightProbe
Description
A marker component for a light probe, which is a cuboid region that provides global illumination to all fragments inside it.
Note that a light probe will have no effect unless the entity contains some kind of illumination, which can either be an [
EnvironmentMapLight
] or an [IrradianceVolume
].The light probe range is conceptually a unit cube (1×1×1) centered on the origin. The [
Transform
] applied to this entity can scale, rotate, or translate that cube so that it contains all fragments that should take this light probe into account.When multiple sources of indirect illumination can be applied to a fragment, the highest-quality one is chosen. Diffuse and specular illumination are considered separately, so, for example, Bevy may decide to sample the diffuse illumination from an irradiance volume and the specular illumination from a reflection probe. From highest priority to lowest priority, the ranking is as follows:
Rank Diffuse Specular 1 Lightmap Lightmap 2 Irradiance volume Reflection probe 3 Reflection probe View environment map 4 View environment map Note that ambient light is always added to the diffuse component and does not participate in the ranking. That is, ambient light is applied in addition to, not instead of, the light sources above.
A terminology note: Unfortunately, there is little agreement across game and graphics engines as to what to call the various techniques that Bevy groups under the term light probe. In Bevy, a light probe is the generic term that encompasses both reflection probes and irradiance volumes. In object-oriented terms, light probe is the superclass, and reflection probe and irradiance volume are subclasses. In other engines, you may see the term light probe refer to an irradiance volume with a single voxel, or perhaps some other technique, while in Bevy light probe refers not to a specific technique but rather to a class of techniques. Developers familiar with other engines should be aware of this terminology difference.
Associated Functions
For function details and documentation, click on the function link.
EnvironmentMapLight
EnvironmentMapLight
- diffuse_map:bevy_asset::handle::Handle<bevy_image::image::Image>
- specular_map:bevy_asset::handle::Handle<bevy_image::image::Image>
- intensity:f32
- rotation:glam::Quat
Description
A pair of cubemap textures that represent the surroundings of a specific area in space.
See [
crate::environment_map
] for detailed information.
Associated Functions
For function details and documentation, click on the function link.
IrradianceVolume
IrradianceVolume
- voxels:bevy_asset::handle::Handle<bevy_image::image::Image>
- intensity:f32
Description
The component that defines an irradiance volume.
See [
crate::irradiance_volume
] for detailed information.
Associated Functions
For function details and documentation, click on the function link.
DefaultOpaqueRendererMethod
DefaultOpaqueRendererMethod
- bevy_pbr::material::OpaqueRendererMethod
Description
Default render method used for opaque materials.
Associated Functions
For function details and documentation, click on the function link.
OpaqueRendererMethod
Forward
Deferred
Auto
Description
Render method used for opaque materials.
The forward rendering main pass draws each mesh entity and shades it according to its corresponding material and the lights that affect it. Some render features like Screen Space Ambient Occlusion require running depth and normal prepasses, that are 'deferred'-like prepasses over all mesh entities to populate depth and normal textures. This means that when using render features that require running prepasses, multiple passes over all visible geometry are required. This can be slow if there is a lot of geometry that cannot be batched into few draws.
Deferred rendering runs a prepass to gather not only geometric information like depth and normals, but also all the material properties like base color, emissive color, reflectance, metalness, etc, and writes them into a deferred 'g-buffer' texture. The deferred main pass is then a fullscreen pass that reads data from these textures and executes shading. This allows for one pass over geometry, but is at the cost of not being able to use MSAA, and has heavier bandwidth usage which can be unsuitable for low end mobile or other bandwidth-constrained devices.
If a material indicates
OpaqueRendererMethod::Auto
,DefaultOpaqueRendererMethod
will be used.
Associated Functions
For function details and documentation, click on the function link.
ParallaxMappingMethod
Occlusion
Relief
- max_steps:u32
Description
The parallax mapping method to use to compute depth based on the material's
depth_map
.Parallax Mapping uses a depth map texture to give the illusion of depth variation on a mesh surface that is geometrically flat.
See the
parallax_mapping.wgsl
shader code for implementation details and explanation of the methods used.
Associated Functions
For function details and documentation, click on the function link.
StandardMaterial
StandardMaterial
- base_color:bevy_color::color::Color
- base_color_channel:bevy_pbr::pbr_material::UvChannel
- base_color_texture:core::option::Option<bevy_asset::handle::Handle<bevy_image::image::Image>>
- emissive:bevy_color::linear_rgba::LinearRgba
- emissive_exposure_weight:f32
- emissive_channel:bevy_pbr::pbr_material::UvChannel
- emissive_texture:core::option::Option<bevy_asset::handle::Handle<bevy_image::image::Image>>
- perceptual_roughness:f32
- metallic:f32
- metallic_roughness_channel:bevy_pbr::pbr_material::UvChannel
- metallic_roughness_texture:core::option::Option<bevy_asset::handle::Handle<bevy_image::image::Image>>
- reflectance:f32
- diffuse_transmission:f32
- specular_transmission:f32
- thickness:f32
- ior:f32
- attenuation_distance:f32
- attenuation_color:bevy_color::color::Color
- normal_map_channel:bevy_pbr::pbr_material::UvChannel
- normal_map_texture:core::option::Option<bevy_asset::handle::Handle<bevy_image::image::Image>>
- flip_normal_map_y:bool
- occlusion_channel:bevy_pbr::pbr_material::UvChannel
- occlusion_texture:core::option::Option<bevy_asset::handle::Handle<bevy_image::image::Image>>
- clearcoat:f32
- clearcoat_perceptual_roughness:f32
- anisotropy_strength:f32
- anisotropy_rotation:f32
- double_sided:bool
- unlit:bool
- fog_enabled:bool
- alpha_mode:bevy_render::alpha::AlphaMode
- depth_bias:f32
- depth_map:core::option::Option<bevy_asset::handle::Handle<bevy_image::image::Image>>
- parallax_depth_scale:f32
- parallax_mapping_method:bevy_pbr::parallax::ParallaxMappingMethod
- max_parallax_layer_count:f32
- lightmap_exposure:f32
- opaque_render_method:bevy_pbr::material::OpaqueRendererMethod
- deferred_lighting_pass_id:u8
- uv_transform:glam::Affine2
Description
A material with "standard" properties used in PBR lighting Standard property values with pictures here https://google.github.io/filament/Material%20Properties.pdf.
May be created directly from a [
Color
] or an [Image
].
Associated Functions
For function details and documentation, click on the function link.
UvChannel
Uv0
Uv1
Description
An enum to define which UV attribute to use for a texture.
It is used for every texture in the [
StandardMaterial
]. It only supports two UV attributes, [bevy_render::mesh::Mesh::ATTRIBUTE_UV_0
] and [bevy_render::mesh::Mesh::ATTRIBUTE_UV_1
]. The default is [UvChannel::Uv0
].
Associated Functions
For function details and documentation, click on the function link.
ScreenSpaceAmbientOcclusion
ScreenSpaceAmbientOcclusion
- quality_level:bevy_pbr::ssao::ScreenSpaceAmbientOcclusionQualityLevel
- constant_object_thickness:f32
Description
Component to apply screen space ambient occlusion to a 3d camera.
Screen space ambient occlusion (SSAO) approximates small-scale, local occlusion of indirect diffuse light between objects, based on what's visible on-screen. SSAO does not apply to direct lighting, such as point or directional lights.
This darkens creases, e.g. on staircases, and gives nice contact shadows where objects meet, giving entities a more "grounded" feel.
Usage Notes
Requires that you add [
ScreenSpaceAmbientOcclusionPlugin
] to your app.It strongly recommended that you use SSAO in conjunction with TAA ([
bevy_core_pipeline::experimental::taa::TemporalAntiAliasing
]). Doing so greatly reduces SSAO noise.SSAO is not supported on
WebGL2
, and is not currently supported onWebGPU
.
Associated Functions
For function details and documentation, click on the function link.
ScreenSpaceAmbientOcclusionQualityLevel
Low
Medium
High
Ultra
Custom
- slice_count:u32
- samples_per_slice_side:u32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
ScreenSpaceReflections
ScreenSpaceReflections
- perceptual_roughness_threshold:f32
- thickness:f32
- linear_steps:u32
- linear_march_exponent:f32
- bisection_steps:u32
- use_secant:bool
Description
Add this component to a camera to enable screen-space reflections (SSR).
Screen-space reflections currently require deferred rendering in order to appear. Therefore, they also need the [
DepthPrepass
] and [DeferredPrepass
] components, which are inserted automatically.SSR currently performs no roughness filtering for glossy reflections, so only very smooth surfaces will reflect objects in screen space. You can adjust the
perceptual_roughness_threshold
in order to tune the threshold below which screen-space reflections will be traced.As with all screen-space techniques, SSR can only reflect objects on screen. When objects leave the camera, they will disappear from reflections. An alternative that doesn't suffer from this problem is the combination of a
LightProbe
and [EnvironmentMapLight
]. The advantage of SSR is that it can reflect all objects, not just static ones.SSR is an approximation technique and produces artifacts in some situations. Hand-tuning the settings in this component will likely be useful.
Screen-space reflections are presently unsupported on WebGL 2 because of a bug whereby Naga doesn't generate correct GLSL when sampling depth buffers, which is required for screen-space raymarching.
Associated Functions
For function details and documentation, click on the function link.
VolumetricFog
VolumetricFog
- ambient_color:bevy_color::color::Color
- ambient_intensity:f32
- jitter:f32
- step_count:u32
Description
When placed on a [
bevy_core_pipeline::core_3d::Camera3d
], enables volumetric fog and volumetric lighting, also known as light shafts or god rays.
Associated Functions
For function details and documentation, click on the function link.
VolumetricLight
VolumetricLight
Description
Add this component to a
DirectionalLight
with a shadow map (shadows_enabled: true
) to make volumetric fog interact with it.This allows the light to generate light shafts/god rays.
Associated Functions
For function details and documentation, click on the function link.
PickingBehavior
PickingBehavior
- should_block_lower:bool
- is_hoverable:bool
Description
An optional component that overrides default picking behavior for an entity, allowing you to make an entity non-hoverable, or allow items below it to be hovered. See the documentation on the fields for more details.
Associated Functions
For function details and documentation, click on the function link.
PickingPlugin
PickingPlugin
- is_enabled:bool
- is_input_enabled:bool
- is_focus_enabled:bool
Description
This plugin sets up the core picking infrastructure. It receives input events, and provides the shared types used by other picking plugins.
This plugin contains several settings, and is added to the wrold as a resource after initialization. You can configure picking settings at runtime through the resource.
Associated Functions
For function details and documentation, click on the function link.
HitData
HitData
- camera:bevy_ecs::entity::Entity
- depth:f32
- position:core::option::Optionglam::Vec3
- normal:core::option::Optionglam::Vec3
Description
Holds data from a successful pointer hit test. See [
HitData::depth
] for important details.
Associated Functions
For function details and documentation, click on the function link.
RayId
RayId
- camera:bevy_ecs::entity::Entity
- pointer:bevy_picking::pointer::PointerId
Description
Identifies a ray constructed from some (pointer, camera) combination. A pointer can be over multiple cameras, which is why a single pointer may have multiple rays.
Associated Functions
For function details and documentation, click on the function link.
PickingInteraction
Pressed
Hovered
None
Description
A component that aggregates picking interaction state of this entity across all pointers.
Unlike bevy's
Interaction
component, this is an aggregate of the state of all pointers interacting with this entity. Aggregation is done by taking the interaction with the highest precedence.For example, if we have an entity that is being hovered by one pointer, and pressed by another, the entity will be considered pressed. If that entity is instead being hovered by both pointers, it will be considered hovered.
Associated Functions
For function details and documentation, click on the function link.
PointerInputPlugin
PointerInputPlugin
- is_touch_enabled:bool
- is_mouse_enabled:bool
Description
Adds mouse and touch inputs for picking pointers to your app. This is a default input plugin, that you can replace with your own plugin as needed.
[
crate::PickingPlugin::is_input_enabled
] can be used to toggle whether the core picking plugin processes the inputs sent by this, or other input plugins, in one place.This plugin contains several settings, and is added to the world as a resource after initialization. You can configure pointer input settings at runtime by accessing the resource.
Associated Functions
For function details and documentation, click on the function link.
PointerId
Mouse
Touch
- u64
Custom
- uuid::Uuid
Description
Identifies a unique pointer entity.
Mouse
andTouch
pointers are automatically spawned.This component is needed because pointers can be spawned and despawned, but they need to have a stable ID that persists regardless of the Entity they are associated with.
Associated Functions
For function details and documentation, click on the function link.
PointerInteraction
PointerInteraction
- sorted_entities:alloc::vec::Vec<(bevy_ecs::entity::Entity, bevy_picking::backend::HitData)>
Description
Holds a list of entities this pointer is currently interacting with, sorted from nearest to farthest.
Associated Functions
For function details and documentation, click on the function link.
PointerLocation
PointerLocation
Description
Component that tracks a pointer's current [
Location
].
Associated Functions
For function details and documentation, click on the function link.
PointerPress
PointerPress
- primary:bool
- secondary:bool
- middle:bool
Description
Tracks the state of the pointer's buttons in response to [
PointerInput
] events.
Associated Functions
For function details and documentation, click on the function link.
AlphaMode
Opaque
Mask
- f32
Blend
Premultiplied
AlphaToCoverage
Add
Multiply
Description
Sets how a material's base color alpha channel is used for transparency.
Associated Functions
For function details and documentation, click on the function link.
Camera
Camera
- viewport:core::option::Option<bevy_render::camera::camera::Viewport>
- order:isize
- is_active:bool
- target:bevy_render::camera::camera::RenderTarget
- hdr:bool
- msaa_writeback:bool
- clear_color:bevy_render::camera::clear_color::ClearColorConfig
- sub_camera_view:core::option::Option<bevy_render::camera::camera::SubCameraView>
Description
The defining [
Component
] for camera entities, storing information about how and what to render through this camera.The [
Camera
] component is added to an entity to define the properties of the viewpoint from which rendering occurs. It defines the position of the view to render, the projection method to transform the 3D objects into a 2D image, as well as the render target into which that image is produced.Note that a [
Camera
] needs a [CameraRenderGraph
] to render anything. This is typically provided by adding aCamera2d
orCamera3d
component, but custom render graphs can also be defined. Inserting a [Camera
] with no render graph will emit an error at runtime.
Associated Functions
For function details and documentation, click on the function link.
CameraMainTextureUsages
Opaque Type. 🔒
Description
This component lets you control the [
TextureUsages
] field of the main texture generated for the camera
Associated Functions
For function details and documentation, click on the function link.
CameraRenderGraph
Opaque Type. 🔒
Description
Configures the
RenderGraph
name assigned to be run for a given [Camera
] entity.
Associated Functions
For function details and documentation, click on the function link.
Exposure
Opaque Type. 🔒
Description
How much energy a
Camera3d
absorbs from incoming light.
Associated Functions
For function details and documentation, click on the function link.
MipBias
MipBias
- f32
Description
Camera component specifying a mip bias to apply when sampling from material textures.
Often used in conjunction with antialiasing post-process effects to reduce textures blurriness.
Associated Functions
For function details and documentation, click on the function link.
RenderTarget
Window
- bevy_window::window::WindowRef
Image
- bevy_asset::handle::Handle<bevy_image::image::Image>
TextureView
- bevy_render::camera::manual_texture_view::ManualTextureViewHandle
Description
The "target" that a [
Camera
] will render to. For example, this could be a [Window
] swapchain or an [Image
].
Associated Functions
For function details and documentation, click on the function link.
SubCameraView
SubCameraView
- full_size:glam::UVec2
- offset:glam::Vec2
- size:glam::UVec2
Description
Settings to define a camera sub view.
When [
Camera::sub_camera_view
] isSome
, only the sub-section of the image defined bysize
andoffset
(relative to thefull_size
of the whole image) is projected to the cameras viewport.Take the example of the following multi-monitor setup:
┌───┬───┐ │ A │ B │ ├───┼───┤ │ C │ D │ └───┴───┘
If each monitor is 1920x1080, the whole image will have a resolution of 3840x2160. For each monitor we can use a single camera with a viewport of the same size as the monitor it corresponds to. To ensure that the image is cohesive, we can use a different sub view on each camera:
- Camera A:
full_size
= 3840x2160,size
= 1920x1080,offset
= 0,0- Camera B:
full_size
= 3840x2160,size
= 1920x1080,offset
= 1920,0- Camera C:
full_size
= 3840x2160,size
= 1920x1080,offset
= 0,1080- Camera D:
full_size
= 3840x2160,size
= 1920x1080,offset
= 1920,1080However since only the ratio between the values is important, they could all be divided by 120 and still produce the same image. Camera D would for example have the following values:
full_size
= 32x18,size
= 16x9,offset
= 16,9
Associated Functions
For function details and documentation, click on the function link.
TemporalJitter
TemporalJitter
- offset:glam::Vec2
Description
A subpixel offset to jitter a perspective camera's frustum by.
Useful for temporal rendering techniques.
Do not use with
OrthographicProjection
.
Associated Functions
For function details and documentation, click on the function link.
Viewport
Viewport
- physical_position:glam::UVec2
- physical_size:glam::UVec2
- depth:core::ops::Range
Description
Render viewport configuration for the [
Camera
] component.The viewport defines the area on the render target to which the camera renders its image. You can overlay multiple cameras in a single window using viewports to create effects like split screen, minimaps, and character viewers.
Associated Functions
For function details and documentation, click on the function link.
ClearColor
ClearColor
- bevy_color::color::Color
Description
A [
Resource
] that stores the color that is used to clear the screen between frames.This color appears as the "background" color for simple apps, when there are portions of the screen with nothing rendered.
Associated Functions
For function details and documentation, click on the function link.
ClearColorConfig
Default
Custom
- bevy_color::color::Color
None
Description
For a camera, specifies the color used to clear the viewport before rendering.
Associated Functions
For function details and documentation, click on the function link.
ManualTextureViewHandle
ManualTextureViewHandle
- u32
Description
A unique id that corresponds to a specific [
ManualTextureView
] in the [ManualTextureViews
] collection.
Associated Functions
For function details and documentation, click on the function link.
OrthographicProjection
OrthographicProjection
- near:f32
- far:f32
- viewport_origin:glam::Vec2
- scaling_mode:bevy_render::camera::projection::ScalingMode
- scale:f32
- area:bevy_math::rects::rect::Rect
Description
Project a 3D space onto a 2D surface using parallel lines, i.e., unlike [
PerspectiveProjection
], the size of objects remains the same regardless of their distance to the camera.The volume contained in the projection is called the view frustum. Since the viewport is rectangular and projection lines are parallel, the view frustum takes the shape of a cuboid.
Note that the scale of the projection and the apparent size of objects are inversely proportional. As the size of the projection increases, the size of objects decreases.
Examples
Configure the orthographic projection to one world unit per 100 window pixels:
# use bevy_render::camera::{OrthographicProjection, Projection, ScalingMode}; let projection = Projection::Orthographic(OrthographicProjection { scaling_mode: ScalingMode::WindowSize, scale: 0.01, ..OrthographicProjection::default_2d() });
Associated Functions
For function details and documentation, click on the function link.
PerspectiveProjection
PerspectiveProjection
- fov:f32
- aspect_ratio:f32
- near:f32
- far:f32
Description
A 3D camera projection in which distant objects appear smaller than close objects.
Associated Functions
For function details and documentation, click on the function link.
Projection
Perspective
- bevy_render::camera::projection::PerspectiveProjection
Orthographic
- bevy_render::camera::projection::OrthographicProjection
Description
A configurable [
CameraProjection
] that can select its projection type at runtime.
Associated Functions
For function details and documentation, click on the function link.
ScalingMode
WindowSize
Fixed
- width:f32
- height:f32
AutoMin
- min_width:f32
- min_height:f32
AutoMax
- max_width:f32
- max_height:f32
FixedVertical
- viewport_height:f32
FixedHorizontal
- viewport_width:f32
Description
Scaling mode for [
OrthographicProjection
].The effect of these scaling modes are combined with the [
OrthographicProjection::scale
] property.For example, if the scaling mode is
ScalingMode::Fixed { width: 100.0, height: 300 }
and the scale is2.0
, the projection will be 200 world units wide and 600 world units tall.Examples
Configure the orthographic projection to two world units per window height:
# use bevy_render::camera::{OrthographicProjection, Projection, ScalingMode}; let projection = Projection::Orthographic(OrthographicProjection { scaling_mode: ScalingMode::FixedVertical { viewport_height: 2.0 }, ..OrthographicProjection::default_2d() });
Associated Functions
For function details and documentation, click on the function link.
GlobalsUniform
GlobalsUniform
- time:f32
- delta_time:f32
- frame_count:u32
Description
Contains global values useful when writing shaders. Currently only contains values related to time.
Associated Functions
For function details and documentation, click on the function link.
Mesh2d
Mesh2d
- bevy_asset::handle::Handle<bevy_mesh::mesh::Mesh>
Description
A component for 2D meshes. Requires a
MeshMaterial2d
to be rendered, commonly using aColorMaterial
.Example
# use bevy_sprite::{ColorMaterial, Mesh2d, MeshMaterial2d}; # use bevy_ecs::prelude::*; # use bevy_render::mesh::Mesh; # use bevy_color::palettes::basic::RED; # use bevy_asset::Assets; # use bevy_math::primitives::Circle; # // Spawn an entity with a mesh using `ColorMaterial`. fn setup( mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>, mut materials: ResMut<Assets<ColorMaterial>>, ) { commands.spawn(( Mesh2d(meshes.add(Circle::new(50.0))), MeshMaterial2d(materials.add(ColorMaterial::from_color(RED))), )); }
Associated Functions
For function details and documentation, click on the function link.
Mesh3d
Mesh3d
- bevy_asset::handle::Handle<bevy_mesh::mesh::Mesh>
Description
A component for 3D meshes. Requires a
MeshMaterial3d
to be rendered, commonly using aStandardMaterial
.Example
# use bevy_pbr::{Material, MeshMaterial3d, StandardMaterial}; # use bevy_ecs::prelude::*; # use bevy_render::mesh::{Mesh, Mesh3d}; # use bevy_color::palettes::basic::RED; # use bevy_asset::Assets; # use bevy_math::primitives::Capsule3d; # // Spawn an entity with a mesh using `StandardMaterial`. fn setup( mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>, mut materials: ResMut<Assets<StandardMaterial>>, ) { commands.spawn(( Mesh3d(meshes.add(Capsule3d::default())), MeshMaterial3d(materials.add(StandardMaterial { base_color: RED.into(), ..Default::default() })), )); }
Associated Functions
For function details and documentation, click on the function link.
Aabb
Aabb
- center:glam::Vec3A
- half_extents:glam::Vec3A
Description
An axis-aligned bounding box, defined by:
- a center,
- the distances from the center to each faces along the axis, the faces are orthogonal to the axis.
It is typically used as a component on an entity to represent the local space occupied by this entity, with faces orthogonal to its local axis.
This component is notably used during "frustum culling", a process to determine if an entity should be rendered by a
Camera
if its bounding box intersects with the camera's [Frustum
].It will be added automatically by the systems in
CalculateBounds
to entities that:
- could be subject to frustum culling, for example with a
Mesh3d
orSprite
component,- don't have the
NoFrustumCulling
component.It won't be updated automatically if the space occupied by the entity changes, for example if the vertex positions of a
Mesh3d
are updated.
Associated Functions
For function details and documentation, click on the function link.
CascadesFrusta
CascadesFrusta
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
CubemapFrusta
CubemapFrusta
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Frustum
Frustum
Description
A region of 3D space defined by the intersection of 6 [
HalfSpace
]s.Frustums are typically an apex-truncated square pyramid (a pyramid without the top) or a cuboid.
Half spaces are ordered left, right, top, bottom, near, far. The normal vectors of the half-spaces point towards the interior of the frustum.
A frustum component is used on an entity with a
Camera
component to determine which entities will be considered for rendering by this camera. All entities with an [Aabb
] component that are not contained by (or crossing the boundary of) the frustum will not be rendered, and not be used in rendering computations.This process is called frustum culling, and entities can opt out of it using the
NoFrustumCulling
component.The frustum component is typically added automatically for cameras, either
Camera2d
orCamera3d
. It is usually updated automatically byupdate_frusta
from theCameraProjection
component andGlobalTransform
of the camera entity.
Associated Functions
For function details and documentation, click on the function link.
ShaderStorageBuffer
Opaque Type. 🔒
Description
A storage buffer that is prepared as a [
RenderAsset
] and uploaded to the GPU.
Associated Functions
For function details and documentation, click on the function link.
SyncToRenderWorld
SyncToRenderWorld
Description
Marker component that indicates that its entity needs to be synchronized to the render world.
This component is automatically added as a required component by
ExtractComponentPlugin
andSyncComponentPlugin
. For more information see [SyncWorldPlugin
].NOTE: This component should persist throughout the entity's entire lifecycle. If this component is removed from its entity, the entity will be despawned.
Associated Functions
For function details and documentation, click on the function link.
ColorGrading
ColorGrading
- global:bevy_render::view::ColorGradingGlobal
- shadows:bevy_render::view::ColorGradingSection
- midtones:bevy_render::view::ColorGradingSection
- highlights:bevy_render::view::ColorGradingSection
Description
Configures filmic color grading parameters to adjust the image appearance.
Color grading is applied just before tonemapping for a given
Camera
entity, with the sole exception of thepost_saturation
value in [ColorGradingGlobal
], which is applied after tonemapping.
Associated Functions
For function details and documentation, click on the function link.
ColorGradingGlobal
ColorGradingGlobal
- exposure:f32
- temperature:f32
- tint:f32
- hue:f32
- post_saturation:f32
- midtones_range:core::ops::Range
Description
Filmic color grading values applied to the image as a whole (as opposed to individual sections, like shadows and highlights).
Associated Functions
For function details and documentation, click on the function link.
ColorGradingSection
ColorGradingSection
- saturation:f32
- contrast:f32
- gamma:f32
- gain:f32
- lift:f32
Description
A section of color grading values that can be selectively applied to shadows, midtones, and highlights.
Associated Functions
For function details and documentation, click on the function link.
Msaa
Off
Sample2
Sample4
Sample8
Description
Component for configuring the number of samples for Multi-Sample Anti-Aliasing for a
Camera
.Defaults to 4 samples. A higher number of samples results in smoother edges.
Some advanced rendering features may require that MSAA is disabled.
Note that the web currently only supports 1 or 4 samples.
Associated Functions
For function details and documentation, click on the function link.
InheritedVisibility
InheritedVisibility
- bool
Description
Whether or not an entity is visible in the hierarchy. This will not be accurate until
VisibilityPropagate
runs in the [PostUpdate
] schedule.If this is false, then [
ViewVisibility
] should also be false.
Associated Functions
For function details and documentation, click on the function link.
NoFrustumCulling
NoFrustumCulling
Description
Use this component to opt-out of built-in frustum culling for entities, see [
Frustum
].It can be used for example:
- when a [
Mesh
] is updated but its [Aabb
] is not, which might happen with animations,- when using some light effects, like wanting a [
Mesh
] out of the [Frustum
] to appear in the reflection of a [Mesh
] within.
Associated Functions
For function details and documentation, click on the function link.
ViewVisibility
ViewVisibility
- bool
Description
Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering.
Each frame, this will be reset to
false
duringVisibilityPropagate
systems in [PostUpdate
]. Later in the frame, systems inCheckVisibility
will mark any visible entities using [ViewVisibility::set
]. Because of this, values of this type will be marked as changed every frame, even when they do not change.If you wish to add custom visibility system that sets this value, make sure you add it to the
CheckVisibility
set.
Associated Functions
For function details and documentation, click on the function link.
Visibility
Inherited
Hidden
Visible
Description
User indication of whether an entity is visible. Propagates down the entity hierarchy.
If an entity is hidden in this way, all [
Children
] (and all of their children and so on) who are set toInherited
will also be hidden.This is done by the
visibility_propagate_system
which uses the entity hierarchy andVisibility
to set the values of each entity's [InheritedVisibility
] component.
Associated Functions
For function details and documentation, click on the function link.
VisibleEntities
VisibleEntities
Description
Collection of entities visible from the current view.
This component contains all entities which are visible from the currently rendered view. The collection is updated automatically by the [
VisibilitySystems::CheckVisibility
] system set. Renderers can use the equivalent [RenderVisibleEntities
] to optimize rendering of a particular view, to prevent drawing items not visible from that view.This component is intended to be attached to the same entity as the [
Camera
] and the [Frustum
] defining the view.
Associated Functions
For function details and documentation, click on the function link.
VisibilityRange
VisibilityRange
- start_margin:core::ops::Range
- end_margin:core::ops::Range
- use_aabb:bool
Description
Specifies the range of distances that this entity must be from the camera in order to be rendered.
This is also known as hierarchical level of detail or HLOD.
Use this component when you want to render a high-polygon mesh when the camera is close and a lower-polygon mesh when the camera is far away. This is a common technique for improving performance, because fine details are hard to see in a mesh at a distance. To avoid an artifact known as popping between levels, each level has a margin, within which the object transitions gradually from invisible to visible using a dithering effect.
You can also use this feature to replace multiple meshes with a single mesh when the camera is distant. This is the reason for the term "hierarchical level of detail". Reducing the number of meshes can be useful for reducing drawcall count. Note that you must place the [
VisibilityRange
] component on each entity you want to be part of a LOD group, as [VisibilityRange
] isn't automatically propagated down to children.A typical use of this feature might look like this:
Entity start_margin
end_margin
Root N/A N/A ├─ High-poly mesh [0, 0) [20, 25) ├─ Low-poly mesh [20, 25) [70, 75) └─ Billboard imposter [70, 75) [150, 160) With this setup, the user will see a high-poly mesh when the camera is closer than 20 units. As the camera zooms out, between 20 units to 25 units, the high-poly mesh will gradually fade to a low-poly mesh. When the camera is 70 to 75 units away, the low-poly mesh will fade to a single textured quad. And between 150 and 160 units, the object fades away entirely. Note that the
end_margin
of a higher LOD is always identical to thestart_margin
of the next lower LOD; this is important for the crossfade effect to function properly.
Associated Functions
For function details and documentation, click on the function link.
RenderLayers
RenderLayers
- smallvec::SmallVec<[u64; 1]>
Description
Describes which rendering layers an entity belongs to.
Cameras with this component will only render entities with intersecting layers.
Entities may belong to one or more layers, or no layer at all.
The [
Default
] instance ofRenderLayers
contains layer0
, the first layer.An entity with this component without any layers is invisible.
Entities without this component belong to layer
0
.
Associated Functions
For function details and documentation, click on the function link.
Screenshot
Screenshot
- bevy_render::camera::camera::RenderTarget
Description
A component that signals to the renderer to capture a screenshot this frame.
This component should be spawned on a new entity with an observer that will trigger with [
ScreenshotCaptured
] when the screenshot is ready.Screenshots are captured asynchronously and may not be available immediately after the frame that the component is spawned on. The observer should be used to handle the screenshot when it is ready.
Note that the screenshot entity will be despawned after the screenshot is captured and the observer is triggered.
Usage
# use bevy_ecs::prelude::*; # use bevy_render::view::screenshot::{save_to_disk, Screenshot}; fn take_screenshot(mut commands: Commands) { commands.spawn(Screenshot::primary_window()) .observe(save_to_disk("screenshot.png")); }
Associated Functions
For function details and documentation, click on the function link.
ScreenshotCaptured
ScreenshotCaptured
- bevy_image::image::Image
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
DynamicSceneRoot
DynamicSceneRoot
- bevy_asset::handle::Handle<bevy_scene::dynamic_scene::DynamicScene>
Description
Adding this component will spawn the scene as a child of that entity. Once it's spawned, the entity will have a
SceneInstance
component.
Associated Functions
For function details and documentation, click on the function link.
SceneRoot
SceneRoot
- bevy_asset::handle::Handle<bevy_scene::scene::Scene>
Description
Adding this component will spawn the scene as a child of that entity. Once it's spawned, the entity will have a
SceneInstance
component.
Associated Functions
For function details and documentation, click on the function link.
SpriteSource
SpriteSource
Description
A component that marks entities that aren't themselves sprites but become sprites during rendering.
Right now, this is used for
Text
.
Associated Functions
For function details and documentation, click on the function link.
ColorMaterial
ColorMaterial
- color:bevy_color::color::Color
- alpha_mode:bevy_sprite::mesh2d::material::AlphaMode2d
- texture:core::option::Option<bevy_asset::handle::Handle<bevy_image::image::Image>>
Description
A 2d material that renders 2d meshes with a texture tinted by a uniform color
Associated Functions
For function details and documentation, click on the function link.
AlphaMode2d
Opaque
Mask
- f32
Blend
Description
Sets how a 2d material's base color alpha channel is used for transparency. Currently, this only works with [
Mesh2d
]. Sprites are always transparent.This is very similar to
AlphaMode
but this only applies to 2d meshes. We use a separate type because 2d doesn't support all the transparency modes that 3d does.
Associated Functions
For function details and documentation, click on the function link.
Anchor
Center
BottomLeft
BottomCenter
BottomRight
CenterLeft
CenterRight
TopLeft
TopCenter
TopRight
Custom
- glam::Vec2
Description
How a sprite is positioned relative to its [
Transform
]. It defaults toAnchor::Center
.
Associated Functions
For function details and documentation, click on the function link.
Sprite
Sprite
- image:bevy_asset::handle::Handle<bevy_image::image::Image>
- texture_atlas:core::option::Option<bevy_sprite::texture_atlas::TextureAtlas>
- color:bevy_color::color::Color
- flip_x:bool
- flip_y:bool
- custom_size:core::option::Optionglam::Vec2
- rect:core::option::Option<bevy_math::rects::rect::Rect>
- anchor:bevy_sprite::sprite::Anchor
- image_mode:bevy_sprite::sprite::SpriteImageMode
Description
Describes a sprite to be rendered to a 2D camera
Associated Functions
For function details and documentation, click on the function link.
SpriteImageMode
Auto
Sliced
- bevy_sprite::texture_slice::slicer::TextureSlicer
Tiled
- tile_x:bool
- tile_y:bool
- stretch_value:f32
Description
Controls how the image is altered when scaled.
Associated Functions
For function details and documentation, click on the function link.
TextureAtlas
TextureAtlas
- layout:bevy_asset::handle::Handle<bevy_sprite::texture_atlas::TextureAtlasLayout>
- index:usize
Description
An index into a [
TextureAtlasLayout
], which corresponds to a specific section of a texture.It stores a handle to [
TextureAtlasLayout
] and the index of the current section of the atlas. The texture atlas contains various sections of a given texture, allowing users to have a single image file for either sprite animation or global mapping. You can change the textureindex
of the atlas to animate the sprite or display only a section of the texture for efficient rendering of related game objects.Check the following examples for usage:
Associated Functions
For function details and documentation, click on the function link.
TextureAtlasLayout
TextureAtlasLayout
- size:glam::UVec2
- textures:alloc::vec::Vec<bevy_math::rects::urect::URect>
Description
Stores a map used to lookup the position of a texture in a [
TextureAtlas
]. This can be used to either use and look up a specific section of a texture, or animate frame-by-frame as a sprite sheet.Optionally it can store a mapping from sub texture handles to the related area index (see
TextureAtlasBuilder
).Example usage animating sprite. Example usage animating sprite in response to an event. Example usage loading sprite sheet.
Associated Functions
For function details and documentation, click on the function link.
BorderRect
BorderRect
- left:f32
- right:f32
- top:f32
- bottom:f32
Description
Struct defining a
Sprite
border with padding values
Associated Functions
For function details and documentation, click on the function link.
SliceScaleMode
Stretch
Tile
- stretch_value:f32
Description
Defines how a texture slice scales when resized
Associated Functions
For function details and documentation, click on the function link.
TextureSlicer
TextureSlicer
- border:bevy_sprite::texture_slice::border_rect::BorderRect
- center_scale_mode:bevy_sprite::texture_slice::slicer::SliceScaleMode
- sides_scale_mode:bevy_sprite::texture_slice::slicer::SliceScaleMode
- max_corner_scale:f32
Description
Slices a texture using the 9-slicing technique. This allows to reuse an image at various sizes without needing to prepare multiple assets. The associated texture will be split into nine portions, so that on resize the different portions scale or tile in different ways to keep the texture in proportion.
For example, when resizing a 9-sliced texture the corners will remain unscaled while the other sections will be scaled or tiled.
See 9-sliced textures.
Associated Functions
For function details and documentation, click on the function link.
ReflectableScheduleLabel
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
TextBounds
TextBounds
- width:core::option::Option
- height:core::option::Option
Description
The maximum width and height of text. The text will wrap according to the specified size.
Characters out of the bounds after wrapping will be truncated. Text is aligned according to the specified
JustifyText
.Note: only characters that are completely out of the bounds will be truncated, so this is not a reliable limit if it is necessary to contain the text strictly in the bounds. Currently this component is mainly useful for text wrapping only.
Associated Functions
For function details and documentation, click on the function link.
GlyphAtlasInfo
GlyphAtlasInfo
- texture:bevy_asset::handle::Handle<bevy_image::image::Image>
- texture_atlas:bevy_asset::handle::Handle<bevy_sprite::texture_atlas::TextureAtlasLayout>
- location:bevy_text::glyph::GlyphAtlasLocation
Description
Information about a glyph in an atlas.
Rasterized glyphs are stored as rectangles in one or more
FontAtlas
es.Used in [
PositionedGlyph
] andFontAtlasSet
.
Associated Functions
For function details and documentation, click on the function link.
GlyphAtlasLocation
GlyphAtlasLocation
- glyph_index:usize
- offset:glam::IVec2
Description
The location of a glyph in an atlas, and how it should be positioned when placed.
Used in [
GlyphAtlasInfo
] andFontAtlas
.
Associated Functions
For function details and documentation, click on the function link.
PositionedGlyph
PositionedGlyph
- position:glam::Vec2
- size:glam::Vec2
- atlas_info:bevy_text::glyph::GlyphAtlasInfo
- span_index:usize
- byte_index:usize
Description
A glyph of a font, typically representing a single character, positioned in screen space.
Contains information about how and where to render a glyph.
Used in
TextPipeline::queue_text
and [crate::TextLayoutInfo
] for rendering glyphs.
Associated Functions
For function details and documentation, click on the function link.
TextLayoutInfo
TextLayoutInfo
- glyphs:alloc::vec::Vec<bevy_text::glyph::PositionedGlyph>
- size:glam::Vec2
Description
Render information for a corresponding text block.
Contains scaled glyphs and their size. Generated via [
TextPipeline::queue_text
] when an entity has [TextLayout
] and [ComputedTextBlock
] components.
Associated Functions
For function details and documentation, click on the function link.
Text2d
Text2d
- String
Description
The top-level 2D text component.
Adding
Text2d
to an entity will pull in required components for setting up 2d text. Example usage.The string in this component is the first 'text span' in a hierarchy of text spans that are collected into a [
ComputedTextBlock
]. SeeTextSpan
for the component used by children of entities with [Text2d
].With
Text2d
thejustify
field of [TextLayout
] only affects the internal alignment of a block of text and not its relative position, which is controlled by the [Anchor
] component. This means that for a block of text consisting of only one line that doesn't wrap, thejustify
field will have no effect.# use bevy_asset::Handle; # use bevy_color::Color; # use bevy_color::palettes::basic::BLUE; # use bevy_ecs::world::World; # use bevy_text::{Font, JustifyText, Text2d, TextLayout, TextFont, TextColor}; # # let font_handle: Handle<Font> = Default::default(); # let mut world = World::default(); # // Basic usage. world.spawn(Text2d::new("hello world!")); // With non-default style. world.spawn(( Text2d::new("hello world!"), TextFont { font: font_handle.clone().into(), font_size: 60.0, ..Default::default() }, TextColor(BLUE.into()), )); // With text justification. world.spawn(( Text2d::new("hello world\nand bevy!"), TextLayout::new_with_justify(JustifyText::Center) ));
Associated Functions
For function details and documentation, click on the function link.
ComputedTextBlock
ComputedTextBlock
- entities:smallvec::SmallVec<[bevy_text::text::TextEntity; 1]>
- needs_rerender:bool
Description
Computed information for a text block.
See [
TextLayout
].Automatically updated by 2d and UI text systems.
Associated Functions
For function details and documentation, click on the function link.
FontSmoothing
None
AntiAliased
Description
Determines which antialiasing method to use when rendering text. By default, text is rendered with grayscale antialiasing, but this can be changed to achieve a pixelated look.
Note: Subpixel antialiasing is not currently supported.
Associated Functions
For function details and documentation, click on the function link.
JustifyText
Left
Center
Right
Justified
Description
Describes the horizontal alignment of multiple lines of text relative to each other.
This only affects the internal positioning of the lines of text within a text entity and does not affect the text entity's position.
Has no affect on a single line text entity.
Associated Functions
For function details and documentation, click on the function link.
LineBreak
WordBoundary
AnyCharacter
WordOrCharacter
NoWrap
Description
Determines how lines will be broken when preventing text from running out of bounds.
Associated Functions
For function details and documentation, click on the function link.
TextColor
TextColor
- bevy_color::color::Color
Description
The color of the text for this section.
Associated Functions
For function details and documentation, click on the function link.
TextEntity
TextEntity
- entity:bevy_ecs::entity::Entity
- depth:usize
Description
A sub-entity of a [
ComputedTextBlock
].Returned by [
ComputedTextBlock::entities
].
Associated Functions
For function details and documentation, click on the function link.
TextFont
TextFont
- font:bevy_asset::handle::Handle<bevy_text::font::Font>
- font_size:f32
- font_smoothing:bevy_text::text::FontSmoothing
Description
TextFont
determines the style of a text span within a [ComputedTextBlock
], specifically the font face, the font size, and the color.
Associated Functions
For function details and documentation, click on the function link.
TextLayout
TextLayout
- justify:bevy_text::text::JustifyText
- linebreak:bevy_text::text::LineBreak
Description
Component with text format settings for a block of text.
A block of text is composed of text spans, which each have a separate string value and [
TextFont
]. Text spans associated with a text block are collected into [ComputedTextBlock
] for layout, and then inserted to [TextLayoutInfo
] for rendering.See
Text2d
for the core component of 2d text, andText
inbevy_ui
for UI text.
Associated Functions
For function details and documentation, click on the function link.
TextSpan
TextSpan
- String
Description
A span of UI text in a tree of spans under an entity with [
TextLayout
] andText
orText2d
.Spans are collected in hierarchy traversal order into a [
ComputedTextBlock
] for layout.# use bevy_asset::Handle; # use bevy_color::Color; # use bevy_color::palettes::basic::{RED, BLUE}; # use bevy_ecs::world::World; # use bevy_text::{Font, TextLayout, TextFont, TextSpan, TextColor}; # use bevy_hierarchy::BuildChildren; # let font_handle: Handle<Font> = Default::default(); # let mut world = World::default(); # world.spawn(( TextLayout::default(), TextFont { font: font_handle.clone().into(), font_size: 60.0, ..Default::default() }, TextColor(BLUE.into()), )) .with_child(( TextSpan::new("Hello!"), TextFont { font: font_handle.into(), font_size: 60.0, ..Default::default() }, TextColor(RED.into()), ));
Associated Functions
For function details and documentation, click on the function link.
UiScale
UiScale
- f32
Description
The current scale of the UI.
A multiplier to fixed-sized ui values. Note: This will only affect fixed ui values like [
Val::Px
]
Associated Functions
For function details and documentation, click on the function link.
FocusPolicy
Block
Pass
Description
Describes whether the node should block interactions with lower nodes
Associated Functions
For function details and documentation, click on the function link.
Interaction
Pressed
Hovered
None
Description
Describes what type of input interaction has occurred for a UI node.
This is commonly queried with a
Changed<Interaction>
filter.Updated in [
ui_focus_system
].If a UI node has both [
Interaction
] and [ViewVisibility
] components, [Interaction
] will always be [Interaction::None
] when [ViewVisibility::get()
] is false. This ensures that hidden UI nodes are not interactable, and do not end up stuck in an active state if hidden at the wrong time.Note that you can also control the visibility of a node using the
Display
property, which fully collapses it during layout calculations.See also
Button
which requires this component- [
RelativeCursorPosition
] to obtain the position of the cursor relative to current node
Associated Functions
For function details and documentation, click on the function link.
RelativeCursorPosition
RelativeCursorPosition
- normalized_visible_node_rect:bevy_math::rects::rect::Rect
- normalized:core::option::Optionglam::Vec2
Description
A component storing the position of the mouse relative to the node, (0., 0.) being the top-left corner and (1., 1.) being the bottom-right If the mouse is not over the node, the value will go beyond the range of (0., 0.) to (1., 1.)
It can be used alongside [
Interaction
] to get the position of the press.The component is updated when it is in the same entity with
Node
.
Associated Functions
For function details and documentation, click on the function link.
UiRect
UiRect
- left:bevy_ui::geometry::Val
- right:bevy_ui::geometry::Val
- top:bevy_ui::geometry::Val
- bottom:bevy_ui::geometry::Val
Description
A type which is commonly used to define margins, paddings and borders.
Examples
Margin
A margin is used to create space around UI elements, outside of any defined borders.
# use bevy_ui::{UiRect, Val}; # let margin = UiRect::all(Val::Auto); // Centers the UI element
Padding
A padding is used to create space around UI elements, inside of any defined borders.
# use bevy_ui::{UiRect, Val}; # let padding = UiRect { left: Val::Px(10.0), right: Val::Px(20.0), top: Val::Px(30.0), bottom: Val::Px(40.0), };
Borders
A border is used to define the width of the border of a UI element.
# use bevy_ui::{UiRect, Val}; # let border = UiRect { left: Val::Px(10.0), right: Val::Px(20.0), top: Val::Px(30.0), bottom: Val::Px(40.0), };
Associated Functions
For function details and documentation, click on the function link.
Val
Auto
Px
- f32
Percent
- f32
Vw
- f32
Vh
- f32
VMin
- f32
VMax
- f32
Description
Represents the possible value types for layout properties.
This enum allows specifying values for various
Node
properties in different units, such as logical pixels, percentages, or automatically determined values.
Associated Functions
For function details and documentation, click on the function link.
ContentSize
ContentSize
Description
A node with a
ContentSize
component is a node where its size is based on its content.
Associated Functions
For function details and documentation, click on the function link.
AlignContent
Default
Start
End
FlexStart
FlexEnd
Center
Stretch
SpaceBetween
SpaceEvenly
SpaceAround
Description
Used to control how items are distributed.
- For Flexbox containers, controls alignment of lines if
flex_wrap
is set to [FlexWrap::Wrap
] and there are multiple lines of items.- For CSS Grid containers, controls alignment of grid rows.
https://developer.mozilla.org/en-US/docs/Web/CSS/align-content
Associated Functions
For function details and documentation, click on the function link.
AlignItems
Default
Start
End
FlexStart
FlexEnd
Center
Baseline
Stretch
Description
Used to control how each individual item is aligned by default within the space they're given.
- For Flexbox containers, sets default cross axis alignment of the child items.
- For CSS Grid containers, controls block (vertical) axis alignment of children of this grid container within their grid areas.
https://developer.mozilla.org/en-US/docs/Web/CSS/align-items
Associated Functions
For function details and documentation, click on the function link.
AlignSelf
Auto
Start
End
FlexStart
FlexEnd
Center
Baseline
Stretch
Description
Used to control how the specified item is aligned within the space it's given.
- For Flexbox items, controls cross axis alignment of the item.
- For CSS Grid items, controls block (vertical) axis alignment of a grid item within its grid area.
Associated Functions
For function details and documentation, click on the function link.
BackgroundColor
BackgroundColor
- bevy_color::color::Color
Description
The background color of the node
This serves as the "fill" color.
Associated Functions
For function details and documentation, click on the function link.
BorderColor
BorderColor
- bevy_color::color::Color
Description
The border color of the UI node.
Associated Functions
For function details and documentation, click on the function link.
BorderRadius
BorderRadius
- top_left:bevy_ui::geometry::Val
- top_right:bevy_ui::geometry::Val
- bottom_left:bevy_ui::geometry::Val
- bottom_right:bevy_ui::geometry::Val
Description
Used to add rounded corners to a UI node. You can set a UI node to have uniformly rounded corners or specify different radii for each corner. If a given radius exceeds half the length of the smallest dimension between the node's height or width, the radius will calculated as half the smallest dimension.
Elliptical nodes are not supported yet. Percentage values are based on the node's smallest dimension, either width or height.
Example
#![allow(unused)] fn main() { use bevy_ecs::prelude::*; use bevy_ui::prelude::*; use bevy_color::palettes::basic::{BLUE}; fn setup_ui(mut commands: Commands) { commands.spawn(( Node { width: Val::Px(100.), height: Val::Px(100.), border: UiRect::all(Val::Px(2.)), ..Default::default() }, BackgroundColor(BLUE.into()), BorderRadius::new( // top left Val::Px(10.), // top right Val::Px(20.), // bottom right Val::Px(30.), // bottom left Val::Px(40.), ), )); } }
https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius
Associated Functions
For function details and documentation, click on the function link.
CalculatedClip
CalculatedClip
- clip:bevy_math::rects::rect::Rect
Description
The calculated clip of the node
Associated Functions
For function details and documentation, click on the function link.
ComputedNode
ComputedNode
- stack_index:u32
- size:glam::Vec2
- outline_width:f32
- outline_offset:f32
- unrounded_size:glam::Vec2
- border:bevy_sprite::texture_slice::border_rect::BorderRect
- border_radius:bevy_ui::ui_node::ResolvedBorderRadius
- padding:bevy_sprite::texture_slice::border_rect::BorderRect
- inverse_scale_factor:f32
Description
Provides the computed size and layout properties of the node.
Associated Functions
For function details and documentation, click on the function link.
Display
Flex
Grid
Block
None
Description
Defines the layout model used by this node.
Part of the [
Node
] component.
Associated Functions
For function details and documentation, click on the function link.
FlexDirection
Row
Column
RowReverse
ColumnReverse
Description
Defines how flexbox items are ordered within a flexbox
Associated Functions
For function details and documentation, click on the function link.
FlexWrap
NoWrap
Wrap
WrapReverse
Description
Defines if flexbox items appear on a single line or on multiple lines
Associated Functions
For function details and documentation, click on the function link.
GridAutoFlow
Row
Column
RowDense
ColumnDense
Description
Controls whether grid items are placed row-wise or column-wise as well as whether the sparse or dense packing algorithm is used.
The "dense" packing algorithm attempts to fill in holes earlier in the grid, if smaller items come up later. This may cause items to appear out-of-order when doing so would fill in holes left by larger items.
Defaults to [
GridAutoFlow::Row
].https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow
Associated Functions
For function details and documentation, click on the function link.
GridPlacement
GridPlacement
- start:core::option::Optioncore::num::NonZeroI16
- span:core::option::Optioncore::num::NonZeroU16
- end:core::option::Optioncore::num::NonZeroI16
Description
Represents the position of a grid item in a single axis.
There are 3 fields which may be set:
start
: which grid line the item should start atend
: which grid line the item should end atspan
: how many tracks the item should spanThe default
span
is 1. If neitherstart
orend
is set then the item will be placed automatically.Generally, at most two fields should be set. If all three fields are specified then
span
will be ignored. Ifend
specifies an earlier grid line thanstart
thenend
will be ignored and the item will have a span of 1.https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout/Line-based_Placement_with_CSS_Grid
Associated Functions
For function details and documentation, click on the function link.
GridTrack
GridTrack
- min_sizing_function:bevy_ui::ui_node::MinTrackSizingFunction
- max_sizing_function:bevy_ui::ui_node::MaxTrackSizingFunction
Description
A [
GridTrack
] is a Row or Column of a CSS Grid. This struct specifies what size the track should be. See below for the different "track sizing functions" you can specify.
Associated Functions
For function details and documentation, click on the function link.
GridTrackRepetition
Count
- u16
AutoFill
AutoFit
Description
How many times to repeat a repeated grid track
Associated Functions
For function details and documentation, click on the function link.
JustifyContent
Default
Start
End
FlexStart
FlexEnd
Center
Stretch
SpaceBetween
SpaceEvenly
SpaceAround
Description
Used to control how items are distributed.
- For Flexbox containers, controls alignment of items in the main axis.
- For CSS Grid containers, controls alignment of grid columns.
https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content
Associated Functions
For function details and documentation, click on the function link.
JustifyItems
Default
Start
End
Center
Baseline
Stretch
Description
Used to control how each individual item is aligned by default within the space they're given.
- For Flexbox containers, this property has no effect. See
justify_content
for main axis alignment of flex items.- For CSS Grid containers, sets default inline (horizontal) axis alignment of child items within their grid areas.
https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items
Associated Functions
For function details and documentation, click on the function link.
JustifySelf
Auto
Start
End
Center
Baseline
Stretch
Description
Used to control how the specified item is aligned within the space it's given.
- For Flexbox items, this property has no effect. See
justify_content
for main axis alignment of flex items.- For CSS Grid items, controls inline (horizontal) axis alignment of a grid item within its grid area.
https://developer.mozilla.org/en-US/docs/Web/CSS/justify-self
Associated Functions
For function details and documentation, click on the function link.
MaxTrackSizingFunction
Px
- f32
Percent
- f32
MinContent
MaxContent
FitContentPx
- f32
FitContentPercent
- f32
Auto
Fraction
- f32
VMin
- f32
VMax
- f32
Vh
- f32
Vw
- f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
MinTrackSizingFunction
Px
- f32
Percent
- f32
MinContent
MaxContent
Auto
VMin
- f32
VMax
- f32
Vh
- f32
Vw
- f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Node
Node
- display:bevy_ui::ui_node::Display
- position_type:bevy_ui::ui_node::PositionType
- overflow:bevy_ui::ui_node::Overflow
- overflow_clip_margin:bevy_ui::ui_node::OverflowClipMargin
- left:bevy_ui::geometry::Val
- right:bevy_ui::geometry::Val
- top:bevy_ui::geometry::Val
- bottom:bevy_ui::geometry::Val
- width:bevy_ui::geometry::Val
- height:bevy_ui::geometry::Val
- min_width:bevy_ui::geometry::Val
- min_height:bevy_ui::geometry::Val
- max_width:bevy_ui::geometry::Val
- max_height:bevy_ui::geometry::Val
- aspect_ratio:core::option::Option
- align_items:bevy_ui::ui_node::AlignItems
- justify_items:bevy_ui::ui_node::JustifyItems
- align_self:bevy_ui::ui_node::AlignSelf
- justify_self:bevy_ui::ui_node::JustifySelf
- align_content:bevy_ui::ui_node::AlignContent
- justify_content:bevy_ui::ui_node::JustifyContent
- margin:bevy_ui::geometry::UiRect
- padding:bevy_ui::geometry::UiRect
- border:bevy_ui::geometry::UiRect
- flex_direction:bevy_ui::ui_node::FlexDirection
- flex_wrap:bevy_ui::ui_node::FlexWrap
- flex_grow:f32
- flex_shrink:f32
- flex_basis:bevy_ui::geometry::Val
- row_gap:bevy_ui::geometry::Val
- column_gap:bevy_ui::geometry::Val
- grid_auto_flow:bevy_ui::ui_node::GridAutoFlow
- grid_template_rows:alloc::vec::Vec<bevy_ui::ui_node::RepeatedGridTrack>
- grid_template_columns:alloc::vec::Vec<bevy_ui::ui_node::RepeatedGridTrack>
- grid_auto_rows:alloc::vec::Vec<bevy_ui::ui_node::GridTrack>
- grid_auto_columns:alloc::vec::Vec<bevy_ui::ui_node::GridTrack>
- grid_row:bevy_ui::ui_node::GridPlacement
- grid_column:bevy_ui::ui_node::GridPlacement
Description
The base component for UI entities. It describes UI layout and style properties.
When defining new types of UI entities, require [
Node
] to make them behave like UI nodes.Nodes can be laid out using either Flexbox or CSS Grid Layout.
See below for general learning resources and for documentation on the individual style properties.
Flexbox
- MDN: Basic Concepts of Flexbox
- A Complete Guide To Flexbox by CSS Tricks. This is detailed guide with illustrations and comprehensive written explanation of the different Flexbox properties and how they work.
- Flexbox Froggy. An interactive tutorial/game that teaches the essential parts of Flexbox in a fun engaging way.
CSS Grid
- MDN: Basic Concepts of Grid Layout
- A Complete Guide To CSS Grid by CSS Tricks. This is detailed guide with illustrations and comprehensive written explanation of the different CSS Grid properties and how they work.
- CSS Grid Garden. An interactive tutorial/game that teaches the essential parts of CSS Grid in a fun engaging way.
See also
RelativeCursorPosition
to obtain the cursor position relative to this nodeInteraction
to obtain the interaction state of this node
Associated Functions
For function details and documentation, click on the function link.
Outline
Outline
- width:bevy_ui::geometry::Val
- offset:bevy_ui::geometry::Val
- color:bevy_color::color::Color
Description
The [
Outline
] component adds an outline outside the edge of a UI node. Outlines do not take up space in the layout.To add an [
Outline
] to a ui node you can spawn a(Node, Outline)
tuple bundle:# use bevy_ecs::prelude::*; # use bevy_ui::prelude::*; # use bevy_color::palettes::basic::{RED, BLUE}; fn setup_ui(mut commands: Commands) { commands.spawn(( Node { width: Val::Px(100.), height: Val::Px(100.), ..Default::default() }, BackgroundColor(BLUE.into()), Outline::new(Val::Px(10.), Val::ZERO, RED.into()) )); }
[
Outline
] components can also be added later to existing UI nodes:# use bevy_ecs::prelude::*; # use bevy_ui::prelude::*; # use bevy_color::Color; fn outline_hovered_button_system( mut commands: Commands, mut node_query: Query<(Entity, &Interaction, Option<&mut Outline>), Changed<Interaction>>, ) { for (entity, interaction, mut maybe_outline) in node_query.iter_mut() { let outline_color = if matches!(*interaction, Interaction::Hovered) { Color::WHITE } else { Color::NONE }; if let Some(mut outline) = maybe_outline { outline.color = outline_color; } else { commands.entity(entity).insert(Outline::new(Val::Px(10.), Val::ZERO, outline_color)); } } }
Inserting and removing an [
Outline
] component repeatedly will result in table moves, so it is generally preferable to setOutline::color
to [Color::NONE
] to hide an outline.
Associated Functions
For function details and documentation, click on the function link.
Overflow
Overflow
- x:bevy_ui::ui_node::OverflowAxis
- y:bevy_ui::ui_node::OverflowAxis
Description
Whether to show or hide overflowing items
Associated Functions
For function details and documentation, click on the function link.
OverflowAxis
Visible
Clip
Hidden
Scroll
Description
Whether to show or hide overflowing items
Associated Functions
For function details and documentation, click on the function link.
OverflowClipBox
ContentBox
PaddingBox
BorderBox
Description
Used to determine the bounds of the visible area when a UI node is clipped.
Associated Functions
For function details and documentation, click on the function link.
OverflowClipMargin
OverflowClipMargin
- visual_box:bevy_ui::ui_node::OverflowClipBox
- margin:f32
Description
The bounds of the visible area when a UI node is clipped.
Associated Functions
For function details and documentation, click on the function link.
PositionType
Relative
Absolute
Description
The strategy used to position this node
Associated Functions
For function details and documentation, click on the function link.
RepeatedGridTrack
RepeatedGridTrack
- repetition:bevy_ui::ui_node::GridTrackRepetition
- tracks:smallvec::SmallVec<[bevy_ui::ui_node::GridTrack; 1]>
Description
Represents a possibly repeated [
GridTrack
].The repetition parameter can either be:
- The integer
1
, in which case the track is non-repeated.- a
u16
count to repeat the track N times.- A
GridTrackRepetition::AutoFit
orGridTrackRepetition::AutoFill
.Note: that in the common case you want a non-repeating track (repetition count 1), you may use the constructor methods on [
GridTrack
] to create aRepeatedGridTrack
. i.e.GridTrack::px(10.0)
is equivalent toRepeatedGridTrack::px(1, 10.0)
.You may only use one auto-repetition per track list. And if your track list contains an auto repetition then all tracks (in and outside of the repetition) must be fixed size (px or percent). Integer repetitions are just shorthand for writing out N tracks longhand and are not subject to the same limitations.
Associated Functions
For function details and documentation, click on the function link.
ResolvedBorderRadius
ResolvedBorderRadius
- top_left:f32
- top_right:f32
- bottom_left:f32
- bottom_right:f32
Description
Represents the resolved border radius values for a UI node.
The values are in physical pixels.
Associated Functions
For function details and documentation, click on the function link.
ScrollPosition
ScrollPosition
- offset_x:f32
- offset_y:f32
Description
The scroll position of the node.
Updating the values of
ScrollPosition
will reposition the children of the node by the offset amount.ScrollPosition
may be updated by the layout system when a layout change makes a previously validScrollPosition
invalid. Changing this does nothing on aNode
without setting at least oneOverflowAxis
toOverflowAxis::Scroll
.
Associated Functions
For function details and documentation, click on the function link.
TargetCamera
TargetCamera
- bevy_ecs::entity::Entity
Description
Indicates that this root [
Node
] entity should be rendered to a specific camera.UI then will be laid out respecting the camera's viewport and scale factor, and rendered to this camera's [
bevy_render::camera::RenderTarget
].Setting this component on a non-root node will have no effect. It will be overridden by the root node's component.
Optional if there is only one camera in the world. Required otherwise.
Associated Functions
For function details and documentation, click on the function link.
UiAntiAlias
On
Off
Description
Marker for controlling whether Ui is rendered with or without anti-aliasing in a camera. By default, Ui is always anti-aliased.
Note: This does not affect text anti-aliasing. For that, use the
font_smoothing
property of theTextFont
component.use bevy_core_pipeline::prelude::*; use bevy_ecs::prelude::*; use bevy_ui::prelude::*; fn spawn_camera(mut commands: Commands) { commands.spawn(( Camera2d, // This will cause all Ui in this camera to be rendered without // anti-aliasing UiAntiAlias::Off, )); }
Associated Functions
For function details and documentation, click on the function link.
UiBoxShadowSamples
UiBoxShadowSamples
- u32
Description
Number of shadow samples. A larger value will result in higher quality shadows. Default is 4, values higher than ~10 offer diminishing returns.
use bevy_core_pipeline::prelude::*; use bevy_ecs::prelude::*; use bevy_ui::prelude::*; fn spawn_camera(mut commands: Commands) { commands.spawn(( Camera2d, UiBoxShadowSamples(6), )); }
Associated Functions
For function details and documentation, click on the function link.
ZIndex
ZIndex
- i32
Description
Indicates that this [
Node
] entity's front-to-back ordering is not controlled solely by its location in the UI hierarchy. A node with a higher z-index will appear on top of sibling nodes with a lower z-index.UI nodes that have the same z-index will appear according to the order in which they appear in the UI hierarchy. In such a case, the last node to be added to its parent will appear in front of its siblings.
Nodes without this component will be treated as if they had a value of [
ZIndex(0)
].Use [
GlobalZIndex
] if you need to order separate UI hierarchies or nodes that are not siblings in a given UI hierarchy.
Associated Functions
For function details and documentation, click on the function link.
Button
Button
Description
Marker struct for buttons
Associated Functions
For function details and documentation, click on the function link.
ImageNode
ImageNode
- color:bevy_color::color::Color
- image:bevy_asset::handle::Handle<bevy_image::image::Image>
- texture_atlas:core::option::Option<bevy_sprite::texture_atlas::TextureAtlas>
- flip_x:bool
- flip_y:bool
- rect:core::option::Option<bevy_math::rects::rect::Rect>
- image_mode:bevy_ui::widget::image::NodeImageMode
Description
A UI Node that renders an image.
Associated Functions
For function details and documentation, click on the function link.
ImageNodeSize
ImageNodeSize
- size:glam::UVec2
Description
The size of the image's texture
This component is updated automatically by [
update_image_content_size_system
]
Associated Functions
For function details and documentation, click on the function link.
NodeImageMode
Auto
Stretch
Sliced
- bevy_sprite::texture_slice::slicer::TextureSlicer
Tiled
- tile_x:bool
- tile_y:bool
- stretch_value:f32
Description
Controls how the image is altered to fit within the layout and how the layout algorithm determines the space in the layout for the image
Associated Functions
For function details and documentation, click on the function link.
Label
Label
Description
Marker struct for labels
Associated Functions
For function details and documentation, click on the function link.
Text
Text
- String
Description
The top-level UI text component.
Adding [
Text
] to an entity will pull in required components for setting up a UI text node.The string in this component is the first 'text span' in a hierarchy of text spans that are collected into a [
ComputedTextBlock
]. SeeTextSpan
for the component used by children of entities with [Text
].Note that
Transform
on this entity is managed automatically by the UI layout system.# use bevy_asset::Handle; # use bevy_color::Color; # use bevy_color::palettes::basic::BLUE; # use bevy_ecs::world::World; # use bevy_text::{Font, JustifyText, TextLayout, TextFont, TextColor}; # use bevy_ui::prelude::Text; # # let font_handle: Handle<Font> = Default::default(); # let mut world = World::default(); # // Basic usage. world.spawn(Text::new("hello world!")); // With non-default style. world.spawn(( Text::new("hello world!"), TextFont { font: font_handle.clone().into(), font_size: 60.0, ..Default::default() }, TextColor(BLUE.into()), )); // With text justification. world.spawn(( Text::new("hello world\nand bevy!"), TextLayout::new_with_justify(JustifyText::Center) ));
Associated Functions
For function details and documentation, click on the function link.
TextNodeFlags
TextNodeFlags
- needs_measure_fn:bool
- needs_recompute:bool
Description
UI text system flags.
Used internally by [
measure_text_system
] and [text_system
] to schedule text for processing.
Associated Functions
For function details and documentation, click on the function link.
AppLifecycle
Idle
Running
WillSuspend
Suspended
WillResume
Description
Application lifetime events
Associated Functions
For function details and documentation, click on the function link.
CursorEntered
CursorEntered
- window:bevy_ecs::entity::Entity
Description
An event that is sent whenever the user's cursor enters a window.
Associated Functions
For function details and documentation, click on the function link.
CursorLeft
CursorLeft
- window:bevy_ecs::entity::Entity
Description
An event that is sent whenever the user's cursor leaves a window.
Associated Functions
For function details and documentation, click on the function link.
CursorMoved
CursorMoved
- window:bevy_ecs::entity::Entity
- position:glam::Vec2
- delta:core::option::Optionglam::Vec2
Description
An event reporting that the mouse cursor has moved inside a window.
The event is sent only if the cursor is over one of the application's windows. It is the translated version of
WindowEvent::CursorMoved
from thewinit
crate with the addition ofdelta
.Not to be confused with the
MouseMotion
event frombevy_input
.Because the range of data is limited by the window area and it may have been transformed by the OS to implement certain effects like acceleration, you should not use it for non-cursor-like behavior such as 3D camera control. Please see
MouseMotion
instead.
Associated Functions
For function details and documentation, click on the function link.
FileDragAndDrop
DroppedFile
- window:bevy_ecs::entity::Entity
- path_buf:PathBuf
HoveredFile
- window:bevy_ecs::entity::Entity
- path_buf:PathBuf
HoveredFileCanceled
- window:bevy_ecs::entity::Entity
Description
Events related to files being dragged and dropped on a window.
Associated Functions
For function details and documentation, click on the function link.
Ime
Preedit
- window:bevy_ecs::entity::Entity
- value:String
- cursor:core::option::Option<(usize, usize)>
Commit
- window:bevy_ecs::entity::Entity
- value:String
Enabled
- window:bevy_ecs::entity::Entity
Disabled
- window:bevy_ecs::entity::Entity
Description
A Input Method Editor event.
This event is the translated version of the
WindowEvent::Ime
from thewinit
crate.It is only sent if IME was enabled on the window with
Window::ime_enabled
.
Associated Functions
For function details and documentation, click on the function link.
RequestRedraw
RequestRedraw
Description
An event that indicates all of the application's windows should be redrawn, even if their control flow is set to
Wait
and there have been no window events.
Associated Functions
For function details and documentation, click on the function link.
WindowBackendScaleFactorChanged
WindowBackendScaleFactorChanged
- window:bevy_ecs::entity::Entity
- scale_factor:f64
Description
An event that indicates a window's OS-reported scale factor has changed.
Associated Functions
For function details and documentation, click on the function link.
WindowCloseRequested
WindowCloseRequested
- window:bevy_ecs::entity::Entity
Description
An event that is sent whenever the operating systems requests that a window be closed. This will be sent when the close button of the window is pressed.
If the default
WindowPlugin
is used, these events are handled by closing the correspondingWindow
. To disable this behavior, setclose_when_requested
on theWindowPlugin
tofalse
.
Associated Functions
For function details and documentation, click on the function link.
WindowClosed
WindowClosed
- window:bevy_ecs::entity::Entity
Description
An event that is sent whenever a window is closed. This will be sent when the window entity loses its
Window
component or is despawned.
Associated Functions
For function details and documentation, click on the function link.
WindowClosing
WindowClosing
- window:bevy_ecs::entity::Entity
Description
An event that is sent whenever a window is closing. This will be sent when after a [
WindowCloseRequested
] event is received and the window is in the process of closing.
Associated Functions
For function details and documentation, click on the function link.
WindowCreated
WindowCreated
- window:bevy_ecs::entity::Entity
Description
An event that is sent whenever a new window is created.
To create a new window, spawn an entity with a [
crate::Window
] on it.
Associated Functions
For function details and documentation, click on the function link.
WindowDestroyed
WindowDestroyed
- window:bevy_ecs::entity::Entity
Description
An event that is sent whenever a window is destroyed by the underlying window system.
Note that if your application only has a single window, this event may be your last chance to persist state before the application terminates.
Associated Functions
For function details and documentation, click on the function link.
WindowEvent
AppLifecycle
- bevy_window::event::AppLifecycle
CursorEntered
- bevy_window::event::CursorEntered
CursorLeft
- bevy_window::event::CursorLeft
CursorMoved
- bevy_window::event::CursorMoved
FileDragAndDrop
- bevy_window::event::FileDragAndDrop
Ime
- bevy_window::event::Ime
RequestRedraw
- bevy_window::event::RequestRedraw
WindowBackendScaleFactorChanged
- bevy_window::event::WindowBackendScaleFactorChanged
WindowCloseRequested
- bevy_window::event::WindowCloseRequested
WindowCreated
- bevy_window::event::WindowCreated
WindowDestroyed
- bevy_window::event::WindowDestroyed
WindowFocused
- bevy_window::event::WindowFocused
WindowMoved
- bevy_window::event::WindowMoved
WindowOccluded
- bevy_window::event::WindowOccluded
WindowResized
- bevy_window::event::WindowResized
WindowScaleFactorChanged
- bevy_window::event::WindowScaleFactorChanged
WindowThemeChanged
- bevy_window::event::WindowThemeChanged
MouseButtonInput
- bevy_input::mouse::MouseButtonInput
MouseMotion
- bevy_input::mouse::MouseMotion
MouseWheel
- bevy_input::mouse::MouseWheel
PinchGesture
- bevy_input::gestures::PinchGesture
RotationGesture
- bevy_input::gestures::RotationGesture
DoubleTapGesture
- bevy_input::gestures::DoubleTapGesture
PanGesture
- bevy_input::gestures::PanGesture
TouchInput
- bevy_input::touch::TouchInput
KeyboardInput
- bevy_input::keyboard::KeyboardInput
KeyboardFocusLost
- bevy_input::keyboard::KeyboardFocusLost
Description
Wraps all
bevy_window
andbevy_input
events in a common enum.Read these events with
EventReader<WindowEvent>
if you need to access window events in the order they were received from the operating system. Otherwise, the event types are individually readable withEventReader<E>
(e.g.EventReader<KeyboardInput>
).
Associated Functions
For function details and documentation, click on the function link.
WindowFocused
WindowFocused
- window:bevy_ecs::entity::Entity
- focused:bool
Description
An event that indicates a window has received or lost focus.
Associated Functions
For function details and documentation, click on the function link.
WindowMoved
WindowMoved
- window:bevy_ecs::entity::Entity
- position:glam::IVec2
Description
An event that is sent when a window is repositioned in physical pixels.
Associated Functions
For function details and documentation, click on the function link.
WindowOccluded
WindowOccluded
- window:bevy_ecs::entity::Entity
- occluded:bool
Description
The window has been occluded (completely hidden from view).
This is different to window visibility as it depends on whether the window is closed, minimized, set invisible, or fully occluded by another window.
It is the translated version of
WindowEvent::Occluded
from thewinit
crate.
Associated Functions
For function details and documentation, click on the function link.
WindowResized
WindowResized
- window:bevy_ecs::entity::Entity
- width:f32
- height:f32
Description
A window event that is sent whenever a window's logical size has changed.
Associated Functions
For function details and documentation, click on the function link.
WindowScaleFactorChanged
WindowScaleFactorChanged
- window:bevy_ecs::entity::Entity
- scale_factor:f64
Description
An event that indicates a window's scale factor has changed.
Associated Functions
For function details and documentation, click on the function link.
WindowThemeChanged
WindowThemeChanged
- window:bevy_ecs::entity::Entity
- theme:bevy_window::window::WindowTheme
Description
An event sent when the system theme changes for a window.
This event is only sent when the window is relying on the system theme to control its appearance. i.e. It is only sent when
Window::window_theme
isNone
and the system theme changes.
Associated Functions
For function details and documentation, click on the function link.
Monitor
Monitor
- name:core::option::Optionalloc::string::String
- physical_height:u32
- physical_width:u32
- physical_position:glam::IVec2
- refresh_rate_millihertz:core::option::Option
- scale_factor:f64
- video_modes:alloc::vec::Vec<bevy_window::monitor::VideoMode>
Description
Represents an available monitor as reported by the user's operating system, which can be used to query information about the display, such as its size, position, and video modes.
Each monitor corresponds to an entity and can be used to position a monitor using [
crate::window::MonitorSelection::Entity
].Warning
This component is synchronized with
winit
throughbevy_winit
, but is effectively read-only aswinit
does not support changing monitor properties.
Associated Functions
For function details and documentation, click on the function link.
VideoMode
VideoMode
- physical_size:glam::UVec2
- bit_depth:u16
- refresh_rate_millihertz:u32
Description
Represents a video mode that a monitor supports
Associated Functions
For function details and documentation, click on the function link.
SystemCursorIcon
Default
ContextMenu
Help
Pointer
Progress
Wait
Cell
Crosshair
Text
VerticalText
Alias
Copy
Move
NoDrop
NotAllowed
Grab
Grabbing
EResize
NResize
NeResize
NwResize
SResize
SeResize
SwResize
WResize
EwResize
NsResize
NeswResize
NwseResize
ColResize
RowResize
AllScroll
ZoomIn
ZoomOut
Description
The icon to display for a window.
Examples of all of these cursors can be found here. This
enum
is simply a copy of a similarenum
found inwinit
.winit
, in turn, is based upon the CSS3 UI spec.See the
window_settings
example for usage.
Associated Functions
For function details and documentation, click on the function link.
CompositeAlphaMode
Auto
Opaque
PreMultiplied
PostMultiplied
Inherit
Description
Specifies how the alpha channel of the textures should be handled during compositing, for a [
Window
].
Associated Functions
For function details and documentation, click on the function link.
CursorGrabMode
None
Confined
Locked
Description
Defines if and how the cursor is grabbed by a [
Window
].Platform-specific
Windows
doesn't support [CursorGrabMode::Locked
]macOS
doesn't support [CursorGrabMode::Confined
]iOS/Android
don't have cursors.Since
Windows
andmacOS
have different [CursorGrabMode
] support, we first try to set the grab mode that was asked for. If it doesn't work then use the alternate grab mode.
Associated Functions
For function details and documentation, click on the function link.
CursorOptions
CursorOptions
- visible:bool
- grab_mode:bevy_window::window::CursorGrabMode
- hit_test:bool
Description
Cursor data for a [
Window
].
Associated Functions
For function details and documentation, click on the function link.
EnabledButtons
EnabledButtons
- minimize:bool
- maximize:bool
- close:bool
Description
Specifies which [
Window
] control buttons should be enabled.Platform-specific
iOS
,Android
, and theWeb
do not have window control buttons.On some
Linux
environments these values have no effect.
Associated Functions
For function details and documentation, click on the function link.
InternalWindowState
InternalWindowState
- minimize_request:core::option::Option
- maximize_request:core::option::Option
- drag_move_request:bool
- drag_resize_request:core::option::Option<bevy_math::compass::CompassOctant>
- physical_cursor_position:core::option::Optionglam::DVec2
Description
Stores internal [
Window
] state that isn't directly accessible.
Associated Functions
For function details and documentation, click on the function link.
MonitorSelection
Current
Primary
Index
- usize
Entity
- bevy_ecs::entity::Entity
Description
References a screen monitor.
Used when centering a [
Window
] on a monitor.
Associated Functions
For function details and documentation, click on the function link.
PresentMode
AutoVsync
AutoNoVsync
Fifo
FifoRelaxed
Immediate
Mailbox
Description
Presentation mode for a [
Window
].The presentation mode specifies when a frame is presented to the window. The
Fifo
option corresponds to a traditionalVSync
, where the framerate is capped by the display refresh rate. BothImmediate
andMailbox
are low-latency and are not capped by the refresh rate, but may not be available on all platforms. Tearing may be observed withImmediate
mode, but will not be observed withMailbox
orFifo
.
AutoVsync
orAutoNoVsync
will gracefully fallback toFifo
when unavailable.
Immediate
orMailbox
will panic if not supported by the platform.
Associated Functions
For function details and documentation, click on the function link.
PrimaryWindow
PrimaryWindow
Description
Marker [
Component
] for the window considered the primary window.Currently this is assumed to only exist on 1 entity at a time.
WindowPlugin
will spawn a [Window
] entity with this component ifprimary_window
isSome
.
Associated Functions
For function details and documentation, click on the function link.
Window
Window
- cursor_options:bevy_window::window::CursorOptions
- present_mode:bevy_window::window::PresentMode
- mode:bevy_window::window::WindowMode
- position:bevy_window::window::WindowPosition
- resolution:bevy_window::window::WindowResolution
- title:String
- name:core::option::Optionalloc::string::String
- composite_alpha_mode:bevy_window::window::CompositeAlphaMode
- resize_constraints:bevy_window::window::WindowResizeConstraints
- resizable:bool
- enabled_buttons:bevy_window::window::EnabledButtons
- decorations:bool
- transparent:bool
- focused:bool
- window_level:bevy_window::window::WindowLevel
- canvas:core::option::Optionalloc::string::String
- fit_canvas_to_parent:bool
- prevent_default_event_handling:bool
- internal:bevy_window::window::InternalWindowState
- ime_enabled:bool
- ime_position:glam::Vec2
- window_theme:core::option::Option<bevy_window::window::WindowTheme>
- visible:bool
- skip_taskbar:bool
- desired_maximum_frame_latency:core::option::Optioncore::num::NonZeroU32
- recognize_pinch_gesture:bool
- recognize_rotation_gesture:bool
- recognize_doubletap_gesture:bool
- recognize_pan_gesture:core::option::Option<(u8, u8)>
- movable_by_window_background:bool
- fullsize_content_view:bool
- has_shadow:bool
- titlebar_shown:bool
- titlebar_transparent:bool
- titlebar_show_title:bool
- titlebar_show_buttons:bool
Description
The defining [
Component
] for window entities, storing information about how it should appear and behave.Each window corresponds to an entity, and is uniquely identified by the value of their [
Entity
]. When the [Window
] component is added to an entity, a new window will be opened. When it is removed or the entity is despawned, the window will close.The primary window entity (and the corresponding window) is spawned by default by
WindowPlugin
and is marked with the [PrimaryWindow
] component.This component is synchronized with
winit
throughbevy_winit
: it will reflect the current state of the window and can be modified to change this state.Example
Because this component is synchronized with
winit
, it can be used to perform OS-integrated windowing operations. For example, here's a simple system to change the window mode:# use bevy_ecs::query::With; # use bevy_ecs::system::Query; # use bevy_window::{WindowMode, PrimaryWindow, Window, MonitorSelection}; fn change_window_mode(mut windows: Query<&mut Window, With<PrimaryWindow>>) { // Query returns one window typically. for mut window in windows.iter_mut() { window.mode = WindowMode::Fullscreen(MonitorSelection::Current); } }
Associated Functions
For function details and documentation, click on the function link.
WindowLevel
AlwaysOnBottom
Normal
AlwaysOnTop
Description
Specifies where a [
Window
] should appear relative to other overlapping windows (on top or under) .Levels are groups of windows with respect to their z-position.
The relative ordering between windows in different window levels is fixed. The z-order of windows within the same window level may change dynamically on user interaction.
Platform-specific
- iOS / Android / Web / Wayland: Unsupported.
Associated Functions
For function details and documentation, click on the function link.
WindowMode
Windowed
BorderlessFullscreen
- bevy_window::window::MonitorSelection
SizedFullscreen
- bevy_window::window::MonitorSelection
Fullscreen
- bevy_window::window::MonitorSelection
Description
Defines the way a [
Window
] is displayed.
Associated Functions
For function details and documentation, click on the function link.
WindowPosition
Automatic
Centered
- bevy_window::window::MonitorSelection
At
- glam::IVec2
Description
Defines where a [
Window
] should be placed on the screen.
Associated Functions
For function details and documentation, click on the function link.
WindowRef
Primary
Entity
- bevy_ecs::entity::Entity
Description
Reference to a [
Window
], whether it be a direct link to a specific entity or a more vague defaulting choice.
Associated Functions
For function details and documentation, click on the function link.
WindowResizeConstraints
WindowResizeConstraints
- min_width:f32
- min_height:f32
- max_width:f32
- max_height:f32
Description
The size limits on a [
Window
].These values are measured in logical pixels (see [
WindowResolution
]), so the user's scale factor does affect the size limits on the window.Please note that if the window is resizable, then when the window is maximized it may have a size outside of these limits. The functionality required to disable maximizing is not yet exposed by winit.
Associated Functions
For function details and documentation, click on the function link.
WindowResolution
WindowResolution
- physical_width:u32
- physical_height:u32
- scale_factor_override:core::option::Option
- scale_factor:f32
Description
Controls the size of a [
Window
]Physical, logical and requested sizes
There are three sizes associated with a window:
- the physical size, which represents the actual height and width in physical pixels the window occupies on the monitor,
- the logical size, which represents the size that should be used to scale elements inside the window, measured in logical pixels,
- the requested size, measured in logical pixels, which is the value submitted to the API when creating the window, or requesting that it be resized.
Scale factor
The reason logical size and physical size are separated and can be different is to account for the cases where:
- several monitors have different pixel densities,
- the user has set up a pixel density preference in its operating system,
- the Bevy
App
has specified a specific scale factor between both.The factor between physical size and logical size can be retrieved with [
WindowResolution::scale_factor
].For the first two cases, a scale factor is set automatically by the operating system through the window backend. You can get it with [
WindowResolution::base_scale_factor
].For the third case, you can override this automatic scale factor with [
WindowResolution::set_scale_factor_override
].Requested and obtained sizes
The logical size should be equal to the requested size after creating/resizing, when possible. The reason the requested size and logical size might be different is because the corresponding physical size might exceed limits (either the size limits of the monitor, or limits defined in [
WindowResizeConstraints
]).Note: The requested size is not kept in memory, for example requesting a size too big for the screen, making the logical size different from the requested size, and then setting a scale factor that makes the previous requested size within the limits of the screen will not get back that previous requested size.
Associated Functions
For function details and documentation, click on the function link.
WindowTheme
Light
Dark
Description
The [
Window
] theme variant to use.
Associated Functions
For function details and documentation, click on the function link.
CursorIcon
Custom
- bevy_winit::cursor::CustomCursor
System
- bevy_window::system_cursor::SystemCursorIcon
Description
Insert into a window entity to set the cursor for that window.
Associated Functions
For function details and documentation, click on the function link.
CustomCursor
Image
- handle:bevy_asset::handle::Handle<bevy_image::image::Image>
- hotspot:(u16, u16)
Description
Custom cursor image data.
Associated Functions
For function details and documentation, click on the function link.
bool
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
char
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
TypeId
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
NonZeroI16
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
NonZeroU16
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
NonZeroU32
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
f32
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
f64
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
i128
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
i16
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
i32
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
i64
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
i8
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
isize
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
NodeIndex
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
u128
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
u16
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
u32
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
u64
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
u8
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
usize
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Cow
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Arc
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<String>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<TimedAnimationEvent>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<AnimationTransition>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<Entity>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<URect>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<ScriptQueryResult>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<ReflectReference>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<FunctionArgInfo>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<FunctionInfo>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<Cascade>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<ReflectSystem>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<PositionedGlyph>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<GridTrack>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<RepeatedGridTrack>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<VideoMode>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<f32>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<NodeIndex>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<u16>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<u32>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<u64>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
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).
Associated Functions
For function details and documentation, click on the function link.
Handle<AnimationClip>
Strong
- alloc::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_animation::AnimationClip>
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).
Associated Functions
For function details and documentation, click on the function link.
Handle<AnimationGraph>
Strong
- alloc::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_animation::graph::AnimationGraph>
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).
Associated Functions
For function details and documentation, click on the function link.
Handle<Image>
Strong
- alloc::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_image::image::Image>
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).
Associated Functions
For function details and documentation, click on the function link.
Handle<Mesh>
Strong
- alloc::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_mesh::mesh::Mesh>
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).
Associated Functions
For function details and documentation, click on the function link.
Handle<StandardMaterial>
Strong
- alloc::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_pbr::pbr_material::StandardMaterial>
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).
Associated Functions
For function details and documentation, click on the function link.
Handle<ShaderStorageBuffer>
Strong
- alloc::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_render::storage::ShaderStorageBuffer>
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).
Associated Functions
For function details and documentation, click on the function link.
Handle<ColorMaterial>
Strong
- alloc::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_sprite::mesh2d::color_material::ColorMaterial>
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).
Associated Functions
For function details and documentation, click on the function link.
Handle<TextureAtlasLayout>
Strong
- alloc::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_sprite::texture_atlas::TextureAtlasLayout>
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).
Associated Functions
For function details and documentation, click on the function link.
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
].
Associated Functions
For function details and documentation, click on the function link.
AssetId<AnimationClip>
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
].
Associated Functions
For function details and documentation, click on the function link.
AssetId<AnimationGraph>
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
].
Associated Functions
For function details and documentation, click on the function link.
AssetId<Image>
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
].
Associated Functions
For function details and documentation, click on the function link.
AssetId<Mesh>
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
].
Associated Functions
For function details and documentation, click on the function link.
AssetId<StandardMaterial>
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
].
Associated Functions
For function details and documentation, click on the function link.
AssetId<ShaderStorageBuffer>
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
].
Associated Functions
For function details and documentation, click on the function link.
AssetId<ColorMaterial>
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
].
Associated Functions
For function details and documentation, click on the function link.
AssetId<TextureAtlasLayout>
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
].
Associated Functions
For function details and documentation, click on the function link.
Axis<GamepadInput>
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
].
Associated Functions
For function details and documentation, click on the function link.
ButtonInput<GamepadButton>
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.
Associated Functions
For function details and documentation, click on the function link.
MeshMaterial3d<StandardMaterial>
MeshMaterial3d
- bevy_asset::handle::Handle<bevy_pbr::pbr_material::StandardMaterial>
Description
A material used for rendering a
Mesh3d
.See [
Material
] for general information about 3D materials and how to implement your own materials.Example
# use bevy_pbr::{Material, MeshMaterial3d, StandardMaterial}; # use bevy_ecs::prelude::*; # use bevy_render::mesh::{Mesh, Mesh3d}; # use bevy_color::palettes::basic::RED; # use bevy_asset::Assets; # use bevy_math::primitives::Capsule3d; # // Spawn an entity with a mesh using `StandardMaterial`. fn setup( mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>, mut materials: ResMut<Assets<StandardMaterial>>, ) { commands.spawn(( Mesh3d(meshes.add(Capsule3d::default())), MeshMaterial3d(materials.add(StandardMaterial { base_color: RED.into(), ..Default::default() })), )); }
Associated Functions
For function details and documentation, click on the function link.
MeshMaterial2d<ColorMaterial>
MeshMaterial2d
- bevy_asset::handle::Handle<bevy_sprite::mesh2d::color_material::ColorMaterial>
Description
A material used for rendering a [
Mesh2d
].See [
Material2d
] for general information about 2D materials and how to implement your own materials.Example
# use bevy_sprite::{ColorMaterial, MeshMaterial2d}; # use bevy_ecs::prelude::*; # use bevy_render::mesh::{Mesh, Mesh2d}; # use bevy_color::palettes::basic::RED; # use bevy_asset::Assets; # use bevy_math::primitives::Circle; # // Spawn an entity with a mesh using `ColorMaterial`. fn setup( mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>, mut materials: ResMut<Assets<ColorMaterial>>, ) { commands.spawn(( Mesh2d(meshes.add(Circle::new(50.0))), MeshMaterial2d(materials.add(ColorMaterial::from_color(RED))), )); }
Associated Functions
For function details and documentation, click on the function link.
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; } }
Associated Functions
For function details and documentation, click on the function link.
Time<Fixed>
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; } }
Associated Functions
For function details and documentation, click on the function link.
Time<Real>
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; } }
Associated Functions
For function details and documentation, click on the function link.
Time<Virtual>
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; } }
Associated Functions
For function details and documentation, click on the function link.
Range
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Range
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<[u8; 6]>
None
Some
- [u8; 6]
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<String>
None
Some
- String
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<SpatialScale>
None
Some
- bevy_audio::audio::SpatialScale
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Color>
None
Some
- bevy_color::color::Color
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Entity>
None
Some
- bevy_ecs::entity::Entity
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<ForceTouch>
None
Some
- bevy_input::touch::ForceTouch
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<CompassOctant>
None
Some
- bevy_math::compass::CompassOctant
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Rect>
None
Some
- bevy_math::rects::rect::Rect
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Indices>
None
Some
- bevy_mesh::index::Indices
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<ReflectReference>
None
Some
- ReflectReference
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<ScriptValue>
None
Some
- bevy_mod_scripting_core::bindings::script_value::ScriptValue
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<SubCameraView>
None
Some
- bevy_render::camera::camera::SubCameraView
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Viewport>
None
Some
- bevy_render::camera::camera::Viewport
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<TextureAtlas>
None
Some
- bevy_sprite::texture_atlas::TextureAtlas
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<ReflectSchedule>
None
Some
- bevy_system_reflection::ReflectSchedule
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<ReflectSystem>
None
Some
- bevy_system_reflection::ReflectSystem
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Instant>
None
Some
- bevy_utils::Instant
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<WindowTheme>
None
Some
- bevy_window::window::WindowTheme
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<bool>
None
Some
- bool
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<char>
None
Some
- char
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<NonZeroI16>
None
Some
- core::num::NonZeroI16
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<NonZeroU16>
None
Some
- core::num::NonZeroU16
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<NonZeroU32>
None
Some
- core::num::NonZeroU32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<f32>
None
Some
- f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<f64>
None
Some
- f64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<DVec2>
None
Some
- glam::DVec2
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Vec2>
None
Some
- glam::Vec2
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Vec3>
None
Some
- glam::Vec3
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<NodeIndex>
None
Some
- petgraph::graph::NodeIndex
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<u16>
None
Some
- u16
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<u32>
None
Some
- u32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<usize>
None
Some
- usize
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
SmallVec<TypeId(0x537ab1d71b3df3bb6cb5bbdcefa5ba81)>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
SmallVec<TypeId(0xbb89ab0d5b4c0e9af367d34b331091fe)>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
SmallVec<TypeId(0x816d5c242d5c7566479b765bde1a1f64)>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
SmallVec<TypeId(0xc02b4f0291ef0aad60339b7367f351ef)>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<(bevy_ecs::entity::Entity, bevy_picking::backend::HitData)>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<Range>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashSet<GamepadButton>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<(u8, u8)>
None
Some
- (u8, u8)
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<(usize, usize)>
None
Some
- (usize, usize)
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Cow>
None
Some
- alloc::borrow::Cow
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Vec<String>>
None
Some
- alloc::vec::Vecalloc::string::String
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Handle<Image>>
None
Some
- bevy_asset::handle::Handle<bevy_image::image::Image>
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Handle<Mesh>>
None
Some
- bevy_asset::handle::Handle<bevy_mesh::mesh::Mesh>
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<(), InteropError>
Ok
- ()
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<String, InteropError>
Ok
- String
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Entity, InteropError>
Ok
- bevy_ecs::entity::Entity
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<DynamicFunctionMut, InteropError>
Ok
- DynamicFunctionMut
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ScriptComponentRegistration, ScriptResourceRegistration>
Ok
- bevy_mod_scripting_core::bindings::query::ScriptComponentRegistration
Err
- bevy_mod_scripting_core::bindings::query::ScriptResourceRegistration
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ScriptComponentRegistration, InteropError>
Ok
- bevy_mod_scripting_core::bindings::query::ScriptComponentRegistration
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ScriptQueryBuilder, InteropError>
Ok
- bevy_mod_scripting_core::bindings::query::ScriptQueryBuilder
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ReflectReference, InteropError>
Ok
- ReflectReference
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ScriptSystemBuilder, InteropError>
Ok
- bevy_mod_scripting_core::bindings::script_system::ScriptSystemBuilder
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ScriptValue, InteropError>
Ok
- bevy_mod_scripting_core::bindings::script_value::ScriptValue
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ReflectSystem, InteropError>
Ok
- bevy_system_reflection::ReflectSystem
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<bool, InteropError>
Ok
- bool
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<AnimationTargetId, u64>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<GamepadAxis, AxisSettings>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<GamepadButton, ButtonAxisSettings>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<GamepadButton, ButtonSettings>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<GamepadInput, f32>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<NodeIndex, ActiveAnimation>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<NodeIndex, f32>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Vec<Entity>, InteropError>
Ok
- alloc::vec::Vec<bevy_ecs::entity::Entity>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Vec<ScriptQueryResult>, InteropError>
Ok
- alloc::vec::Vec<bevy_mod_scripting_core::bindings::query::ScriptQueryResult>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Vec<FunctionInfo>, InteropError>
Ok
- alloc::vec::Vec<bevy_mod_scripting_core::docgen::info::FunctionInfo>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Vec<ReflectSystem>, InteropError>
Ok
- alloc::vec::Vec<bevy_system_reflection::ReflectSystem>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Option<String>, InteropError>
Ok
- core::option::Optionalloc::string::String
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Option<Entity>, InteropError>
Ok
- core::option::Option<bevy_ecs::entity::Entity>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Option<ReflectReference>, InteropError>
Ok
- core::option::Option<bevy_mod_scripting_core::bindings::reference::ReflectReference>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Option<ScriptValue>, InteropError>
Ok
- core::option::Option<bevy_mod_scripting_core::bindings::script_value::ScriptValue>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Option<ReflectSchedule>, InteropError>
Ok
- core::option::Option<bevy_system_reflection::ReflectSchedule>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Option<ReflectSystem>, InteropError>
Ok
- core::option::Option<bevy_system_reflection::ReflectSystem>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Option<usize>, InteropError>
Ok
- core::option::Option
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
DiGraph
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<String, ScriptValue>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<AnimationEventTarget, Vec<TimedAnimationEvent>>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<AssetId<AnimationGraph>, ThreadedAnimationGraph>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<Entity, Vec<Cascade>>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ScriptTypeRegistration, Result<ScriptComponentRegistration, ScriptResourceRegistration>>
Ok
- bevy_mod_scripting_core::bindings::query::ScriptTypeRegistration
Err
- core::result::Result<bevy_mod_scripting_core::bindings::query::ScriptComponentRegistration, bevy_mod_scripting_core::bindings::query::ScriptResourceRegistration>
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Result<ScriptTypeRegistration, Result<ScriptComponentRegistration, ScriptResourceRegistration>>>
None
Some
- core::result::Result<bevy_mod_scripting_core::bindings::query::ScriptTypeRegistration, core::result::Result<bevy_mod_scripting_core::bindings::query::ScriptComponentRegistration, bevy_mod_scripting_core::bindings::query::ScriptResourceRegistration>>
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Option<Result<ScriptTypeRegistration, Result<ScriptComponentRegistration, ScriptResourceRegistration>>>, InteropError>
Ok
- core::option::Option<core::result::Result<bevy_mod_scripting_core::bindings::query::ScriptTypeRegistration, core::result::Result<bevy_mod_scripting_core::bindings::query::ScriptComponentRegistration, bevy_mod_scripting_core::bindings::query::ScriptResourceRegistration>>>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
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.