Class TVector3List

Unit

Declaration

type TVector3List = class(specialize TStructList<TVector3>)

Description

List of TVector3. Note that the notification mechanism (OnNotify) is broken here by routines like AddRange and AddSubRange (for maximum speed).

Source: base/castlevectors_lists.inc (line 50).

Hierarchy

Show Additional Members:

Overview

Nested Types

Public PtrT = ˆT;
Public PTypeList = ˆTTypeList;
Public TTypeList = array [0 .. MaxInt div SizeOf(T) - 1] of T;

Methods

Public function List: PTypeList; deprecated 'use L, like MyList.L[123] instead of MyList.Listˆ[123]';
Public function L: PtrT;
Public function Add: PtrT; overload;
Public function Ptr(const I: TListSize): PtrT;
Public procedure Assign(const Source: TStructList ); overload;
Public procedure Assign(const A: array of T); overload;
Public function ItemSize: TListSize;
Public procedure AddSubRange(const Source: TStructList ; const Index, AddCount: TListSize);
Public procedure AssignLerpRange(const Fraction: Single; const V1, V2: TStructList ; const Index1, Index2, ACount: TListSize); virtual;
Public procedure AssignLerp(const Fraction: Single; const V1, V2: TStructList );
Public function PerfectlyEquals( const SecondValue: TStructList): Boolean;
Public procedure AddArray(const A: array of T); deprecated 'use AddRange';
Public procedure AddList(const Source: TStructList ); deprecated 'use AddRange';
Public procedure AssignArray(const A: array of T); deprecated 'use Assign';
Public procedure AssignNegated(const Source: TVector3List); deprecated 'use Assign and Negate separately';
Public procedure Negate;
Public procedure Normalize;
Public procedure MultiplyComponents(const V: TVector3);
Public procedure AssignLerpRange(const Fraction: Single; const V1, V2: specialize TStructList<TVector3>; const Index1, Index2, ACount: TListSize); override;
Public procedure AssignLerpNormalize(const Fraction: Single; const V1, V2: TVector3List; const Index1, Index2, ACount: TListSize);
Public procedure AssignLerpRgbInHsv(const Fraction: Single; const V1, V2: TVector3List; const Index1, Index2, ACount: TListSize);
Public procedure AddRange(const Source: TVector3List); overload;
Public procedure AddSubRange(const Source: TVector3List; const Index, AddCount: Integer);
Public procedure AddListRange(const Source: TVector3List; const Index, AddCount: Integer); deprecated 'use AddSubRange';
Public procedure AddRangeTransformed(const Source: TVector3List; const Transform: TMatrix4);
Public function ToVector4(const W: Single): TVector4List;
Public function MergeCloseVertexes(MergeDistance: Single): Cardinal;
Public function Equals(SecondValue: TObject): boolean; override;

Description

Nested Types

Public PtrT = ˆT;

This item is declared in ancestor TStructList.

This item has no description.

Source: base/castleutils_struct_list.inc (line 30).

Public PTypeList = ˆTTypeList;

This item is declared in ancestor TStructList.

This item has no description.

Source: base/castleutils_struct_list.inc (line 37).

Public TTypeList = array [0 .. MaxInt div SizeOf(T) - 1] of T;

This item is declared in ancestor TStructList.

