本文整理汇总了C#中Hare类的典型用法代码示例。如果您正苦于以下问题:C# Hare类的具体用法?C# Hare怎么用?C# Hare使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Hare类属于命名空间,在下文中一共展示了Hare类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EdgeSource
public EdgeSource(int[] attr_in, Hare.Geometry.Point PtZ0, Hare.Geometry.Point _PtZ, Vector[] _Tangents)
{
attr = attr_in;
Tangent = _Tangents;
Z_Norm = _PtZ - PtZ0;
Z_Range = Z_Norm.Length();
Z_dot = Z_Range * Z_Range;//Hare_math.Dot(Z_Norm, Z_Norm);
Z_Norm/= Z_Range;
Z_Range_2 = Z_Range / 2;
Z_mid = (PtZ0 + _PtZ) / 2;
Vector Bisector = (Tangent[0] + Tangent[1])/2;
Bisector.Normalize();
double BisectAngle = Math.Acos(Hare_math.Dot(Tangent[0], Bisector));
if (BisectAngle == 0) BisectAngle = 1E-12;
v = new double[2] { Math.PI / (2 * BisectAngle), Math.PI / (Utilities.Numerics.PiX2 - 2 * BisectAngle) };
v_4pi = new double[2] { v[0] / (4 * Math.PI), v[1] / (4 * Math.PI) };
v_2pi = new double[2] { v[0] / (2 * Math.PI), v[1] / (2 * Math.PI) };
Normal[0] = Hare_math.Cross(_Tangents[0], Z_Norm);
Normal[1] = Hare_math.Cross(_Tangents[1], Z_Norm*-1);
if(Hare_math.Dot(Normal[0], Bisector) > 0)
{
Normal[0] *= -1;
Normal[1] *= -1;
}
////////////////////////////
//VisCheck//
Rhino.Geometry.Point3d pt = new Rhino.Geometry.Point3d(Z_mid.x, Z_mid.y, Z_mid.z);
Rhino.RhinoDoc.ActiveDoc.Objects.AddLine(pt, pt + new Rhino.Geometry.Point3d(Normal[0].x, Normal[0].y, Normal[0].z));
Rhino.RhinoDoc.ActiveDoc.Objects.AddLine(pt, pt + new Rhino.Geometry.Point3d(Normal[1].x, Normal[1].y, Normal[1].z));
//Rhino.RhinoDoc.ActiveDoc.Objects.AddLine(pt, pt + new Rhino.Geometry.Point3d(Tangent[0].x, Tangent[0].y, Tangent[0].z));
//Rhino.RhinoDoc.ActiveDoc.Objects.AddLine(pt, pt + new Rhino.Geometry.Point3d(Tangent[1].x, Tangent[1].y, Tangent[1].z));
//////Rhino.RhinoDoc.ActiveDoc.Objects.AddPoint(new Rhino.Geometry.Point3d(Z_mid.x, Z_mid.y, Z_mid.z));
}
示例2: AttenuationFilter
public void AttenuationFilter(int no_of_elements, int sampleFrequency, double dist, ref double[] Freq, ref double[] Atten, Hare.Geometry.Point pt)
{
Env_Prop.AttenuationFilter(no_of_elements, sampleFrequency, dist, ref Freq, ref Atten, pt);
}
示例3: Scatter_VeryLate
public override void Scatter_VeryLate(ref OctaveRay Ray, ref Random rand, Hare.Geometry.Vector Normal, double Cos_Theta)
{
if (rand.NextDouble() < Scattering_Coefficient[Ray.Octave, 1])
{
Hare.Geometry.Vector diffx;
Hare.Geometry.Vector diffy;
Hare.Geometry.Vector diffz;
double proj;
//Check that the ray and the normal are both on the same side...
if (Cos_Theta > 0) Normal *= -1;
diffz = Normal;
diffx = new Hare.Geometry.Vector(0, 0, 1);
proj = Math.Abs(Hare.Geometry.Hare_math.Dot(diffz, diffx));
if (0.99 < proj && 1.01 > proj) diffx = new Hare.Geometry.Vector(1, 0, 0);
diffy = Hare.Geometry.Hare_math.Cross(diffz, diffx);
diffx = Hare.Geometry.Hare_math.Cross(diffy, diffz);
diffx.Normalize();
diffy.Normalize();
diffz.Normalize();
double u1;
double u2;
double x;
double y;
double z;
Hare.Geometry.Vector vect;
u1 = 2.0 * Math.PI * rand.NextDouble();
// random azimuth
double Scat_Mod = rand.NextDouble();
u2 = Math.Acos(Scat_Mod);
// random zenith (elevation)
x = Math.Cos(u1) * Math.Sin(u2);
y = Math.Sin(u1) * Math.Sin(u2);
z = Math.Cos(u2);
vect = (diffx * x) + (diffy * y) + (diffz * z);
vect.Normalize();
//Return the new direction
Ray.direction = vect;
}
else
{
//Specular Reflection
Ray.direction -= Normal * Cos_Theta * 2;
}
}
示例4: Reflection_Spectrum
public override System.Numerics.Complex[] Reflection_Spectrum(int sample_frequency, int length, Hare.Geometry.Vector Normal, Hare.Geometry.Vector Dir, int threadid)
{
int a = (int)(Math.Abs(Hare.Geometry.Hare_math.Dot(Dir, Normal))*180/Math.PI / 18);
System.Numerics.Complex[] Ref_trns = new System.Numerics.Complex[length];
for (int j = 0; j < length; j++)
{
double freq = j * (sample_frequency / 2) / length;
Ref_trns[j] = new System.Numerics.Complex(Transfer_FunctionR[a].Interpolate(freq), Transfer_FunctionI[a].Interpolate(freq));
}
return Ref_trns;
}
示例5: Absorb
public override void Absorb(ref BroadRay Ray, out double cos_theta, Hare.Geometry.Vector Normal)
{
cos_theta = Hare.Geometry.Hare_math.Dot(Ray.direction, Normal);
int index = 18 - (int)Math.Round(Math.Acos(Math.Abs(cos_theta)) / angle_incr);
for (int oct = 0; oct < 8; oct++) Ray.Energy[oct] *= (1 - Ang_Coef_Oct[oct][index]);
}
示例6: GetSims
public void GetSims(ref Hare.Geometry.Point[] Src, ref Hare.Geometry.Point[] Rec, ref Direct_Sound[] D, ref ImageSourceData[] IS, ref Receiver_Bank[] RT)
{
Src = new Hare.Geometry.Point[Source.Length];
for (int i = 0; i < Source.Length; i++) Src[i] = Source[i].H_Origin();
Rec = Recs;
if (Direct_Data != null) D = Direct_Data;
if (IS_Data != null) IS = IS_Data;
if (Receiver != null) RT = Receiver;
}
示例7: Rho_C
public double Rho_C(Hare.Geometry.Point pt)
{
return this.Env_Prop.Rho_C(pt);
}
示例8: Attenuation
public double[] Attenuation(Hare.Geometry.Point pt)
{
return this.Env_Prop.Attenuation_Coef(pt);
}
示例9: AttenuationPureTone
public double AttenuationPureTone(Hare.Geometry.Point pt, double frequency)
{
return this.Env_Prop.AttenuationPureTone(pt, frequency);
}
示例10: Reflection_Narrow
public abstract System.Numerics.Complex Reflection_Narrow(double frequency, Hare.Geometry.Vector Dir, Hare.Geometry.Vector Normal);
示例11: Scatter_Early
public abstract void Scatter_Early(ref BroadRay Ray, ref Queue<OctaveRay> Rays, ref Random rand, Hare.Geometry.Vector Normal, double Cos_Theta);
示例12: Scatter_Late
public override void Scatter_Late(ref OctaveRay Ray, ref Queue<OctaveRay> Rays, ref Random rand, Hare.Geometry.Vector Normal, double Cos_Theta)
{
double scat_sel = rand.NextDouble();
if (scat_sel > Scattering_Coefficient[Ray.Octave, 2])
{
// Specular Reflection
Ray.direction -= Normal * Cos_Theta * 2;
return;
}
else if (scat_sel > Scattering_Coefficient[Ray.Octave, 0])
{
//Only for a certain portion of high benefit cases--
//// a. Create new source for scattered energy (E * Scattering).
//// b. Modify E (E * 1 - Scattering).
//Create a new ray...
OctaveRay tr = Ray.SplitRay(1 - Scattering_Coefficient[Ray.Octave,1]);
// this is the specular reflection. Save it for later.
tr.direction -= Normal * Cos_Theta * 2;
if (tr.t_sum == 0)
{
Rhino.RhinoApp.Write("Something's up!");
}
Rays.Enqueue(tr);
}
//If we are here, the original ray needs a scattered direction:
Hare.Geometry.Vector diffx;
Hare.Geometry.Vector diffy;
Hare.Geometry.Vector diffz;
double proj;
//Check that the ray and the normal are both on the same side...
if (Cos_Theta > 0) Normal *= -1;
diffz = Normal;
diffx = new Hare.Geometry.Vector(0, 0, 1);
proj = Math.Abs(Hare.Geometry.Hare_math.Dot(diffz, diffx));
if (0.99 < proj && 1.01 > proj) diffx = new Hare.Geometry.Vector(1, 0, 0);
diffy = Hare.Geometry.Hare_math.Cross(diffz, diffx);
diffx = Hare.Geometry.Hare_math.Cross(diffy, diffz);
diffx.Normalize();
diffy.Normalize();
diffz.Normalize();
double u1;
double u2;
double x;
double y;
double z;
Hare.Geometry.Vector vect;
u1 = 2.0 * Math.PI * rand.NextDouble();
// random azimuth
double Scat_Mod = rand.NextDouble();
u2 = Math.Acos(Scat_Mod);
// random zenith (elevation)
x = Math.Cos(u1) * Math.Sin(u2);
y = Math.Sin(u1) * Math.Sin(u2);
z = Math.Cos(u2);
vect = (diffx * x) + (diffy * y) + (diffz * z);
vect.Normalize();
//Return the new direction
Ray.direction = vect;
}