コード例 #1
0
ファイル: Transform.cs プロジェクト: glocklueng/agg-sharp
		public Transform(IPrimitive root, Matrix4X4 transform)
		{
			this.child = root;
			WorldToAxis = transform;
			AxisToWorld = Matrix4X4.Invert(WorldToAxis);
			AxisToWorld = transform;
			WorldToAxis = Matrix4X4.Invert(AxisToWorld);
		}
コード例 #2
0
		private long CalculateIntersectCostsForItem(IPrimitive item, int numInterations)
		{
			Stopwatch timer = new Stopwatch();
			timer.Start();
			for (int i = 0; i < numInterations; i++)
			{
				item.GetClosestIntersection(GetRandomIntersectingRay());
			}
			return timer.ElapsedMilliseconds;
		}
コード例 #3
0
ファイル: Ray.cs プロジェクト: hksonngan/sharptracing
 public Ray(Point3D origin, Vector3D direction)
 {
     this.direction = direction;
     this.direction.Normalize();
     this.invertedDirection.X = 1.0f / this.direction.X;
     this.invertedDirection.Y = 1.0f / this.direction.Y;
     this.invertedDirection.Z = 1.0f / this.direction.Z;
     this.Origin = origin;
     this.PrevRefractIndex = -1;
     this.PrevPrimitive = null;
 }
コード例 #4
0
 public Intersection(IPrimitive hitPrimitive, Point3D hitPoint, Vector3D normal, float tMin, float tMax,
     bool hitFromInSide)
 {
     this.HitPoint = hitPoint;
     this.Normal = normal;
     this.TMin = tMin;
     this.TMax = tMax;
     this.HitPrimitive = hitPrimitive;
     this.HitFromInSide = hitFromInSide;
     this.CurrentTextureCoordinate = UVCoordinate.Zero;
 }
コード例 #5
0
		public virtual IPrimitiveTypeRule[] getPrimitiveRules(String theVersion, String theTypeName, IPrimitive theType)
		{
			IList active = new ArrayList(myPrimitiveRuleBindings.Count);
			for (int i = 0; i < myPrimitiveRuleBindings.Count; i++)
			{
				Object o = myPrimitiveRuleBindings[i];
				if (!(o is RuleBinding))
				{
					throw new InvalidCastException("Item in rule binding list is not a RuleBinding");
				}

				RuleBinding binding = (RuleBinding) o;
				if (binding.Active && binding.appliesToVersion(theVersion) && binding.appliesToScope(theTypeName))
				{
					active.Add(binding.Rule);
				}
			}
			return (IPrimitiveTypeRule[]) SupportClass.ICollectionSupport.ToArray(active, new IPrimitiveTypeRule[0]);
		}
