Enum soft_edge::Axis[][src]

#[repr(u8)]
pub enum Axis {
    PosX,
    PosY,
    PosZ,
    NegX,
    NegY,
    NegZ,
}
Expand description

Represents a single signed axis: +X, +Y, +Z, -X, -Y, or -Z.

These are used to enumerate the faces of the unit cube when deriving the exterior hull of an atom, and are also encoded into the bit representation used by Face.

Note that on the unit cube, you won’t actually find any negative coordinates; the negative axes are used to represent the faces in the direction of the negatives, and so are also sometimes called “zero axes” because they represent the face where the corresponding coordinate is zero.

Variants

PosX

PosY

PosZ

NegX

NegY

NegZ

Implementations

Construct an axis from adjacent integer coordinates, if they are exactly adjacent.

This is useful for when you’re dealing with adjacent atoms and need to find the axis between them so you can join their faces along that axis, for example.

The axis returned corresponds to the vector from p0 towards p1. Returns None if the points are non-adjacent.

Convert this axis to its representative integer unit vector.

Safety

This byte must be a valid Axis (one of the six byte values defined in the enum.)

What vertices on our atom are members of the face on this axis?

Are these two axes parallel? (+X/-X, +Y/-Y, +Z/-Z, pairs of same-sign axes are also acceptible +X/+X, -Y/-Y, etc.)

Get the same axis in the opposite direction. (+X => -X, -Z => +Z)

Does this axis represent a negative/zero axis?

Returns true if self is NegX, NegY, or NegZ.

Does this axis represent a positive/nonzero axis?

Returns true if self is PosX, PosY, or PosZ.

Get the centroid of the face on this axis.

Convenient helper for conversion to usize.

Create an iterator over all six axes.

True if the face set for this axis requires a winding flip.

This is likely not useful to you as a user, and is used internally inside the exterior hull generation algorithm. But it is still useful to document for external understanding:

Winding order of exterior faces and face sets

As a refresher, this is our vertex numbering scheme:

  v3      v7
    *----*
v2 /| v6/|
  *----* |   +Y
  | *--|-*   ^ ^ +Z
  |/v1 |/v5  |/
  *----*     +--> +X
 v0    v4

We want all face windings to be in CCW order. Due to the fact that this order produces a Z-pattern on each face set - e.g. 0, 1, 2, 3, 0, 2, 4, 6, 1, 3, 5, 7, when sorted - the exterior facet generation code will flip the first two vertices: 1, 0, 2, 3, 2, 0, 4, 6, etc., producing what should ideally be a CCW-wound quad.

Unfortunately this is not always the case. Note that the NegY axis’s face set, when sorted, produces 0, 1, 4, 5 for its Z-pattern, and 1, 0, 4, 5 for its wound-pattern. Which, when viewed from below, is a clockwise winding, not counter-clockwise. As such, unless a better descriptor of why stuff must be flipped, we’ll need to just straight up flip NegY to compensate.

Axes that need to be flipped:

  • NegX
  • PosY
  • NegZ

Axes that do not need to be flipped:

  • PosX
  • NegY
  • PosZ

It seems like the reason that we need things to be flipped differently on the Y axis is that this ordering is naturally right-handed, and our “world” coordinate system is left-handed. This is just my hypothesis though, and frankly, as is, this flipping is strictly done because it makes things work.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Converts self into T using Into<T>. Read more

Causes self to use its Binary implementation when Debug-formatted.

Causes self to use its Display implementation when Debug-formatted. Read more

Causes self to use its LowerExp implementation when Debug-formatted. Read more

Causes self to use its LowerHex implementation when Debug-formatted. Read more

Causes self to use its Octal implementation when Debug-formatted.

Causes self to use its Pointer implementation when Debug-formatted. Read more

Causes self to use its UpperExp implementation when Debug-formatted. Read more

Causes self to use its UpperHex implementation when Debug-formatted. Read more

Performs the conversion.

Performs the conversion.

Pipes by value. This is generally the method you want to use. Read more

Borrows self and passes that borrow into the pipe function. Read more

Mutably borrows self and passes that borrow into the pipe function. Read more

Borrows self, then passes self.borrow() into the pipe function. Read more

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more

Borrows self, then passes self.as_ref() into the pipe function.

Mutably borrows self, then passes self.as_mut() into the pipe function. Read more

Borrows self, then passes self.deref() into the pipe function.

Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

Immutable access to a value. Read more

Mutable access to a value. Read more

Immutable access to the Borrow<B> of a value. Read more

Mutable access to the BorrowMut<B> of a value. Read more

Immutable access to the AsRef<R> view of a value. Read more

Mutable access to the AsMut<R> view of a value. Read more

Immutable access to the Deref::Target of a value. Read more

Mutable access to the Deref::Target of a value. Read more

Calls .tap() only in debug builds, and is erased in release builds.

Calls .tap_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Attempts to convert self into T using TryInto<T>. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.