This is the discussion forum for Helix Toolkit.
For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!
0

SortingVisual3D

Anonymous 10 years ago 0
This discussion was imported from CodePlex

hulahoops wrote at 2012-11-01 10:10:

Hi

 

Is it possible to use ContainerUIElement3D in conjunction with SortingVisual3D?  I would like sorted visuals that have the power of the ContainerUIElement3D class.

 

Best regards

Simon


objo wrote at 2012-11-02 22:33:

Hi Simon! I have not tried this, but I guess it should be possible. Let us know if there is a bug. And remember that the SortingVisual3D is only a 'basic' work-around for the transparency problem... 


hulahoops wrote at 2012-11-05 10:08:

Hi Objo

Thanks for replying.  I was asking if it is possible as I can't get it to work.  If I add a ModelUIElement3D object as a child of a ContainerUIElement3D object, and add the ContainerUIElement3D object as a child of a SortingVisual3D object, I find that the mouse events are not fired.

e.g.  (geometry code excluded)

var element = new ModelUIElement3D();
element.Model = geometry;
element.MouseDown += this.ContainerElementMouseDown;
var containerUI = new ContainerUIElement3D();
containerUI.Children.Add(element);
var uiTransparentElements = new SortingVisual3D();
uiTransparentElements.Children.Add(containerUI);
viewport.Children.Add(uiTransparentElements);

It is not too big a deal since I could use VisualTreeHelper.HitTest instead of  ContainerUIElement3D, but I was wondering if I was missing something simple.

Regards

Simon


objo wrote at 2012-11-05 10:28:

ok, could changing the base class of HelixToolkit.Wpf.RenderingModelVisual help? Try replace ModelVisual3D by ContainerUIElement3D (I am guessing - no time to test right now).


hulahoops wrote at 2012-11-05 13:33:

I did start to try that but unfortunately abandoned as didn't resolve all the build errors.  I will use HitTest workaround for now.  Is it possible to add to future enhancement list?

Thanks, Simon


objo wrote at 2012-11-06 19:29:

added http://helixtoolkit.codeplex.com/workitem/9971


bennasi wrote at 2012-11-26 11:48:

ContainerUIElement3D is a noniheritable class...

http://msdn.microsoft.com/en-us/library/system.windows.media.media3d.containeruielement3d.aspx


objo wrote at 2012-11-26 11:53:

Then try to add a ContainerUIElement3D to the ModelVisual3D.

0

Set zoom in/out capability

Michael Powell 10 years ago updated 10 years ago 1
More specifically, how to I set up a PerspectiveCamera (or better Camera, fit-to-purpose, i.e. orthogonal?) so that I can zoom in further than the default will allow?

Thank you...
0
Under review

Anyone any luck with WPF Attached Properties

Michael Powell 10 years ago updated by Øystein Bjørke 10 years ago 1
Hello,

I am interested to inject a ViewModel into the mix via the parent UserControl DataContext, which subsequently should relay that value to an Attached Dependency Property.

I'd like for interested views and models contained by the UserControl, or children therein, to be able to access the same attached property value.

I am studying some issues and 'tutorials' online, but thus far haven't had much luck retrieving the attached property value. I can listen for DataContext, no problem however.

Has anyone ever dealt with Attached Dependency Properties, or perhaps knows a good tutorial that explains it?

It's also possible that I need for 'children' of the problem to register with the property, but none of the examples stipulate that, or have conveniently left that part out (i.e. it's been alluded to in places).

Any insight is welcome.

Thank you...
0

DrawingBrush as Material

Anonymous 10 years ago 0
This discussion was imported from CodePlex

jacobya wrote at 2012-02-18 22:19:

Hi objo,

I have another question for you, this time it is around an issue I'm having with applying a DrawingBrush as the Material for a Tube.  I'm using the Meshbuilder.AddTube function to create a Tube that is 2000 units in length and has a diameter of 5.0.  I've created a DrawingBrush that has a width of 2000 and a height of Math.PI * 5.0.  The DrawingBrush also includes a small Blue rectangle with a Black border.  I've uploaded a copy of the rendered model here:

http://www.ironbyte.ca/temp/pipe.jpg

As you can see in the screenshot, both sides of the Rectangle are faded and the top and the bottom are not.  I would like the rectangle to display without any fading of any sort.  I have tried using an Ambient light, as well as setting RenderOptions.EdgeMode to Alias, but still can't get it to render without fading.  I noticed that if I make my Tube and my DrawingBrush much smaller in width, the fading is much, much less.

Thanks again for your help.

 


objo wrote at 2012-02-21 20:34:

Is your texture too wide? And the blue rectangle too small? Which means your left/right edges will be 'smeared away' to invisible? The fading is hard to avoid when using a texture to draw the rectangle. 

But I think you could create a texture with a rectangle that spans from e.g. 0.1 to 0.9 in texture coordinates. Then use texture coordinates 0, 0, 0, 0, 0, 0, 0.1, 0.9, 1, 1, 1, 1... along your pipe. This would probably improve the resolution. If you want the width of the edges to be the same both horizontally and vertically you need to do some calculations.

And if you need to show more than one rectangle maybe the following texture coordinates could work: 0,0,0,0,0,0,0.1,0.9,1,1,1,1,1,0.9,0.1,0,0,0,0,0,0,0.1,0.9,1,1,1,..... 

Sorry if I don't understand the problem properly, a tiny compilable example could help :)


jacobya wrote at 2012-02-22 23:44:

Hi objo,

