Difference between revisions of "User:Cron Stardust/LLVector Spec"

From Second Life Wiki
Jump to navigation Jump to search
(Starting skeleton - just needs the methods.)
 
Line 24: Line 24:


== Public Methods ==
== Public Methods ==
In the below please replace LLVector with the name of your specific type.  Also replace any instants of NUM with your specific class's base type; eg. F32, F64, &c.
Inlining or not shall be determined on a case-by-case basis.
All methods that have a return type of LLVector& shall return a reference to the current instance.
=== Serialization ===
* LLSD getValue()
* LLVector& setValue(const LLSD& sd)
=== Setting ===
Methods in this category shall mimic the constructors.
* LLVector& setZero()
* LLVector& set(NUM x, NUM y, ...) // However many axis are needed to fully define the current type.  Defaulting some values is acceptable.
=== Reading ===
* NUM length() const
* BOOL isFinite() const
* BOOL isNull() const
* BOOL isExactlyZero() const
=== Modifying ===

Revision as of 20:00, 2 April 2014

This is a simple specification for all LLVector formats. This does NOT include the LLColor formats.

Everything below is to be considered a minimum compatibility specification. Specific type implementations are free to add extra items as their own use cases dictate.

Every type that is only differentiated from another type by the precision, or number of bits, in its components shall be directly compatible: all such related types are to implement the same public interface.

It is recommended that types be freely convertible between themselves, but this is not a requirement.

Public Static Properties

  • zero
  • [xyzw]_axis
  • [xyzw]_axis_neg

Where you see [xyzw] create one property for each applicable character - a 2D type will only need X and Y for instance.

Public Constructors

  • Basic Constructor: ()
  • Direct-value Constructor: (x, y, ...)
  • Array Constructor: (*vec, len=C) // where C is the expected count of elements in X, Y, Z, W order.

Public Properties

  • Array of values: mV or mdV
    • Each element in the array represents the, if applicable, X, Y, Z, and W values of the vector.

Public Methods

In the below please replace LLVector with the name of your specific type. Also replace any instants of NUM with your specific class's base type; eg. F32, F64, &c.

Inlining or not shall be determined on a case-by-case basis.

All methods that have a return type of LLVector& shall return a reference to the current instance.

Serialization

  • LLSD getValue()
  • LLVector& setValue(const LLSD& sd)

Setting

Methods in this category shall mimic the constructors.

  • LLVector& setZero()
  • LLVector& set(NUM x, NUM y, ...) // However many axis are needed to fully define the current type. Defaulting some values is acceptable.

Reading

  • NUM length() const
  • BOOL isFinite() const
  • BOOL isNull() const
  • BOOL isExactlyZero() const

Modifying