6 namespace droid.Runtime.Utilities.Structs {
15 public int DecimalGranularity {
16 get {
return this._decimal_granularity; }
17 set { this._decimal_granularity = value; }
40 get {
return this._distribution_sampler; }
41 set { this._distribution_sampler = value; }
44 public Space2(
int decimal_granularity = 2) : this() {
45 this._Min_Values = Vector2.one * -100f;
46 this._Max_Values = Vector2.one * 100f;
47 this._decimal_granularity = decimal_granularity;
54 public Vector2 Span {
get {
return this._Max_Values - this._Min_Values; } }
58 return new Space1(this.DecimalGranularity) {
59 _Min_Value = this._Min_Values.x,
60 _Max_Value = this._Max_Values.x
67 return new Space1(this.DecimalGranularity) {
68 _Min_Value = this._Min_Values.y,
69 _Max_Value = this._Max_Values.y
82 return new Vector3(x, y);
91 if (v.x >
this._Max_Values.x) {
92 v.x = this._Max_Values.x;
93 }
else if (v.x <
this._Min_Values.x) {
94 v.x = this._Min_Values.x;
97 if (this.Span.x > 0) {
98 v.x = this.Round((v.x -
this._Min_Values.x) /
this.Span.x);
103 if (v.y >
this._Max_Values.y) {
104 v.y = this._Max_Values.y;
105 }
else if (v.y <
this._Min_Values.y) {
106 v.y = this._Min_Values.y;
109 if (this.Span.y > 0) {
110 v.y = this.Round((v.y -
this._Min_Values.y) /
this.Span.y);
122 public float Round(
float v) {
return (
float)Math.Round(v, this.DecimalGranularity); }
128 get {
return new Space2(1) {_Min_Values = Vector2.zero, _Max_Values = Vector2.one}; }
132 get {
return new Space2(1) {_Min_Values = Vector2.one * 0.2f, _Max_Values = Vector2.one * 0.8f}; }
135 public bool IsNormalised {
get {
return this.normalised; }
set { this.normalised = value; } }
DistributionSampler _distribution_sampler
Space2(int decimal_granularity=2)
Vector2 ClipNormaliseRound(Vector2 v)
float Range(float min, float max)