internal void onClear() { mCone = null; mConeProj = null; mLastProjection = Projection.FRONT; mLastProjectionParams = null; }
bool ContainsLight(Plane leftPlane, Plane rightPlane, int lightIndex) { var hit = true; var sphere = new Sphere { center = positions[lightIndex], radius = radiuses[lightIndex] }; if (SphereBehindPlane(sphere, leftPlane) || SphereBehindPlane(sphere, rightPlane)) { hit = false; } if (hit && lightTypes[lightIndex] == LightType.Spot) { var cone = new Cone { tip = sphere.center, direction = directions[lightIndex], height = radiuses[lightIndex], radius = coneRadiuses[lightIndex] }; if (ConeBehindPlane(cone, leftPlane) || ConeBehindPlane(cone, rightPlane)) { hit = false; } } return(hit); }
public void TestConeIntersectionList() { Cone cone = new Cone(r: 1f, h: 1f); Ray ray = new Ray(origin: new Point(1.5f, 0f, 0.5f), dir: -Constant.VEC_X); List<HitRecord?> hits = cone.rayIntersectionList(ray); List<HitRecord?> expected = new List<HitRecord?>(); expected.Add(new HitRecord( new Point(0.5f, 0f, 0.5f), new Normal(MathF.Sqrt(2f) / 2f, 0f, MathF.Sqrt(2f) / 2f), new Vec2D(0.5f, 0.5f), 1f, ray) ); expected.Add(new HitRecord( new Point(-0.5f, 0f, 0.5f), new Normal(MathF.Sqrt(2f) / 2f, 0f, -MathF.Sqrt(2f) / 2f), new Vec2D(0.75f, 0.5f), 2f, ray) ); expected.Sort(); Assert.True(expected.Count == hits.Count); for (int i = 0; i < 2; i++) { Assert.True(hits[i]?.isClose((HitRecord)expected[i]), $"TestRayIntersectionList {i} failed"); } }
protected Cone UnpackCone() { Cone o = new Cone(); o.Transform = UnpackMeshTransform(); o.Position = ReadVector3F(); o.Size = ReadVector3F(); o.Rotation = ReadFloat(); o.SweepAngle = ReadFloat(); o.Divisions = ReadInt32(); o.PhysicsID = ReadInt32(); for (int i = 0; i < 2; i++) { o.TextureSize[i] = ReadFloat(); } for (Cone.MaterialLocations loc = Cone.MaterialLocations.Edge; loc < Cone.MaterialLocations.MaterialCount; loc++) { o.MaterialIDs.Add(loc, ReadInt32()); } byte stateByte = ReadByte(); o.DriveThrough = (stateByte & (1 << 0)) != 0; o.ShootThrough = (stateByte & (1 << 1)) != 0; o.SmoothBounce = (stateByte & (1 << 2)) != 0; o.UseNormals = (stateByte & (1 << 3)) != 0; o.Ricochet = (stateByte & (1 << 4)) != 0; return(o); }
static bool ConeBehindPlane(Cone cone, Plane plane) { float3 furthestPointDirection = math.cross(math.cross(plane.normal, cone.direction), cone.direction); float3 furthestPointOnCircle = cone.tip + cone.direction * cone.height - furthestPointDirection * cone.radius; return(PointBehindPlane(cone.tip, plane) && PointBehindPlane(furthestPointOnCircle, plane)); }
public void TestConeRayIntersect() { var shape = new Cone(); var rays = new List <Ray>() { new Ray(new Point(0, 0, -5), (new Vector(0, 0, 1)).Normalize), new Ray(new Point(0, 0, -5), (new Vector(1, 1, 1)).Normalize), new Ray(new Point(1, 1, -5), (new Vector(-0.5, -1, 1)).Normalize) }; var Ts = new double[, ] { { 5, 5 }, { 8.66025, 8.66025 }, { 4.55006, 49.44994 } }; for (int i = 0; i < rays.Count; i++) { var r = rays[i]; var xs = shape.Intersect(r); Assert.AreEqual(xs.Count, 2); Assert.AreEqual(xs[0].t, Ts[i, 0], epsilon); Assert.AreEqual(xs[1].t, Ts[i, 1], epsilon); } }
public void TestisPointInside() { Cone cone = new Cone(r: 0.5f, h: 2); Assert.True(cone.isPointInside(new Point(0f, 0f, 1.5f))); Assert.True(cone.isPointInside(new Point(0.25f, 0.25f, 0f))); Assert.False(cone.isPointInside(new Point(0.5f, 0.5f, 1f))); }
// method to display a Circle object private void Display(Circle c) { ListViewItem lvi = null; if (c is Cone) { // cast C to a cone object Cone co = (Cone)c; // create a listviewItem (one row in a listview) string[] items = { co.GetType().Name, co.Radius.ToString("f3"), co.Height.ToString("f3"), co.Perimeter().ToString("f3"), co.Area().ToString("f3"), co.Volume().ToString("f3") }; lvi = new ListViewItem(items); } else if (c is Cylinder) { // cast C to a cylinder object Cylinder cy = (Cylinder)c; // create a listviewItem (one row in a listview) string[] items = { cy.GetType().Name, cy.Radius.ToString("f3"), cy.Height.ToString("f3"), cy.Perimeter().ToString("f3"), cy.Area().ToString("f3"), cy.Volume().ToString("f3") }; lvi = new ListViewItem(items); } else if (c is Sphere) { // castc to a Sphere object Sphere sp = (Sphere)c; // create a listviewItem string[] items = { sp.GetType().Name, sp.Radius.ToString("f3"), "0", sp.Perimeter().ToString("f3"), sp.Area().ToString("f3"), sp.Volume().ToString("f3") }; lvi = new ListViewItem(items); } else { // create a listviewItem (one row in a listview) string[] items = { c.GetType().Name, c.Radius.ToString("f3"), "0", c.Perimeter().ToString("f3"), c.Area().ToString("f3"), c.Volume().ToString("f3") }; lvi = new ListViewItem(items); } // add the row to the listview listView1.Items.Add(lvi); // making the last item visible listView1.EnsureVisible(listView1.Items.Count - 1); }
public void AttachComponent(ShipComponent component) { if (component.GetShipComponentType() == ShipComponentType.CONE) { cone = (Cone)component; component.PlaceComponent(conePosition); } else if (component.GetShipComponentType() == ShipComponentType.ENGINE) { engine = (Engine)component; component.PlaceComponent(enginePosition); } else if (component.GetShipComponentType() == ShipComponentType.FUEL) { fuel = (Fuel)component; component.PlaceComponent(fuelPosition); } else if (component.GetShipComponentType() == ShipComponentType.WING) { wing = (Wing)component; component.PlaceComponent(wingPosition); } if (cone != null && engine != null && fuel != null && wing != null) { SceneManager.LoadScene("WinScene"); } }
//Make the extended cone to intersect with private List <Cone> GetExtendedCones(Brep _brepVoid, Point3d _ptRandom, double _extraBcTangent) { var brepVoid = _brepVoid; var ptRandom = _ptRandom; var extraBcTangent = _extraBcTangent; var bb = brepVoid.GetBoundingBox(true); var sph = new Sphere(bb.Center, (bb.Max.X - bb.Min.X) / 2); var centerPoint = sph.Center; var sphereRadius = sph.Radius; var sphereRadiusExtended = sphereRadius + extraBcTangent; var vectorCone = centerPoint - ptRandom; var planeCone = new Plane(ptRandom, vectorCone); //Cone cone = new Cone(planeCone, vectorCone.Length, sphereRadius); int iExtend = 10; List <Cone> coneExtendedList = new List <Cone>(); Cone coneExtended = new Cone(planeCone, vectorCone.Length * iExtend, sphereRadiusExtended * iExtend); coneExtendedList.Add(coneExtended); return(coneExtendedList); }
// Start is called before the first frame update void Start() { cone = null; engine = null; fuel = null; wing = null; }
private Cone GetConeAtParameter(double t) { Point point = Point.Create(GetHyperbolicRadius(t), 0, t); double slope = A * t / B / B / Math.Sqrt(1 + Math.Pow(t / B, 2)); double angle; if (Accuracy.LengthIsZero(slope)) { angle = Math.PI / 2; } else { angle = Math.Atan(-1 / slope); } if (Accuracy.AngleIsNegative(angle)) { angle += Math.PI; } Debug.Assert(angle < Math.PI && angle > 0, "Cone angle improper."); Frame frame = Frame.Create(Point.Create(0, 0, t), Direction.DirX, Direction.DirY); return(Cone.Create(frame, GetHyperbolicRadius(t), angle)); }
private double GetAverageVolOfShapes(List <Circle> shapes) { double totalVolume = 0; foreach (Circle c in shapes) { if (c is Cone) { // Cast c to a cone Cone co = (Cone)c; totalVolume += co.Volume(); } else if (c is Cylinder) { // cast C to a cylinder object Cylinder cy = (Cylinder)c; totalVolume += cy.Volume(); } else if (c is Sphere) { // castc to a Sphere object Sphere sp = (Sphere)c; totalVolume += sp.Volume(); } else { totalVolume += c.Volume(); } } return(totalVolume / shapes.Count); }
private static Model3DGroup CreateAxisAndArrowHead(RotateTransform3D rotateTransform, TranslateTransform3D translateTransform, Material material) { Model3DGroup model3Dgroup = new Model3DGroup(); Model3DCollection model3Dcollection = new Model3DCollection(); model3Dgroup.Children = model3Dcollection; Model3DGroup cylinder = Cylinder.CreateCylinder(0.02, 0.5, 12, material, material, (Material)null); if (rotateTransform != null) { cylinder.Transform = (Transform3D)rotateTransform; } model3Dgroup.Children.Add((Model3D)cylinder); Model3DGroup cone = Cone.CreateCone(0.04, 0.1, 12, material, material); if (rotateTransform != null) { cone.Transform = (Transform3D) new Transform3DGroup() { Children = { (Transform3D)rotateTransform, (Transform3D)translateTransform } } } ; else { cone.Transform = (Transform3D)translateTransform; } model3Dgroup.Children.Add((Model3D)cone); model3Dgroup.Freeze(); return(model3Dgroup); }
public MeshPreviewSelector() { InitializeComponent(); var previewRenderer = new PreviewRenderer(new Size(200, 200)); previewRenderer.BackgroundColor = new Vector4(0.75f, 0.75f, 0.75f, 1f); var meshes = new List <Mesh>(); meshes.Add(Icosahedron.Create(0.45f, 0)); meshes.Add(Icosahedron.Create(0.45f, 1)); meshes.Add(Tube.Create(0.3f, 0.35f, 0.7f, 20)); meshes.Add(Cloud.Create(CloudShape.Sphere, 0.9f, 50000)); meshes.Add(Cone.Create(0.3f, 0.8f)); meshes.Add(TrefoilKnot.Create()); var rotation = Quaternion.CreateFromYawPitchRoll(0, -0.25f, -0.2f); MeshesListBox.ItemsSource = meshes .Select(_ => new MeshPreviewViewModel(_, previewRenderer.RenderPreview(_, rotation))) .ToArray(); previewRenderer.Dispose(); }
public void TestConeNotOpenToPovCode() { var cone = new Cone(); var povCode = cone.ToPovCode(); Check.That(povCode).IsEqualTo("cone {\n < 0, 0, 0>, 1\n < 0, 1, 0>, 0\n}"); }
public void IntersectEndCaps() { Cone cone = new Cone(); cone.MinHeight = -0.5f; cone.MaxHeight = 0.5f; cone.Closed = true; Point org01 = new Point(0, 0, -5); Point org02 = new Point(0, 0, -0.25f); Point org03 = new Point(0, 0, -0.25f); Vector3 d01 = new Vector3(0, 1, 0).Normalize(); Vector3 d02 = new Vector3(0, 1, 1).Normalize(); Vector3 d03 = new Vector3(0, 1, 0).Normalize(); Ray r01 = new Ray(org01, d01); Ray r02 = new Ray(org02, d02); Ray r03 = new Ray(org03, d03); List <Intersection> xs01 = cone.LocalIntersects(r01); List <Intersection> xs02 = cone.LocalIntersects(r02); List <Intersection> xs03 = cone.LocalIntersects(r03); Assert.True(xs01.Count == 0); Assert.True(xs02.Count == 2); Assert.True(xs03.Count == 4); }
public void ComputingNormalVectorTest(double x, double y, double z, double dx, double dy, double dz) { var shape = new Cone(); var n = shape.NormalAtLocal(Helper.CreatePoint(x, y, z)); Check.That(n).IsEqualTo(Helper.CreateVector(dx, dy, dz)); }
public void InfiniteMinAndMaxByDefault() { var c = new Cone(); c.Minimum.Should().Be(float.NegativeInfinity); c.Maximum.Should().Be(float.PositiveInfinity); }
/// <summary> /// Call this method to get a <see cref="Cone"/> primitive for this mesh. If this /// meshes <see cref="PrimitiveType"/> is not a <see cref="Rhino.Render.RenderPrimitiveType.Cone"/> /// then the cone parameter is set to <see cref="Cone.Unset"/> and the truncation /// parameter is set to <see cref="Plane.Unset"/>. /// </summary> /// <param name="cone"> /// Gets set to the cone primitive for this object on success or <see cref="Cone.Unset"/> on error. /// </param> /// <param name="truncation"> /// Gets set to the truncation plane for this object on success or <see cref="Plane.Unset"/> on error. /// </param> /// <returns> /// Returns true if <see cref="PrimitiveType"/> is <see cref="Rhino.Render.RenderPrimitiveType.Cone"/> and /// the cone and truncation parameters were initialized otherwise returns false. /// </returns> public bool TryGetCone(out Cone cone, out Plane truncation) { var origin = new Point3d(); var xaxis = new Vector3d(); var yaxis = new Vector3d(); var height = 0.0; var radius = 0.0; var t_origin = new Point3d(); var t_xaxis = new Vector3d(); var t_yaxis = new Vector3d(); var const_pointer = ConstPointer(); var success = (1 == UnsafeNativeMethods.Rdk_RenderMesh_Cone(const_pointer, ref origin, ref xaxis, ref yaxis, ref height, ref radius, ref origin, ref xaxis, ref yaxis)); if (success) { cone = new Cone(new Plane(origin, xaxis, yaxis), height, radius); truncation = new Plane(t_origin, t_xaxis, t_yaxis); } else { cone = Cone.Unset; truncation = Plane.Unset; } return(success); }
public void IntersectCone() { Cone cone = new Cone(); Point org01 = new Point(0, 0, -5); Point org02 = new Point(0, 0, -5); Point org03 = new Point(1, 1, -5); Vector3 d01 = new Vector3(0, 0, 1).Normalize(); Vector3 d02 = new Vector3(1, 1, 1).Normalize(); Vector3 d03 = new Vector3(-0.5f, -1, 1).Normalize(); Ray r01 = new Ray(org01, d01); Ray r02 = new Ray(org02, d02); Ray r03 = new Ray(org03, d03); List <Intersection> xs01 = cone.LocalIntersects(r01); List <Intersection> xs02 = cone.LocalIntersects(r02); List <Intersection> xs03 = cone.LocalIntersects(r03); Assert.True(xs01[0].t == 5); Assert.True(Utilities.FloatEquality(xs02[0].t, 8.66025f)); Assert.True(Utilities.FloatEquality(xs03[0].t, 4.55006f));; Assert.True(xs01[1].t == 5); Assert.True(Utilities.FloatEquality(xs02[1].t, 8.66025f)); Assert.True(Utilities.FloatEquality(xs03[1].t, 49.44994f)); }
public override void OnInspectorGUI() { DrawDefaultInspector(); Cone myScript = (Cone)target; if (GUILayout.Button("Build Cone")) { myScript.BuildCone(myScript.gameObject, myScript.HeightSegment, myScript.bottomRadius, myScript.topRadius); } if (GUILayout.Button("Grow Branch")) { myScript.GrowBranch(); } if (GUILayout.Button("Clear Branches")) { myScript.ClearChildren(); } using (var check = new EditorGUI.ChangeCheckScope()) { // Block of code with controls // that may set GUI.changed to true EditorGUILayout.IntSlider(HeightSegment, 8, 30, new GUILayoutOption[] { GUILayout.Height(20), GUILayout.ExpandHeight(false) }); EditorGUILayout.Slider(bottomRadius, 0, 1f, new GUILayoutOption[] { GUILayout.Height(20), GUILayout.ExpandHeight(false) }); EditorGUILayout.Slider(topRadius, 0, 0.5f, new GUILayoutOption[] { GUILayout.Height(20), GUILayout.ExpandHeight(false) }); if (check.changed) { myScript.BuildCone(myScript.gameObject, myScript.HeightSegment, myScript.bottomRadius, myScript.topRadius); // Code to execute if GUI.changed // was set to true inside the block of code above. } serializedObject.ApplyModifiedProperties(); } }
/// <summary> /// Call this method to get a box at the specified index. /// </summary> /// <param name="index"> /// The zero based index of the item in the list. Valid values are greater /// than or equal to 0 and less than Count. /// </param> /// <param name="cone"> /// Will contain the cone at the requested index if the index is in range /// and the primitive at the requested index is a box. /// </param> /// <param name="truncation"> /// </param> /// <returns> /// Return true if the index is in range and the primitive at the requested /// index is a box otherwise returns false. /// </returns> public bool TryGetCone(int index, out Cone cone, out Plane truncation) { var origin = new Point3d(); var xaxis = new Vector3d(); var yaxis = new Vector3d(); var height = 0.0; var radius = 0.0; var t_origin = new Point3d(); var t_xaxis = new Vector3d(); var t_yaxis = new Vector3d(); if (UnsafeNativeMethods.Rdk_CustomMeshes_Cone(ConstPointer(), index, ref origin, ref xaxis, ref yaxis, ref height, ref radius, ref t_origin, ref t_xaxis, ref t_yaxis)) { cone = new Cone(new Plane(origin, xaxis, yaxis), height, radius); truncation = new Plane(t_origin, t_xaxis, t_yaxis); return(true); } cone = new Cone(); truncation = new Plane(); return(false); }
public void ShouldComputeNormalOnCone(float pX, float pY, float pZ, float nX, float nY, float nZ) { var shape = new Cone(); var n = shape.GetLocalNormalAt(CreatePoint(pX, pY, pZ)); AssertActualEqualToExpected(n, CreateVector(nX, nY, nZ)); }
public static string RenderConesScene() { var world = new World(); IShape floor = new Plane { Material = new Material(new CheckerPattern(Color.Black, Color.White)) }; world.Add(floor); const int n = 200; for (int i = 1; i <= n; i++) { var t = (double)i / n; var x = 4 * t * Math.Cos(2 * Math.PI * t * 4); var z = 4 * t * Math.Sin(2 * Math.PI * t * 4); var cone = new Cone(-1, 0, true).Translate(ty: 1).Scale(sy: 1 - t + 0.5).Translate(tx: x, tz: z); cone.Material.Pattern = new SolidPattern(Color._Blue * t + Color._Green * (1 - t)); world.Add(cone); } var point = Helper.CreatePoint(0, 5, -5); world.Lights.Add(new PointLight(2 * point, Color.White)); var camera = new Camera(600, 400, Math.PI / 3, Helper.ViewTransform(point, Helper.CreatePoint(0, 0, -2), Helper.CreateVector(0, 1, 0))); var canvas = camera.Render(world); string file = Path.Combine(Path.GetTempPath(), "cones.ppm"); canvas.SavePPM(file); return(file); }
private void AddCones() { const float ConeWidth = 0.05f; const float ConeLength = 0.20f; _arrowRenderer = SceneObject.AddComponent <MeshRenderable>(); _arrowRenderer.Material = _material; var xCone = Cone.Create(ConeWidth, ConeLength, 6); xCone.Transform(new Matrix(new Vector3(1 - ConeLength, 0, 0), new Quaternion(Vector3.Forward, MathF.PI / 2), Vector3.One)); _coneVertexCount = xCone.Vertices.Length; var yCone = Cone.Create(ConeWidth, ConeLength, 6); yCone.Transform(new Matrix(new Vector3(0, 1 - ConeLength, 0), Quaternion.Identity, Vector3.One)); var zCone = Cone.Create(ConeWidth, ConeLength, 6); zCone.Transform(new Matrix(new Vector3(0, 0, 1 - ConeLength), new Quaternion(Vector3.Right, MathF.PI / 2), Vector3.One)); _arrowMesh = CompoundMesh.Create(xCone, yCone); _arrowMesh = CompoundMesh.Create(_arrowMesh, zCone); _arrowMesh.CalculateBounds(); _arrowRenderer.Mesh = _arrowMesh; }
static void Main(string[] args) { IceRocket ice = new IceRocket(); ice.Eat(); Console.WriteLine("************************"); Magnum magnum = new Magnum(MagnumIce.MilkChocolate); magnum.Eat(); Console.WriteLine("************************"); Cone cone = new Cone(Flavor.Banana); cone.Eat(); Console.ReadKey(); Console.WriteLine("***************************"); Magnum magnum1 = new Magnum(MagnumIce.RomanticStrawberries); magnum.Eat(); Cone cone1 = new Cone(Flavor.Mokka); cone1.Eat(); }
public void DrawCone(Cone cone) => DrawCone( cone.Radius, cone.Height, cone.DetailX, cone.DetailY, cone.ShowCap );
private void btnCalculate_Click(object sender, EventArgs e) { double r = Convert.ToDouble(txtRound.Text); if (rbCone.Checked && txtRound.Text != null) { GeometricFigure cone = new Cone(); cone.h = Convert.ToDouble(txtHeight.Text); txtFloorSpace.Text = cone.FloorSpace(r).ToString(); txtVolume.Text = cone.Volume(r).ToString(); lblFigure.Text = cone.Description(); } else if (rbSylinder.Checked) { Sylinder sylinder = new Sylinder(); sylinder.h = Convert.ToDouble(txtHeight.Text); txtFloorSpace.Text = sylinder.FloorSpace(r).ToString(); txtVolume.Text = sylinder.Volume(r).ToString(); lblFigure.Text = sylinder.Description(); } else if (rbSphere.Checked) { Sphere sphere = new Sphere(); txtFloorSpace.Text = sphere.FloorSpace(r).ToString(); txtVolume.Text = sphere.Volume(r).ToString(); lblFigure.Text = sphere.Description(); } }
private void Computing_the_normal_vector_on_a_cone(Tuple point, Tuple expectedNormal) { var cone = new Cone(); var normal = cone.LocalNormalAt(point); normal.Should().Be(expectedNormal); }
static AudioEngineExtensions() { m_curves = new CurvePoint[4][] { CURVE_LINEAR, CURVE_QUADRATIC, CURVE_INVQUADRATIC, CURVE_CUSTOM_1 }; m_cone = new Cone(); m_cone.InnerAngle = 0.5f * SharpDX.AngleSingle.RightAngle.Radians; m_cone.OuterAngle = 2f * m_cone.InnerAngle; m_cone.InnerVolume = 1f; m_cone.OuterVolume = 0.5f; }
/// <summary> /// Constructs a new demo. /// </summary> /// <param name="game">Game owning this demo.</param> public DogbotDemo(DemosGame game) : base(game) { Entity body = new Box(new Vector3(0, 0, 0), 4, 2, 2, 20); Space.Add(body); Entity head = new Cone(body.Position + new Vector3(3.2f, .3f, 0), 1.5f, .7f, 4); head.OrientationMatrix = Matrix3x3.CreateFromAxisAngle(Vector3.Forward, MathHelper.PiOver2); Space.Add(head); //Attach the head to the body var universalJoint = new UniversalJoint(body, head, head.Position + new Vector3(-.8f, 0, 0)); Space.Add(universalJoint); //Keep the head from swinging around too much. var angleLimit = new SwingLimit(body, head, Vector3.Right, Vector3.Right, MathHelper.PiOver4); Space.Add(angleLimit); var tail = new Box(body.Position + new Vector3(-3f, 1f, 0), 1.6f, .1f, .1f, 4); Space.Add(tail); //Keep the tail from twisting itself off. universalJoint = new UniversalJoint(body, tail, tail.Position + new Vector3(.8f, 0, 0)); Space.Add(universalJoint); //Give 'em some floppy ears. var ear = new Box(head.Position + new Vector3(-.2f, 0, -.65f), .01f, .7f, .2f, 1); Space.Add(ear); var ballSocketJoint = new BallSocketJoint(head, ear, head.Position + new Vector3(-.2f, .35f, -.65f)); Space.Add(ballSocketJoint); ear = new Box(head.Position + new Vector3(-.2f, 0, .65f), .01f, .7f, .3f, 1); Space.Add(ear); ballSocketJoint = new BallSocketJoint(head, ear, head.Position + new Vector3(-.2f, .35f, .65f)); Space.Add(ballSocketJoint); Box arm; Cylinder shoulder; PointOnLineJoint pointOnLineJoint; //************* First Arm *************// arm = new Box(body.Position + new Vector3(-1.8f, -.5f, 1.5f), .5f, 3, .2f, 20); Space.Add(arm); shoulder = new Cylinder(body.Position + new Vector3(-1.8f, .3f, 1.25f), .1f, .7f, 10); shoulder.OrientationMatrix = Matrix3x3.CreateFromAxisAngle(Vector3.Right, MathHelper.PiOver2); Space.Add(shoulder); //Connect the shoulder to the body. var axisJoint = new RevoluteJoint(body, shoulder, shoulder.Position, Vector3.Forward); //Motorize the connection. axisJoint.Motor.IsActive = true; axisJoint.Motor.Settings.VelocityMotor.GoalVelocity = 1; Space.Add(axisJoint); //Connect the arm to the shoulder. axisJoint = new RevoluteJoint(shoulder, arm, shoulder.Position + new Vector3(0, .6f, 0), Vector3.Forward); Space.Add(axisJoint); //Connect the arm to the body. pointOnLineJoint = new PointOnLineJoint(arm, body, arm.Position, Vector3.Up, arm.Position + new Vector3(0, -.4f, 0)); Space.Add(pointOnLineJoint); shoulder.OrientationMatrix *= Matrix3x3.CreateFromAxisAngle(Vector3.Forward, MathHelper.Pi); //Force the walker's legs out of phase. //************* Second Arm *************// arm = new Box(body.Position + new Vector3(1.8f, -.5f, 1.5f), .5f, 3, .2f, 20); Space.Add(arm); shoulder = new Cylinder(body.Position + new Vector3(1.8f, .3f, 1.25f), .1f, .7f, 10); shoulder.OrientationMatrix = Matrix3x3.CreateFromAxisAngle(Vector3.Right, MathHelper.PiOver2); Space.Add(shoulder); //Connect the shoulder to the body. axisJoint = new RevoluteJoint(body, shoulder, shoulder.Position, Vector3.Forward); //Motorize the connection. axisJoint.Motor.IsActive = true; axisJoint.Motor.Settings.VelocityMotor.GoalVelocity = 1; Space.Add(axisJoint); //Connect the arm to the shoulder. axisJoint = new RevoluteJoint(shoulder, arm, shoulder.Position + new Vector3(0, .6f, 0), Vector3.Forward); Space.Add(axisJoint); //Connect the arm to the body. pointOnLineJoint = new PointOnLineJoint(arm, body, arm.Position, Vector3.Up, arm.Position + new Vector3(0, -.4f, 0)); Space.Add(pointOnLineJoint); //************* Third Arm *************// arm = new Box(body.Position + new Vector3(-1.8f, -.5f, -1.5f), .5f, 3, .2f, 20); Space.Add(arm); shoulder = new Cylinder(body.Position + new Vector3(-1.8f, .3f, -1.25f), .1f, .7f, 10); shoulder.OrientationMatrix = Matrix3x3.CreateFromAxisAngle(Vector3.Right, MathHelper.PiOver2); Space.Add(shoulder); //Connect the shoulder to the body. axisJoint = new RevoluteJoint(body, shoulder, shoulder.Position, Vector3.Forward); //Motorize the connection. axisJoint.Motor.IsActive = true; axisJoint.Motor.Settings.VelocityMotor.GoalVelocity = 1; Space.Add(axisJoint); //Connect the arm to the shoulder. axisJoint = new RevoluteJoint(shoulder, arm, shoulder.Position + new Vector3(0, .6f, 0), Vector3.Forward); Space.Add(axisJoint); //Connect the arm to the body. pointOnLineJoint = new PointOnLineJoint(arm, body, arm.Position, Vector3.Up, arm.Position + new Vector3(0, -.4f, 0)); Space.Add(pointOnLineJoint); shoulder.OrientationMatrix *= Matrix3x3.CreateFromAxisAngle(Vector3.Forward, MathHelper.Pi); //Force the walker's legs out of phase. //************* Fourth Arm *************// arm = new Box(body.Position + new Vector3(1.8f, -.5f, -1.5f), .5f, 3, .2f, 20); Space.Add(arm); shoulder = new Cylinder(body.Position + new Vector3(1.8f, .3f, -1.25f), .1f, .7f, 10); shoulder.OrientationMatrix = Matrix3x3.CreateFromAxisAngle(Vector3.Right, MathHelper.PiOver2); Space.Add(shoulder); //Connect the shoulder to the body. axisJoint = new RevoluteJoint(body, shoulder, shoulder.Position, Vector3.Forward); //Motorize the connection. axisJoint.Motor.IsActive = true; axisJoint.Motor.Settings.VelocityMotor.GoalVelocity = 1; Space.Add(axisJoint); //Connect the arm to the shoulder. axisJoint = new RevoluteJoint(shoulder, arm, shoulder.Position + new Vector3(0, .6f, 0), Vector3.Forward); Space.Add(axisJoint); //Connect the arm to the body. pointOnLineJoint = new PointOnLineJoint(arm, body, arm.Position, Vector3.Up, arm.Position + new Vector3(0, -.4f, 0)); Space.Add(pointOnLineJoint); //Add some ground. Space.Add(new Box(new Vector3(0, -3.5f, 0), 20f, 1, 20f)); game.Camera.Position = new Vector3(0, 2, 20); }
internal static extern bool ON_Surface_IsCone(IntPtr pConstSurface, ref Cone cone, double tolerance, [MarshalAs(UnmanagedType.U1)]bool computeCone);
public Cone(Cone cone) { o = new Objects(cone.Obj); this.cone = new Bracket(cone.Values); }
public override void OnSceneManagementGetLightsForCamera( Camera camera, List<RenderingLowLevelMethods.LightItem> outLights ) { Frustum frustum = FrustumUtils.GetFrustumByCamera( camera ); if( EngineDebugSettings.FrustumTest && camera.AllowFrustumTestMode ) { frustum.HalfWidth *= .5f; frustum.HalfHeight *= .5f; } ConvexPolyhedron frustumPolyhedron = GetConvexPolyhedronFromFrustum( ref frustum ); ICollection<RenderLight> list; if( SceneManager.Instance.OverrideVisibleObjects != null ) list = SceneManager.Instance.OverrideVisibleObjects.Lights; else list = SceneManager.Instance.RenderLights; foreach( RenderLight light in list ) { if( !light.Visible ) continue; bool allowCastShadows = true; if( light.Type == RenderLightType.Point || light.Type == RenderLightType.Spot ) { if( light.AttenuationFar <= .01f ) continue; Sphere lightSphere = new Sphere( light.Position, light.AttenuationFar ); //fast culling. not cull everything. if( !frustum.IsIntersectsFast( lightSphere ) ) continue; //generate convex polyhedron for light volume //and check intersection with camera frustum. ConvexPolyhedron lightPolyhedron = null; if( light.Type == RenderLightType.Point ) lightPolyhedron = MakeConvexPolyhedronForPointLight( light ); else if( light.Type == RenderLightType.Spot ) lightPolyhedron = MakeConvexPolyhedronForSpotLight( light ); if( !ConvexPolyhedron.IsIntersects( frustumPolyhedron, lightPolyhedron ) ) continue; //allowCastShadows if( light.CastShadows ) { Sphere frustumShadowSphere = new Sphere( camera.DerivedPosition, SceneManager.Instance.ShadowFarDistance ); if( frustumShadowSphere.IsIntersectsSphere( lightSphere ) ) { if( light.Type == RenderLightType.Spot ) { Cone cone = new Cone( light.Position, light.Direction, light.SpotlightOuterAngle / 2 ); if( !cone.IsIntersectsSphere( frustumShadowSphere ) ) allowCastShadows = false; } } else allowCastShadows = false; } } outLights.Add( new RenderingLowLevelMethods.LightItem( light, allowCastShadows ) ); } }
public override void OnSceneManagementGetLightsForCamera( Camera camera, List<RenderingLowLevelMethods.LightItem> outLights ) { Frustum frustum = FrustumUtils.GetFrustumByCamera( camera ); if( EngineDebugSettings.FrustumTest && camera.AllowFrustumTestMode ) { frustum.HalfWidth *= .5f; frustum.HalfHeight *= .5f; } ConvexPolyhedron frustumPolyhedron = GetConvexPolyhedronFromFrustum( ref frustum ); ICollection<RenderLight> lightsToCheck; if( SceneManager.Instance.OverrideVisibleObjects != null ) { lightsToCheck = SceneManager.Instance.OverrideVisibleObjects.Lights; } else { List<RenderLight> list = new List<RenderLight>( 64 ); lightsToCheck = list; bool usePortalSystem = EngineApp.Instance.ApplicationType != EngineApp.ApplicationTypes.ResourceEditor && Map.Instance != null && Map.Instance.Zones.Count != 0 && camera.AllowZonesAndPortalsSceneManagement && EngineDebugSettings.AllowPortalSystem && camera.ProjectionType == ProjectionTypes.Perspective; if( usePortalSystem ) { //use portal system Map.Instance.WalkUsePortalSystem( camera, false, null, null, list ); } else { //use frustum culling //add directional lights foreach( RenderLight light in SceneManager.Instance.RenderLights ) { if( light.Type == RenderLightType.Directional && light.Visible ) list.Add( light ); } uint groupMask = 0; groupMask |= 1 << (int)SceneManager.SceneGraphGroups.Light; int[] sceneGraphIndexes = SceneManager.Instance.SceneGraph.GetObjects( frustum, groupMask ); foreach( int sceneGraphIndex in sceneGraphIndexes ) { SceneManager.SceneGraphObjectData data = SceneManager.Instance.SceneGraphObjects[ sceneGraphIndex ]; //Light RenderLight light = data.Light; if( light != null && light.Visible ) { //clip volumes if( !IsTotalClipVolumesContainsBounds( light.GetWorldBounds() ) ) list.Add( light ); } } } //add objects never culled by the frustum if( SceneManager.Instance.OverrideVisibleObjects == null && Map.Instance != null ) Map.Instance.Walk_AddObjectsWithDisabled_AllowSceneManagementCulling_Property( false, null, null, list ); } foreach( RenderLight light in lightsToCheck ) { if( !light.Visible ) continue; bool allowCastShadows = light.CastShadows; if( light.Type == RenderLightType.Point || light.Type == RenderLightType.Spot ) { if( light.AttenuationFar <= .01f ) continue; Sphere lightSphere = new Sphere( light.Position, light.AttenuationFar ); //fast culling. not cull everything. if( !frustum.IsIntersectsFast( lightSphere ) ) continue; //generate convex polyhedron for light volume //and check intersection with camera frustum. ConvexPolyhedron lightPolyhedron = light.GetInclusiveVolumeForCulling(); //draw light bounds //RendererWorld.Instance.DefaultCamera.DebugGeometry.Color = new ColorValue( 1, 0, 1, .5f ); //RendererWorld.Instance.DefaultCamera.DebugGeometry.AddBounds( light.GetWorldBounds() ); //visualize light volumes //{ // int[] i = new int[ lightPolyhedron.Faces.Length * 3 ]; // for( int n = 0; n < lightPolyhedron.Faces.Length; n++ ) // { // i[ n * 3 + 0 ] = lightPolyhedron.Faces[ n ].Vertex0; // i[ n * 3 + 1 ] = lightPolyhedron.Faces[ n ].Vertex1; // i[ n * 3 + 2 ] = lightPolyhedron.Faces[ n ].Vertex2; // } // RendererWorld.Instance.DefaultCamera.DebugGeometry.Color = new ColorValue( 1, 1, 0, .3f ); // RendererWorld.Instance.DefaultCamera.DebugGeometry.AddVertexIndexBuffer( // lightPolyhedron.Vertices, i, Mat4.Identity, false, true ); //} if( !ConvexPolyhedron.IsIntersects( frustumPolyhedron, lightPolyhedron ) ) continue; //allowCastShadows if( allowCastShadows ) { Sphere frustumShadowSphere = new Sphere( camera.DerivedPosition, SceneManager.Instance.ShadowFarDistance ); if( frustumShadowSphere.IsIntersectsSphere( lightSphere ) ) { if( light.Type == RenderLightType.Spot ) { Cone cone = new Cone( light.Position, light.Direction, light.SpotlightOuterAngle / 2 ); if( !cone.IsIntersectsSphere( frustumShadowSphere ) ) allowCastShadows = false; } } else allowCastShadows = false; } } outLights.Add( new RenderingLowLevelMethods.LightItem( light, allowCastShadows ) ); } }
internal static extern IntPtr ON_Cone_GetNurbForm(ref Cone cone);
public void ActPVentas() { Cone Venta = new Cone(); Venta.Act_ParVentas(this.iva,this.minbol,this.maxcuo,this.intcredi,this.intatraso,this.coucontado, this.diatope,this.contado,this.credito,this.oferta,this.ffijo); }
internal static extern IntPtr ONC_ON_BrepCone(ref Cone cone, [MarshalAs(UnmanagedType.U1)]bool cap);
public void ActFuncionamiento() { Cone fun = new Cone(); fun.Act_Funciona(this.contado,this.credito,this.factura,this.comprobante,this.grupoa,this.grupob); }
internal static extern IntPtr ON_Cone_RevSurfaceForm(ref Cone cone);
public void IngresoUsuario() { Cone usu = new Cone(); usu.New_User(this.usuario,this.contrasena,this.identificacion,this.cargo); }
internal static extern void CRhinoDisplayPipeline_DrawCone(IntPtr pPipeline, ref Cone cone, int argb, int thickness);
public void ActUsuario() { Cone usu = new Cone(); usu.Update_User(this.usuario, this.contrasena, this.identificacion, this.cargo); }
public void ActMarca() { Cone marca = new Cone(); marca.Update_Marca(this.codigo, this.nombre); }
internal static extern IntPtr RHC_RhinoMeshCone(ref Cone cone, int vertical, int around);
public void IngresoGrupo() { Cone group = new Cone(); group.New_Group(this.codigo, this.nombre); }
public Blob(Cone obj) { Attach(1, (object)obj); }
public void ActEmpresa() { Cone empre = new Cone(); empre.Act_Empresa(this.rut,this.digito,this.razon,this.giro,this.ciudad,this.direccion, this.fono,this.fax,this.casilla,this.email,this.sitio); }
public void IngresoMarca() { Cone marca = new Cone(); marca.New_Marca(this.codigo, this.nombre); }
public void ActGrupo() { Cone group = new Cone(); group.Update_Group(this.codigo, this.nombre); }
public void IngresoProveedor() { Cone proveedor = new Cone(); proveedor.Inserta_Proveedor(this.rut, this.digito, this.ciudad, this.fono, this.email, this.contacto, this.gerente, this.identificacion, this.direccion, this.fax, this.giro, this.casilla, this.responsable, this.zonal, this.formap); }