bevy/crates
Sigma-dev 7c8da1c05d
Reworked Segment types into their cartesian forms (#17404)
# Objective

Segment2d and Segment3d are currently hard to work with because unlike
many other primary shapes, they are bound to the origin.
The objective of this PR is to allow these segments to exist anywhere in
cartesian space, making them much more useful in a variety of contexts.

## Solution

Reworking the existing segment type's internal fields and methods to
allow them to exist anywhere in cartesian space.
I have done both reworks for 2d and 3d segments but I was unsure if I
should just have it all here or not so feel free to tell me how I should
proceed, for now I have only pushed Segment2d changes.

As I am not a very seasoned contributor, this first implementation is
very likely sloppy and will need some additional work from my end, I am
open to all criticisms and willing to work to get this to bevy's
standards.

## Testing

I am not very familiar with the standards of testing. Of course my
changes had to pass the thorough existing tests for primitive shapes.
I also checked the gizmo 2d shapes intersection example and everything
looked fine.

I did add a few utility methods to the types that have no tests yet. I
am willing to implement some if it is deemed necessary

## Migration Guide

The segment type constructors changed so if someone previously created a
Segment2d with a direction and length they would now need to use the
`from_direction` constructor

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Joona Aalto <jondolf.dev@gmail.com>
2025-01-19 03:54:45 +00:00
..
bevy_a11y Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_animation Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_app Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_asset Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_audio Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_color Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_core_pipeline Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_derive Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_dev_tools Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_diagnostic Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_dylib Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_ecs Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_encase_derive Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_gilrs Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_gizmos Reworked Segment types into their cartesian forms (#17404) 2025-01-19 03:54:45 +00:00
bevy_gltf Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_image Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_input Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_input_focus Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_internal Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_log Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_macro_utils Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_math Reworked Segment types into their cartesian forms (#17404) 2025-01-19 03:54:45 +00:00
bevy_mesh Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_mikktspace Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_pbr Forward decals (port of bevy_contact_projective_decals) (#16600) 2025-01-15 02:31:30 +00:00
bevy_picking Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_ptr Update safety docs for Ptr::assert_unique (#17394) 2025-01-16 03:25:19 +00:00
bevy_reflect Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_remote Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_render Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_scene Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_sprite Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_state Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_tasks Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_text Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_time Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_transform Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_ui Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_utils Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_window Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_winit Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00