TODO: Can we calculate better size on Delphi? Now we just assume that T has max size 16 * 16. This declaration will fail if you try to use TStructList with larger T. Note: we cannot declare list size too small, or using it may fail with range check error (e.g. Delphi, in IndexedPolygons_TrianglesCount, testcase: build_3d_object_by_code_2_tunnel.

Source: base/castleutils_struct_list.inc (line 36).

Methods

Public function List: PTypeList; deprecated 'use L, like MyList.L[123] instead of MyList.Listˆ[123]';

This item is declared in ancestor TStructList.

Warning: this symbol is deprecated: use L, like MyList.L[123] instead of MyList.Listˆ[123]

Access the list contents through a pointer to an array of items.

This is exactly the same pointer as L, but the type is different: List points to an array of items, while L points to a single item.

Using L is preferred over this List, because L avoids "fake infinite list" type TTypeList, that in particular on Delphi may have too small size (and cause range check errors).

See the L description for a more detailed explanation and example.

See also
L
Access the list contents through a pointer, to get or set them efficiently.

Source: base/castleutils_struct_list.inc (line 51).

Public function L: PtrT;

This item is declared in ancestor TStructList.

Access the list contents through a pointer, to get or set them efficiently.

Use this to directly access a list value, like this:

MyIntList.L[I] := 123;
// Equivalent but less efficient to syntax without L:
// MyIntList[I] := 123;

MyIntList.L[I] := MyIntList.L[I] + 123;
// Equivalent but less efficient to syntax without L:
// MyIntList[I] := MyIntList[I] + 123;

MyRecordList.L[I].MyField := 123;
// Never use syntax without L (see below for reasons):
// MyRecordList[I].MyField := 123; //< never do this!

The above examples of L work only in FPC ObjFpc mode or in Delphi with pointermath "on" (see https://docwiki.embarcadero.com/RADStudio/Sydney/en/Pointer_Math_(Delphi) ). These are CGE default settings when being compiled with FPC or Delphi, so you can depend on them at least in CGE implementation. Note that Delphi code using this doesn't need to be compiled with pointermath "on", it is enough that this unit is compiled with pointermath "on" and then one can use math on PtrT.

This is in particular useful if you have a list of records and you would like to set their fields. E.g. this is incorrect (and should not even compile if MyField is really a simple field):

type
  TMyRecord = record MyField: Integer; end;
  TMyRecordList = specialize TGenericStructList<TMyRecord>;
var
  MyList: TMyRecordList;
begin
  // ...
  MyList[I].MyField := 123;

It will not work OK because you would modify only a temporary record returned by the MyList[I] getter.

In contrast, this will work OK:

MyList.L[I].MyField := 123;

Using L is preferred over this List, because it avoids "fake infinite list" type TTypeList, that in particular on Delphi may have too small size.

See also
List
Access the list contents through a pointer to an array of items.

Source: base/castleutils_struct_list.inc (line 108).

Public function Add: PtrT; overload;

This item is declared in ancestor TStructList.

Increase Count and return pointer to new item. Comfortable and efficient way to add a new item that you want to immediately initialize.

Source: base/castleutils_struct_list.inc (line 118).

Public function Ptr(const I: TListSize): PtrT;

This item is declared in ancestor TStructList.

Pointer to ith item.

Source: base/castleutils_struct_list.inc (line 121).

Public procedure Assign(const Source: TStructList ); overload;

This item is declared in ancestor TStructList.

This item has no description.

Source: base/castleutils_struct_list.inc (line 123).

Public procedure Assign(const A: array of T); overload;

This item is declared in ancestor TStructList.

This item has no description.

Source: base/castleutils_struct_list.inc (line 124).

Public function ItemSize: TListSize;

This item is declared in ancestor TStructList.

This item has no description.

Source: base/castleutils_struct_list.inc (line 126).

Public procedure AddSubRange(const Source: TStructList ; const Index, AddCount: TListSize);

This item is declared in ancestor TStructList.

Add a subrange of another list here.

This method may ignore the OnNotify mechanism, for the sake of fast execution.

Source: base/castleutils_struct_list.inc (line 131).

Public procedure AssignLerpRange(const Fraction: Single; const V1, V2: TStructList ; const Index1, Index2, ACount: TListSize); virtual;

This item is declared in ancestor TStructList.

Assign here a linear interpolation of two other arrays. We take ACount items, from V1[Index1 ... Index1 + ACount - 1] and V2[Index2 ... Index2 + ACount - 1], and interpolate between them.

It's Ok for both V1 and V2 to be the same objects. But their ranges should not overlap, for future optimizations.

Exceptions raised
ELinearInterpolationImpossible
On classes where linear interpolation is not possible, e.g. we cannot linearly interpolate lists of strings.

Source: base/castleutils_struct_list.inc (line 143).

Public procedure AssignLerp(const Fraction: Single; const V1, V2: TStructList );

This item is declared in ancestor TStructList.

Assign linear interpolation between two other arrays.

Exceptions raised
EListsDifferentCount
If V1 and V2 have different count.
ELinearInterpolationImpossible
On classes where linear interpolation is not possible, e.g. we cannot linearly interpolate lists of strings.

Source: base/castleutils_struct_list.inc (line 151).

Public function PerfectlyEquals( const SecondValue: TStructList): Boolean;

This item is declared in ancestor TStructList.

Does the SecondValue have equal type, length and content. The values are compared perfectly, without any tolerance for difference.

Source: base/castleutils_struct_list.inc (line 156).

Public procedure AddArray(const A: array of T); deprecated 'use AddRange';

This item is declared in ancestor TStructList.

Warning: this symbol is deprecated: use AddRange

This item has no description.

Source: base/castleutils_struct_list.inc (line 159).

Public procedure AddList(const Source: TStructList ); deprecated 'use AddRange';

This item is declared in ancestor TStructList.

Warning: this symbol is deprecated: use AddRange

This item has no description.

Source: base/castleutils_struct_list.inc (line 160).

Public procedure AssignArray(const A: array of T); deprecated 'use Assign';

This item is declared in ancestor TStructList.

Warning: this symbol is deprecated: use Assign

This item has no description.

Source: base/castleutils_struct_list.inc (line 161).

Public procedure AssignNegated(const Source: TVector3List); deprecated 'use Assign and Negate separately';

Warning: this symbol is deprecated: use Assign and Negate separately

This item has no description.

Source: base/castlevectors_lists.inc (line 52).

Public procedure Negate;

Negate all items.

Source: base/castlevectors_lists.inc (line 55).

Public procedure Normalize;

Normalize all items. Zero vectors are left as zero.

Source: base/castlevectors_lists.inc (line 58).

Public procedure MultiplyComponents(const V: TVector3);

Multiply each item, component-wise, with V.

Source: base/castlevectors_lists.inc (line 61).

Public procedure AssignLerpRange(const Fraction: Single; const V1, V2: specialize TStructList<TVector3>; const Index1, Index2, ACount: TListSize); override;

This item has no description.

Source: base/castlevectors_lists.inc (line 63).

Public procedure AssignLerpNormalize(const Fraction: Single; const V1, V2: TVector3List; const Index1, Index2, ACount: TListSize);

Assign linear interpolation between two other vector arrays, and normalize resulting vectors.

See also
AssignLerp
Assign linear interpolation between two other arrays.

Source: base/castlevectors_lists.inc (line 70).

Public procedure AssignLerpRgbInHsv(const Fraction: Single; const V1, V2: TVector3List; const Index1, Index2, ACount: TListSize);

Assign linear interpolation between two other vector arrays, treating vectors as RGB colors and interpolating in HSV space.

See also
AssignLerp
Assign linear interpolation between two other arrays.

Source: base/castlevectors_lists.inc (line 77).

Public procedure AddRange(const Source: TVector3List); overload;

This item has no description.

Source: base/castlevectors_lists.inc (line 81).

Public procedure AddSubRange(const Source: TVector3List; const Index, AddCount: Integer);

This item has no description.

Source: base/castlevectors_lists.inc (line 82).

Public procedure AddListRange(const Source: TVector3List; const Index, AddCount: Integer); deprecated 'use AddSubRange';

Warning: this symbol is deprecated: use AddSubRange

This item has no description.

Source: base/castlevectors_lists.inc (line 83).

Public procedure AddRangeTransformed(const Source: TVector3List; const Transform: TMatrix4);

This item has no description.

Source: base/castlevectors_lists.inc (line 85).

Public function ToVector4(const W: Single): TVector4List;

Convert to TVector4List, with 4th vector component in new array set to constant W.

Source: base/castlevectors_lists.inc (line 89).

Public function MergeCloseVertexes(MergeDistance: Single): Cardinal;

When two vertexes on the list are closer than MergeDistance, set them truly (exactly) equal. Returns how many vertex positions were changed.

Source: base/castlevectors_lists.inc (line 94).

Public function Equals(SecondValue: TObject): boolean; override;

Does the SecondValue have equal length and content. The values are compared with an Epsilon tolerance, as usual for floating-point values.

Source: base/castlevectors_lists.inc (line 99).


Generated by PasDoc 0.17.0.snapshot.