コード例 #6
0
 /// <summary>
 /// Put complex types with integer properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='complexBody'>
 /// Please put -1 and 2
 /// </param>
 public static void PutInt(this IPrimitive operations, IntWrapper complexBody)
 {
     Task.Factory.StartNew(s => ((IPrimitive)s).PutIntAsync(complexBody), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
コード例 #7
0
        private void DrawPrimitive(SKCanvas canvas, Matrix4 transform, SKPaint paint, IPrimitive primitive)
        {
            var scale          = ActualHeight / Workspace.ActiveViewPort.ViewHeight;
            var oldStrokeWidth = paint.StrokeWidth;

            switch (primitive.Kind)
            {
            case PrimitiveKind.Ellipse:
            {
                paint.IsStroke = true;
                var el = (PrimitiveEllipse)primitive;
                paint.StrokeWidth += (float)(el.Thickness * scale);
                using (var path = new SKPath())
                {
                    path.MoveTo(transform.Transform(el.StartPoint()).ToSKPoint());
                    var startAngle = (el.StartAngle + 1.0).CorrectAngleDegrees();
                    var endAngle   = el.EndAngle.CorrectAngleDegrees();
                    if (endAngle < startAngle)
                    {
                        endAngle += MathHelper.ThreeSixty;
                    }

                    for (var angle = startAngle; angle <= endAngle; angle += 1.0)
                    {
                        path.LineTo(transform.Transform(el.GetPoint(angle)).ToSKPoint());
                    }

                    path.LineTo(transform.Transform(el.EndPoint()).ToSKPoint());
                    canvas.DrawPath(path, paint);
                }
                break;
            }

            case PrimitiveKind.Line:
            {
                paint.IsStroke = true;
                var line = (PrimitiveLine)primitive;
                paint.StrokeWidth += (float)(line.Thickness * scale);
                var p1 = transform.Transform(line.P1);
                var p2 = transform.Transform(line.P2);
                canvas.DrawLine((float)p1.X, (float)p1.Y, (float)p2.X, (float)p2.Y, paint);
                break;
            }

            case PrimitiveKind.Point:
            {
                paint.IsStroke = true;
                var point         = (PrimitivePoint)primitive;
                var loc           = transform.Transform(point.Location);
                var pointSizeHalf = Workspace.SettingsService.GetValue <double>(WpfSettingsProvider.PointSize) * 0.5;
                canvas.DrawLine((float)(loc.X - pointSizeHalf), (float)loc.Y, (float)(loc.X + pointSizeHalf), (float)loc.Y, paint);
                canvas.DrawLine((float)loc.X, (float)(loc.Y - pointSizeHalf), (float)loc.X, (float)(loc.Y + pointSizeHalf), paint);
                break;
            }

            case PrimitiveKind.Text:
            {
                paint.IsStroke = false;
                var text = (PrimitiveText)primitive;
                var loc  = transform.Transform(text.Location);
                paint.TextSize = (float)((ActualHeight / Workspace.ActiveViewPort.ViewHeight) * text.Height);
                canvas.Save();
                canvas.RotateDegrees(-(float)text.Rotation, (float)loc.X, (float)loc.Y);
                canvas.DrawText(text.Value, (float)loc.X, (float)loc.Y, paint);
                canvas.Restore();
                break;
            }
            }

            paint.StrokeWidth = oldStrokeWidth;
        }
コード例 #8
0
 /// <summary>
 /// Put complex types with string properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='complexBody'>
 /// Please put 'goodrequest', '', and null
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task PutStringAsync(this IPrimitive operations, StringWrapper complexBody, CancellationToken cancellationToken = default(CancellationToken))
 {
     await operations.PutStringWithHttpMessagesAsync(complexBody, null, cancellationToken).ConfigureAwait(false);
 }
コード例 #9
0
ファイル: ScrollView.cs プロジェクト: VistianOpenSource/Birch
 public ScrollView(IPrimitive content) : base()
 {
     this.Attributes.SetAttribute(ViewExtensions.ContentAttribute, content);
 }
コード例 #10
0
        public static IEnumerable <Point> IntersectionPoints(this PrimitiveLine line, IPrimitive other, bool withinBounds = true)
        {
            IEnumerable <Point> result;

            switch (other.Kind)
            {
            case PrimitiveKind.Line:
                var p = line.IntersectionPoint((PrimitiveLine)other, withinBounds);
                if (p.HasValue)
                {
                    result = new[] { p.Value }
                }
                ;
                else
                {
                    result = new Point[0];
                }
                break;

            case PrimitiveKind.Ellipse:
                result = line.IntersectionPoints((PrimitiveEllipse)other, withinBounds);
                break;

            case PrimitiveKind.Point:
                var point = (PrimitivePoint)other;
                if (line.IsPointOnPrimitive(point.Location, withinBounds))
                {
                    result = new Point[] { point.Location };
                }
                else
                {
                    result = new Point[0];
                }
                break;

            case PrimitiveKind.Text:
                result = Enumerable.Empty <Point>();
                break;

            default:
                Debug.Assert(false, "Unsupported primitive type");
                result = Enumerable.Empty <Point>();
                break;
            }

            return(result);
        }
コード例 #11
0
 public void Draw(IPrimitive primitive, Color color, bool antiAlias, bool fill)
 {
     this.Surface.Draw(primitive, color, antiAlias, fill);
 }
コード例 #12
0
ファイル: Difference.cs プロジェクト: glocklueng/agg-sharp
		public Difference(IPrimitive primary, IPrimitive subtract)
		{
			this.primary = primary;
			this.subtract = subtract;
		}
コード例 #13
0
 /// <summary>
 /// Get complex types with datetimeRfc1123 properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static Datetimerfc1123Wrapper GetDateTimeRfc1123(this IPrimitive operations)
 {
     return(operations.GetDateTimeRfc1123Async().GetAwaiter().GetResult());
 }
コード例 #14
0
 /// <summary>
 /// Put complex types with datetimeRfc1123 properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='complexBody'>
 /// Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00
 /// GMT'
 /// </param>
 public static void PutDateTimeRfc1123(this IPrimitive operations, Datetimerfc1123Wrapper complexBody)
 {
     operations.PutDateTimeRfc1123Async(complexBody).GetAwaiter().GetResult();
 }
コード例 #15
0
 /// <summary>
 /// Put complex types with bool properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='complexBody'>
 /// Please put true and false
 /// </param>
 public static void PutBool(this IPrimitive operations, BooleanWrapper complexBody)
 {
     operations.PutBoolAsync(complexBody).GetAwaiter().GetResult();
 }
コード例 #16
0
 /// <summary>
 /// Put complex types with string properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='complexBody'>
 /// Please put 'goodrequest', '', and null
 /// </param>
 public static void PutString(this IPrimitive operations, StringWrapper complexBody)
 {
     operations.PutStringAsync(complexBody).GetAwaiter().GetResult();
 }
コード例 #17
0
 /// <summary>
 /// Get complex types with bool properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static BooleanWrapper GetBool(this IPrimitive operations)
 {
     return(operations.GetBoolAsync().GetAwaiter().GetResult());
 }
コード例 #18
0
 /// <summary>
 /// Get complex types with integer properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static IntWrapper GetInt(this IPrimitive operations)
 {
     return(operations.GetIntAsync().GetAwaiter().GetResult());
 }
コード例 #19
0
 /// <summary>
 /// Put complex types with double properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='complexBody'>
 /// Please put 3e-100 and
 /// -0.000000000000000000000000000000000000000000000000000000005
 /// </param>
 public static void PutDouble(this IPrimitive operations, DoubleWrapper complexBody)
 {
     operations.PutDoubleAsync(complexBody).GetAwaiter().GetResult();
 }
コード例 #20
0
 /// <summary>
 /// Put complex types with duration properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='field'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task PutDurationAsync(this IPrimitive operations, System.TimeSpan?field = default(System.TimeSpan?), CancellationToken cancellationToken = default(CancellationToken))
 {
     await operations.PutDurationWithHttpMessagesAsync(field, null, cancellationToken).ConfigureAwait(false);
 }
コード例 #21
0
 /// <summary>
 /// Put complex types with integer properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='complexBody'>
 /// Please put -1 and 2
 /// </param>
 public static void PutInt(this IPrimitive operations, IntWrapper complexBody)
 {
     operations.PutIntAsync(complexBody).GetAwaiter().GetResult();
 }
コード例 #22
0
ファイル: XMLParser.cs プロジェクト: liddictm/nHapi
		/// <summary>Parses a primitive type by filling it with text child, if any </summary>
		private void ParsePrimitive(IPrimitive datatypeObject, XmlElement datatypeElement)
		{
			XmlNodeList children = datatypeElement.ChildNodes;
			int c = 0;
			bool full = false;
			while (c < children.Count && !full)
			{
				XmlNode child = children.Item(c++);
				if (Convert.ToInt16(child.NodeType) == (short) XmlNodeType.Text)
				{
					try
					{
						if (child.Value != null && !child.Value.Equals(""))
						{
							if (KeepAsOriginal(child.ParentNode))
							{
								datatypeObject.Value = child.Value;
							}
							else
							{
								datatypeObject.Value = RemoveWhitespace(child.Value);
							}
						}
					}
					catch (Exception e)
					{
						log.Error("Error parsing primitive value from TEXT_NODE", e);
					}
					full = true;
				}
			}
		}
コード例 #23
0
 /// <summary>
 /// Get complex types with duration properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static DurationWrapper GetDuration(this IPrimitive operations)
 {
     return(operations.GetDurationAsync().GetAwaiter().GetResult());
 }
コード例 #24
0
ファイル: Sample2.cs プロジェクト: EdiCarlos/MyPractices
 public void TemplateMethod(IPrimitive primitive)
 {
     string result = primitive.Method1() + " " + primitive.Method2();
     Console.WriteLine(result);
 }
コード例 #25
0
 /// <summary>
 /// Put complex types with duration properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='field'>
 /// </param>
 public static void PutDuration(this IPrimitive operations, System.TimeSpan?field = default(System.TimeSpan?))
 {
     operations.PutDurationAsync(field).GetAwaiter().GetResult();
 }
コード例 #26
0
ファイル: Transform.cs プロジェクト: glocklueng/agg-sharp
		public Transform(IPrimitive root)
		{
			this.child = root;
		}
コード例 #27
0
 /// <summary>
 /// Get complex types with byte properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static ByteWrapper GetByte(this IPrimitive operations)
 {
     return(operations.GetByteAsync().GetAwaiter().GetResult());
 }
コード例 #28
0
 public ComparePrimitive(IPrimitive v1, string compare, IPrimitive v2)
 {
     _v1      = v1;
     _v2      = v2;
     _compare = compare;
 }
コード例 #29
0
 /// <summary>
 /// Put complex types with byte properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='field'>
 /// </param>
 public static void PutByte(this IPrimitive operations, byte[] field = default(byte[]))
 {
     operations.PutByteAsync(field).GetAwaiter().GetResult();
 }
コード例 #30
0
        public static IEnumerable <Point> IntersectionPoints(this PrimitiveEllipse ellipse, IPrimitive primitive, bool withinBounds = true)
        {
            IEnumerable <Point> result;

            switch (primitive.Kind)
            {
            case PrimitiveKind.Ellipse:
                result = ellipse.IntersectionPoints((PrimitiveEllipse)primitive, withinBounds);
                break;

            case PrimitiveKind.Line:
                result = ((PrimitiveLine)primitive).IntersectionPoints(ellipse, withinBounds);
                break;

            case PrimitiveKind.Point:
                result = ellipse.IntersectionPoints((PrimitivePoint)primitive, withinBounds);
                break;

            case PrimitiveKind.Text:
                result = Enumerable.Empty <Point>();
                break;

            default:
                Debug.Assert(false, "Unsupported primitive type");
                result = Enumerable.Empty <Point>();
                break;
            }

            return(result);
        }
コード例 #31
0
 /// <summary>
 /// Put complex types with byte properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='field'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task PutByteAsync(this IPrimitive operations, byte[] field = default(byte[]), CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.PutByteWithHttpMessagesAsync(field, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
コード例 #32
0
		public BoundingVolumeHierarchy(IPrimitive nodeA, IPrimitive nodeB, int splitingPlane)
		{
			this.splitingPlane = splitingPlane;
			this.nodeA = nodeA;
			this.nodeB = nodeB;
			this.Aabb = nodeA.GetAxisAlignedBoundingBox() + nodeB.GetAxisAlignedBoundingBox(); // we can cache this because it is not allowed to change.
		}
コード例 #33
0
 /// <summary>
 /// Put complex types with integer properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='complexBody'>
 /// Please put -1 and 2
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task PutIntAsync(this IPrimitive operations, IntWrapper complexBody, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.PutIntWithHttpMessagesAsync(complexBody, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
コード例 #34
0
 /// <summary>
 /// Put complex types with datetimeRfc1123 properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='complexBody'>
 /// Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00
 /// GMT'
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task PutDateTimeRfc1123Async(this IPrimitive operations, Datetimerfc1123Wrapper complexBody, CancellationToken cancellationToken = default(CancellationToken))
 {
     await operations.PutDateTimeRfc1123WithHttpMessagesAsync(complexBody, null, cancellationToken).ConfigureAwait(false);
 }
コード例 #35
0
		public InteractionVolume(IPrimitive collisionVolume, MeshViewerWidget meshViewerToDrawWith)
		{
			this.collisionVolume = collisionVolume;
			this.meshViewerToDrawWith = meshViewerToDrawWith;
		}
コード例 #36
0
 /// <summary>
 /// Put complex types with duration properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='field'>
 /// </param>
 public static void PutDuration(this IPrimitive operations, System.TimeSpan?field = default(System.TimeSpan?))
 {
     Task.Factory.StartNew(s => ((IPrimitive)s).PutDurationAsync(field), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
コード例 #37
0
ファイル: Surface.cs プロジェクト: ywjno/mynes-code
 /// <summary>
 /// 
 /// </summary>
 /// <param name="primitive"></param>
 /// <param name="color"></param>
 public void Draw(IPrimitive primitive, Color color)
 {
     Draw(primitive, color, true);
 }
コード例 #38
0
 /// <summary>
 /// Get complex types with byte properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static ByteWrapper GetByte(this IPrimitive operations)
 {
     return(Task.Factory.StartNew(s => ((IPrimitive)s).GetByteAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
コード例 #39
0
ファイル: Surface.cs プロジェクト: ywjno/mynes-code
 /// <summary>
 /// 
 /// </summary>
 /// <param name="primitive"></param>
 /// <param name="color"></param>
 /// <param name="antiAlias"></param>
 /// <param name="fill"></param>
 public void Draw(IPrimitive primitive, Color color, bool antiAlias, bool fill)
 {
     if (primitive == null)
     {
         throw new ArgumentNullException("primitive");
     }
     primitive.Draw(this, color, antiAlias, fill);
 }
コード例 #40
0
ファイル: XMLParser.cs プロジェクト: liddictm/nHapi
		/// <summary> Encodes a Primitive in XML by adding it's value as a child of the given Element.  
		/// Returns true if the given Primitive contains a value.  
		/// </summary>
		private bool EncodePrimitive(IPrimitive datatypeObject, XmlElement datatypeElement)
		{
			bool hasValue = false;
			if (datatypeObject.Value != null && !datatypeObject.Value.Equals(""))
				hasValue = true;

			XmlText t = datatypeElement.OwnerDocument.CreateTextNode(datatypeObject.Value);
			if (hasValue)
			{
				try
				{
					datatypeElement.AppendChild(t);
				}
				catch (Exception e)
				{
					throw new DataTypeException("DOMException encoding Primitive: ", e);
				}
			}
			return hasValue;
		}
コード例 #41
0
        private bool FindMeshGroupHitPosition(Vector2 screenPosition, out int meshHitIndex, ref IntersectInfo info)
		{
			meshHitIndex = 0;
			if (MeshGroupExtraData.Count == 0 || MeshGroupExtraData[0].meshTraceableData == null)
			{
				return false;
			}

			List<IPrimitive> mesheTraceables = new List<IPrimitive>();
			for (int i = 0; i < MeshGroupExtraData.Count; i++)
			{
				foreach (IPrimitive traceData in MeshGroupExtraData[i].meshTraceableData)
				{
					mesheTraceables.Add(new Transform(traceData, MeshGroupTransforms[i]));
				}
			}
			allObjects = BoundingVolumeHierarchy.CreateNewHierachy(mesheTraceables, 0);

			Vector2 meshViewerWidgetScreenPosition = meshViewerWidget.TransformFromParentSpace(this, screenPosition);
			Ray ray = meshViewerWidget.TrackballTumbleWidget.GetRayFromScreen(meshViewerWidgetScreenPosition);
			info = allObjects.GetClosestIntersection(ray);
			if (info != null)
			{
				CurrentSelectInfo.PlaneDownHitPos = info.hitPosition;
				CurrentSelectInfo.LastMoveDelta = new Vector3();

				for (int i = 0; i < MeshGroupExtraData.Count; i++)
				{
					List<IPrimitive> insideBounds = new List<IPrimitive>();
					foreach (IPrimitive traceData in MeshGroupExtraData[i].meshTraceableData)
					{
						traceData.GetContained(insideBounds, info.closestHitObject.GetAxisAlignedBoundingBox());
					}
					if (insideBounds.Contains(info.closestHitObject))
					{
						meshHitIndex = i;
						return true;
					}
				}
			}

			return false;
		}
コード例 #42
0
 /// <summary>
 /// Get complex types with long properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static LongWrapper GetLong(this IPrimitive operations)
 {
     return(operations.GetLongAsync().GetAwaiter().GetResult());
 }
コード例 #43
0
		private void CreateScene()
		{
			scene = new Scene();
			scene.camera = new TrackBallCamera(trackballTumbleWidget);
			scene.background = new Background(new RGBA_Floats(0.5, .5, .5), 0.4);

			AddBoxAndSheresBooleanTest();
			//AddBoxAndBoxBooleanTest();
#if false
            renderCollection.Add(new BoxShape(new Vector3(), new Vector3(1, 1, 1),
                               new SolidMaterial(new RGBA_Floats(.9, .2, .1), .01, 0.0, 2.0)));
            renderCollection.Add(new BoxShape(new Vector3(.5,.5,.5), new Vector3(1.5, 1.5, 1.5),
                               new SolidMaterial(new RGBA_Floats(.9, .2, .1), .01, 0.0, 2.0)));
#endif
			//renderCollection.Add(new CylinderShape(.25, 1, new SolidMaterial(RGBA_Floats.Cyan, 0, 0, 0)));

			//AddTestStl();
			//AddPolygonTest();
			//AddSphereAndBox();
			//AddAxisMarker();
			//AddCubeOfShperes();

			//renderCollection.Add(MakerGearXCariage());

			allObjects = BoundingVolumeHierarchy.CreateNewHierachy(renderCollection);
			allObjectsHolder = new Transform(allObjects);
			//allObjects = root;
			scene.shapes.Add(allObjectsHolder);

			//AddAFloor();

			//add two lights for better lighting effects
			scene.lights.Add(new PointLight(new Vector3(5000, 5000, 5000), new RGBA_Floats(0.8, 0.8, 0.8)));
			scene.lights.Add(new PointLight(new Vector3(-5000, -5000, 3000), new RGBA_Floats(0.5, 0.5, 0.5)));
		}
コード例 #44
0
ファイル: Sample1.cs プロジェクト: EdiCarlos/MyPractices
 public string TemplateMethod(IPrimitive primitive)
 {
     return primitive.Method1() + " " + primitive.Method2();
 }
コード例 #45
0
 public bool TryGetValue(AbstractHumanoid sprite, out IPrimitive circle)
 {
     return(internalCache.TryGetValue(sprite, out circle));
 }
コード例 #46
0
ファイル: Surface.cs プロジェクト: ywjno/mynes-code
 /// <summary>
 /// 
 /// </summary>
 /// <param name="primitive"></param>
 /// <param name="color"></param>
 /// <param name="antiAlias"></param>
 public void Draw(IPrimitive primitive, Color color, bool antiAlias)
 {
     Draw(primitive, color, antiAlias, false);
 }
コード例 #47
0
 public void Add(AbstractHumanoid sprite, IPrimitive circle)
 {
     internalCache.Add(sprite, circle);
 }
コード例 #48
0
ファイル: PipeParser.cs プロジェクト: RickIsWright/nHapi
		private static String EncodePrimitive(IPrimitive p, EncodingCharacters encodingChars)
		{
			String val = ((IPrimitive) p).Value;
			if (val == null)
			{
				val = "";
			}
			else
			{
				val = Escape.escape(val, encodingChars);
			}
			return val;
		}
コード例 #49
0
 public InteractionVolume(IPrimitive collisionVolume, MeshViewerWidget meshViewerToDrawWith)
 {
     this.collisionVolume      = collisionVolume;
     this.meshViewerToDrawWith = meshViewerToDrawWith;
 }
コード例 #50
0
ファイル: Difference.cs プロジェクト: glocklueng/agg-sharp
		private IntersectInfo FindNextIntersections(IPrimitive element, Ray ray, IntersectInfo info, IntersectionType intersectionType)
		{
			// get all the intersection for the object
			Ray currentRayCheckBackfaces = new Ray(ray);
			currentRayCheckBackfaces.intersectionType = intersectionType;
			currentRayCheckBackfaces.minDistanceToConsider = ((info.hitPosition + ray.directionNormal * Ray.sameSurfaceOffset) - ray.origin).Length;
			currentRayCheckBackfaces.maxDistanceToConsider = double.PositiveInfinity;

			return element.GetClosestIntersection(currentRayCheckBackfaces);
		}
コード例 #51
0
        private static IEnumerable <IPrimitive> GetSegmentParts(IPrimitive primitive, IEnumerable <Point> breakingPoints)
        {
            if (breakingPoints.Count() == 0)
            {
                return(new[] { primitive });
            }
            else
            {
                var result = new List <IPrimitive>();
                switch (primitive.Kind)
                {
                case PrimitiveKind.Line:
                {
                    // order the points by distance from `line.P1` then the resultant line segments are:
                    //   (line.P1, orderedPoints[0])
                    //   (orderedPoints[0], orderedPoints[1])
                    //   ...
                    //   (orderedPoints[N - 1], line.P2)
                    var line          = (PrimitiveLine)primitive;
                    var orderedPoints = breakingPoints.OrderBy(p => (line.P1 - p).LengthSquared).ToList();
                    result.Add(new PrimitiveLine(line.P1, orderedPoints.First()));

                    for (int i = 0; i < orderedPoints.Count - 1; i++)
                    {
                        result.Add(new PrimitiveLine(orderedPoints[i], orderedPoints[i + 1]));
                    }

                    result.Add(new PrimitiveLine(orderedPoints.Last(), line.P2));
                }
                break;

                case PrimitiveKind.Ellipse:
                {
                    // order the points by angle from `el.StartAngle` then the resultant arc segments are:
                    //   (arc.StartAngle, orderedAngles[0])
                    //   (orderedAngles[0], orderedAngles[1])
                    //   ...
                    //   (orderedAngles[N - 1], arc.EndAngle)
                    // but if it's closed, don't use the start/end angles, instead do:
                    //   (orderedAngles[0], orderedAngles[1])
                    //   (orderedAngles[1], orderedAngles[2])
                    //   ...
                    //   (orderedAngles[N - 1], orderedAngles[0])

                    var el            = (PrimitiveEllipse)primitive;
                    var orderedAngles = breakingPoints.Select(p => el.GetAngle(p)).OrderBy(a => a).ToList();

                    if (!el.IsClosed)
                    {
                        result.Add(new PrimitiveEllipse(el.Center, el.MajorAxis, el.Normal, el.MinorAxisRatio, el.StartAngle, orderedAngles.First(), el.Color));
                    }

                    for (int i = 0; i < orderedAngles.Count - 1; i++)
                    {
                        result.Add(new PrimitiveEllipse(el.Center, el.MajorAxis, el.Normal, el.MinorAxisRatio, orderedAngles[i], orderedAngles[i + 1], el.Color));
                    }

                    if (el.IsClosed)
                    {
                        result.Add(new PrimitiveEllipse(el.Center, el.MajorAxis, el.Normal, el.MinorAxisRatio, orderedAngles.Last(), orderedAngles.First(), el.Color));
                    }
                    else
                    {
                        result.Add(new PrimitiveEllipse(el.Center, el.MajorAxis, el.Normal, el.MinorAxisRatio, orderedAngles.Last(), el.EndAngle, el.Color));
                    }
                }
                break;
                }

                return(result);
            }
        }
コード例 #52
0
		private void CreateScene()
		{
			scene = new Scene();
			scene.camera = new TrackBallCamera(trackballTumbleWidget);
			//scene.background = new Background(new RGBA_Floats(0.5, .5, .5), 0.4);
			scene.background = new Background(new RGBA_Floats(1, 1, 1, 0), 0.6);

			AddTestMesh(loadedMeshGroups);

			allObjects = BoundingVolumeHierarchy.CreateNewHierachy(renderCollection);
			allObjectsHolder = new Transform(allObjects);
			//allObjects = root;
			scene.shapes.Add(allObjectsHolder);

			//AddAFloor();

			//add two lights for better lighting effects
			//scene.lights.Add(new Light(new Vector3(5000, 5000, 5000), new RGBA_Floats(0.8, 0.8, 0.8)));
			scene.lights.Add(new PointLight(new Vector3(-5000, -5000, 3000), new RGBA_Floats(0.5, 0.5, 0.5)));
		}
コード例 #53
0
ファイル: DebugBvh.cs プロジェクト: broettge/MatterControl
		public static void Render(IPrimitive bvhToRender, Matrix4X4 startingTransform, int startRenderLevel = 0, int endRenderLevel = int.MaxValue)
		{
			DebugBvh visitor = new DebugBvh(startRenderLevel, endRenderLevel);
			visitor.transform.Push(startingTransform);
            visitor.RenderRecursive((dynamic)bvhToRender);
		}