I'm remapping the TextureCoordinates to be exactly the same dimensions as the material I'm using, but the behaviour you describe is exactly what I'm seeing.  Here is a small example that illustrates the problem I'm using.  This is using HelixToolkit build 74172.

http://www.ironbyte.ca/temp/CylinderMaterialTest.zip

Thanks!


objo wrote at 2012-03-10 16:37:

thanks for the example project. sorry, I was not able to find a solution to this yet...

0
Under review

Select Object into the view

Anonymous 10 years ago updated by ไอยดา สุรีวงค์ 4 years ago 2
This discussion was imported from CodePlex

CesarMayorine wrote at 2014-09-01 12:59:

how can I select a Object (Children) in view?

CesarMayorine wrote at 2014-09-01 13:00:

With mauseclick...
0

Camera rotate around centroid or specific point

Anonymous 10 years ago 0
This discussion was imported from CodePlex

charlh wrote at 2012-07-30 17:33:

Hi there.

Is there any way to always have the camera rotate about a model's centroid (say a cube for example)? In other words, update the rotation point when a model is zoomed in on or panned so that the point of rotation is always about the model's centroid or a point of choice in 3d space.  Thanks for the help.


objo wrote at 2012-08-09 00:52:

This is a new feature in the 'camera controller'. Need to create a new mode where the rotation point is fixed (currently you can choose between rotating around the 'mouse down point' or the camera 'target' point).

Added as issue http://helixtoolkit.codeplex.com/workitem/9961

0

Moving the Model instead of the camera

Anonymous 10 years ago 0
This discussion was imported from CodePlex

MikeCo wrote at 2012-10-24 18:42:

Is there a way to move the model in space and not the camera?

 

Thanks!


objo wrote at 2012-10-26 08:54:

The mouse handlers in this toolkit moves the camera, you need to write your own mouse handlers if you want to transform your model!

0

CuttingEarsTriangulator possible bug

Anonymous 10 years ago 0
This discussion was imported from CodePlex

baucez wrote at 2013-04-19 16:03:

Hi! I'm using CuttingEarsTriangulator to draw complex polygons.
It works almost all the time but I found some cases in which method Triangulate gives me null even if the polygons is valid.

One of this cases is when I pass the following list of points:
0,0
0,1.894
-2.536,1.42
-5.072,1.42
-5.072,2.84
-10.144,2.84
-10.144,0

How can I get my triangles? Is there a workaround?

RobPerkins wrote at 2013-04-22 23:05:

I haven't studied the code in the Helix stack, but I've gotten very good Cutting Ear results from the archived CodeProject project at:

http://www.codeproject.com/Articles/8238/Polygon-Triangulation-in-C

The code is conveniently in C# and contains no dependencies on anything except .NET (probably .NET 1.1, so it would be good for any .NET stack)

objo wrote at 2013-04-26 22:23:

baucez: thanks for the example polygon - I will add a unit test for this case
RobPerkins: thanks for the link, I will have a look at that implementation, and possible use it to verify results

objo wrote at 2013-04-30 23:09:

the following code
           var polygon = new[]
                              {
                                  new Point(0, 0),
                                  new Point(0, 1.894),
                                  new Point(-2.536, 1.42),
                                  new Point(-5.072, 1.42),
                                  new Point(-5.072, 2.84),
                                  new Point(-10.144, 2.84),
                                  new Point(-10.144, 0)
                              };
            var result = CuttingEarsTriangulator.Triangulate(polygon);
gives the result
{0 1 2 3 4 5 6 0 2 3 5 6 6 2 3}
which looks correct to me...

baucez wrote at 2013-05-02 10:21:

Objo.. you are right!
I looked better at my code and I found that the list of points that I gave you was approximated.

If you try this code will fail:
  {
            var polygon = new[]
                {
                    new Point(0, 0),
                    new Point(0, 2.97),
                    new Point(-2.389999999999997, 2.97),
                    new Point(-2.389999999999997, 1.4849999999999999),
                    new Point(-4.7799999999999976, 1.4849999999999999),
                    new Point(-4.7799999999999976, 2.97),
                    new Point(-9.5599999999999987, 2.97),
                    new Point(-9.5599999999999987, 0),
                };

            var result = CuttingEarsTriangulator.Triangulate(polygon);
            Assert.IsNotNull(result);
        }
The problem is caused by double arithmetic approximations.
In particular (but I'm not sure is the only place in the code) the problem is in the comparisons at the end of CuttingEarsTriangulator.InsideTriangle method

objo wrote at 2013-05-08 15:28:

thanks! I have checked in the fix
0

Meshbuilder with 32000 position, normal and etc memory problem

Anonymous 10 years ago 0
This discussion was imported from CodePlex

behnam263 wrote at 2014-07-05 09:07:

Hi
I started to add position and normal and texture coordinates to a meshbuilder but i get memory inefficient by debuger!
Is it a memory leak? How can i handle this?

objo wrote at 2014-07-11 21:45:

Please provide an example that shows the problem! The MeshBuilder should not hold any memory.

behnam263 wrote at 2014-07-22 10:41:

I found that my problem is about exceeding memory for an array not meshbuilder thank you
0

Merge 2 meshgeometry3D to 1 ?

Anonymous 10 years ago 0
This discussion was imported from CodePlex

behnam263 wrote at 2014-05-11 07:43:

What is the concept For merging two meshgeometry3D ?
Is there anything in this library for it?

objo wrote at 2014-05-19 21:46:

The MeshBuilder.Append method can do this!