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

Bug or feature - BillboardTextGroupVisual3D doesn't accept ObservableCollection<BillboardTextItem>

Anonymous 10 years ago 0
This discussion was imported from CodePlex

mesta wrote at 2013-11-19 12:54:

In the latest versions, there was a change to Items property of BillboardTextGroupVisual3D, from IList to List, so now i can't bind the ObservableCollections anymore.

I had a project that with the latest version stopped working because of this modification, so i had to take the source and recompile them with IList.
Maybe you should consider to return to IList as Items property for the next versions ?
/// <summary>
        /// Identifies the <see cref="Items"/> dependency property.
        /// </summary>
        public static readonly DependencyProperty ItemsProperty = DependencyProperty.Register(
            "Items",
            typeof(List<BillboardTextItem>),
            typeof(BillboardTextGroupVisual3D),
            new UIPropertyMetadata(null, VisualChanged));
 /// <summary>
        /// Gets or sets the items.
        /// </summary>
        /// <value>The items.</value>
        public List<BillboardTextItem> Items
        {
            get
            {
                return (List<BillboardTextItem>)this.GetValue(ItemsProperty);
            }

            set
            {
                this.SetValue(ItemsProperty, value);
            }
        }

objo wrote at 2013-11-19 13:31:

thanks, that was a mistake. Fixed now. New version on Nuget will be available later today.

mesta wrote at 2013-11-19 13:45:

I checked the commit and there is also the UIPropertyMetadata callback that has to be changed; this is the old one that was working.
public static readonly DependencyProperty ItemsProperty = DependencyProperty.Register("Items", typeof(IList<BillboardTextItem>), typeof(BillboardTextGroupVisual3D), new UIPropertyMetadata(null, new PropertyChangedCallback(BillboardTextGroupVisual3D.VisualChanged)));
Thank you, your library is awesome !

objo wrote at 2013-11-19 18:45:

you mean the new PropertyChangedCallback(? I think this is a redundant delegate constructor. Tested with NET 4.0 and 4.5.

chadsixt wrote at 2014-04-17 18:24:

Hey Guys,

I am using the BillboardTextGroupVisual3D, defined in xaml. I have the Items bound to an ObservableCollection<BillboardTextItem>, so when I add a BillboardTextItem to the Group all is well. When I attempt to detect the user clicking on one of the BillboardTextItems, I only see the BillboardTextGroupVisual3D, and I am unable to detect which actual item it is, so I can remove it from the group. I could come up with a algorithm to find the closest Item in the group based on the HitPoint? Is there something that can help already there somewhere...?? I,d rather not have to add BillboardTextVisuals for ever Item I want to display in the viewport...

Thanks again, Love the project
Chad

objo wrote at 2014-04-29 10:20:

This is an interesting feature. It should be possible to add this to BillboardTextGroupVisual3D.
I added https://helixtoolkit.codeplex.com/workitem/10038
0

Some Suggestions/Wish List

Anonymous 10 years ago 0
This discussion was imported from CodePlex

przem321 wrote at 2012-01-26 19:32:

Hi Objo,

here are some issues I would like to mention:

  • PointsVisual3D will not work if Points is set to null. While this is not a bug, I like to disable the visual without removing it from the Viewport.Childern by setting Poins=null. I know, there is the IsRendering prop, but it serves a different purpose. Would it not make sense to add a line like 
	if (Points == null) return; 

to the 

	protected override void UpdateGeometry() function? 

The same applies to all ScreenSpaceVisual3D classes?

  • Shouldn't the MeshNormals3D class be called MeshNormalsVisual3D for sake of consistency? 
  • The BoundingBoxVisual3D has a hard-coded color to Yellow - well, not the perfect solution. I added a Property "Fill" to it, there one can set the color. I submit the file as a patch. 

objo wrote at 2012-01-26 20:09:

thanks for reporting bugs/inconsistencies! I'm correcting all three now.


objo wrote at 2012-01-26 20:13:

I used the property name "Color" instead of "Fill" (which should be of type Brush).


objo wrote at 2012-01-26 21:13:

After one more thought I changed again to "Fill" as you suggested, to be consistent with the other objects in the library.

0

Controlling Camera Position

Anonymous 10 years ago 0
This discussion was imported from CodePlex

jacobya wrote at 2012-01-23 06:00:

Hi objo,

I have a question regarding controlling the camera position and the direction the camera is looking.  What I'm essentially trying to do is to move the camera to a specific position (i.e. new Point3D(0, 100, 100)) and have the camera look at position 0, 0, 0.  The code I am using is this:

Viewport.CameraController.CameraPosition = new Point3D

(0, 100, 100);

Viewport.LookAt(new Point3D

(0, 0, 0), 1500);

This doesn't seem to have the expected behavior.  After I move the camera around in the Viewport and change the Rotation etc..., executing the following code seems to move the camera and then puts it back where it was before the code was executed.  Any idea what I'm doing wrong?  I noticed there is a LookAt overload that takes a Vector3D as the second argument, but I'm not sure what should be passed here.

Thanks,

Jason


objo wrote at 2012-01-26 20:02:

hi Jason, the LookAt method you are using should keep the LookDirection unchanged and is changing the Position of the camera. There is an overload that also takes a LookDirection as an argument:

public static void LookAt(ProjectionCamera camera, Point3D target, Vector3D newLookDirection, double animationTime)

Also note that it should be possible to write

Viewport.Camera.Position = new Point3D(0,100,100);

(not using CameraController). 

0

Pivot Point for RotationManipulator

Anonymous 10 years ago 0
This discussion was imported from CodePlex

przem321 wrote at 2012-01-14 07:12:

Hi,

I just needed the RotatonManipulator and figured out that there is no property to provide a pivot (= center of the rotation). It might appear as it is not necessary, but the current manipulator only rotates an object around its center if the geometry is centered around the origin. If the objects geometry is shifted (i.e. the actual vertex positions are such that the object does not center around the origin) than the object does not rotate around its center, but around its actual local origin. This point can now be set with the Pivot property. Note in most cases the geometry is centered properly such that it can be left at (0,0,0). A good test case is a box with its min corner at (0,0,0) and max at (1,1,1).

I added the prop to the abstract Manipulator class and changed the rotation call (OnMouseMove in the RotationManipulator class). I also provided these props to the CombinedManipulater class. Further I added a Bind and UnBind method for easy in-code-binding, since someone was asking how does it work:

    /// <summary>
    /// Binds this manipulator to a given Visual3D.
    /// </summary>
    /// <param name="source">Source Visual3D which receives the manipulator transforms.</param>
    public virtual void Bind(ModelVisual3D source)
    {
        BindingOperations.SetBinding(this, CombinedManipulator.TargetTransformProperty, new Binding("Transform") { Source = source });
        BindingOperations.SetBinding(this, CombinedManipulator.TransformProperty, new Binding("Transform") { Source = source });
    }

    /// <summary>
    /// Releases the binding of this manipulator.
    /// </summary>
    public virtual void UnBind()
    {
        BindingOperations.ClearBinding(this, CombinedManipulator.TargetTransformProperty);
        BindingOperations.ClearBinding(this, CombinedManipulator.TransformProperty);
    }

 

I will sent you the patch, maybe you want to integrate it. Cheers. P.


objo wrote at 2012-01-16 07:16:

Great! I submitted these changes. Should also add an example in the ManipulatorDemo...

0

Updating FOV from bound code

Anonymous 10 years ago 0
This discussion was imported from CodePlex

cobra18t wrote at 2011-12-20 17:02:

I have the field of view of a perspective camera bound to a int variable in the code behind. Right now, it will not update the field of view until I "flick" the mouse with the right mouse button. Just rotating around will not cause the update. Is there something, perhaps a function that I can call, to force the camera FOV to update automatically?


objo wrote at 2011-12-21 21:36:

Sorry, I don't understand the problem here.

Here is an example binding the FieldOfView property of a PerspectiveCamera to a Slider

<Grid>
	<helix:HelixViewport3D>
        	<helix:DefaultLights/>
                <helix:CubeVisual3D SideLength="4" Fill="Blue"/>
                <helix:HelixViewport3D.Camera>
                	<PerspectiveCamera FieldOfView="{Binding Value, ElementName=FieldOfViewSlider}"/>
                </helix:HelixViewport3D.Camera>
        </helix:HelixViewport3D>
        <StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="8">
                <Slider Name="FieldOfViewSlider" Value="45" Minimum="10" Maximum="160" Width="200"/>
        </StackPanel>
</Grid>
Binding to a property in the DataContext should work the same way. Are you raising INotifyPropertyChanged events?


cobra18t wrote at 2011-12-21 21:45:

Let me see if I can clarify...I am an idiot and forgot to raise a propertychanged event. It works just fine now.

0

Orthographic Camera - Undesired Clipping on Zoom In (Near Plane Issues?)

Anonymous 10 years ago 0
This discussion was imported from CodePlex

ezolotko wrote at 2013-08-02 04:28:

Hi,

Thank you for the great library.
I have successfully used the orthographic camera to display my scene, but with one problem:
when I zoom in my scene by moving the mouse wheel forward, I encounter the polygons clipping like it is shown in the picture:


I tried to reduce the camera near plane distance, but with no noticeable effect. Here is my camera definition:
            Camera = new OrthographicCamera
            {
                LookDirection = new Vector3D(-398.987, -42.626, -19.482),
                UpDirection = new Vector3D(-0.049, -0.001, 0.999),
                Position = new Point3D(398.987, 42.626, 19.482),
                Width = 235,
            };
Am I doing anything wrong?

ezolotko wrote at 2013-08-05 03:03:

My latest experiments showed that if I use "Zoom to mouse point" selection method, and there is a polygon under the mouse pointer, the issue seem to stop reproducing. I think this somehow may be related to use of GetNearestPoint method to calculate the camera target in this case, so the camera view matrix gets recalculated in more suitable way. Still have no exact thoughts how to fix the issue concisely.

ezolotko wrote at 2013-08-06 04:03:

Finally, I ended up using CameraHelper.LookAt to position the camera and OrthographicCamera.Width to zoom - manually, it doesn't produce the effects the CameraController does.

Mrme wrote at 2013-08-06 10:09:

So , are there any changes to be submitted to the source code ?

ezolotko wrote at 2013-08-06 10:17:

@Mrme: no, I just used the library the other way to workaround my issue.

ShadesJeff wrote at 2013-09-24 23:02:

I can recreate this issue with the Camera example shipped with the toolkit. It happens with both zoom and rotation.

To reproduce, open the Camera demo, then switch to the Orthographic mode. Do some random zooming and rotating and you should be able to get it into a mode where the clipping is incorrect. In my trials, it seems that the incorrect clipping only affects the top and bottom regions, it does not appear to clip incorrectly on the left or right.

Sometimes the incorrect clipping is dynamic, e.g. the clipping line will move as you rotate the model whereas other times it is fixed.

objo wrote at 2013-09-25 08:59:

Did you try changing the NearPlaneDistance?
The near plane distance should not be changed when zooming or rotating.
Currently the near plane distance is copied when the user change from perspective to orthographic, maybe this code should be removed.

objo wrote at 2013-09-26 22:40:

The problem could also being related to the Position of the camera being too close to the model. The camera controller uses Position+LookDirection to define the target point that the camera rotates around. Maybe the problem is related to the length of LookDirection being changed when toggling between perspective and orthographic camera...
Set ShowCameraInfo = true on the HelixViewport3D to review the settings of the camera.

ShadesJeff wrote at 2013-09-26 22:47:

Hi objo,

That's essentially was the problem - I had universally specified my look directions as unit vectors, when in fact they need to be scaled to world units in order for the view to function correctly. I still think there is an issue when changing between orthographic and perspective projections (field of view explodes), but I cannot reliably recreate it.

objo wrote at 2013-09-27 11:12:

In orthographic mode try to press "S" to move away from the target, or "W" to move closer.
Maybe zooming in orthographic mode should change the CameraPosition and LookDirection in the same way as for perspective camera.

rinaldin wrote at 2013-10-03 22:14:

@objo and @ezolotko
so what's the solution? Pressing "S" in my case solved the problem, but I just want to prevent the clipping happening.
From this:
Finally, I ended up using CameraHelper.LookAt to position the camera and OrthographicCamera.Width to zoom - manually, it doesn't produce the effects the CameraController does.
How can I leave the default mouse control and ovverride the Zoom function? Sorry, but it is not clear to me.

Giovanni

rinaldin wrote at 2013-10-25 22:27:

I finally solved changing the Helix source code in the file ZoomHandles.cs at line:
var newRelativePosition = relativePosition * (1 + delta);
changing it to:
var newRelativePosition = relativePosition * (1.1 + delta);
No more clipping and no need to use LookAt.

wangzh wrote at 2014-07-24 04:56:

rinaldin wrote:
I finally solved changing the Helix source code in the file ZoomHandles.cs at line:
var newRelativePosition = relativePosition * (1 + delta);
changing it to:
var newRelativePosition = relativePosition * (1.1 + delta);
No more clipping and no need to use LookAt.
rinaldin,

I have the same issue when I use the latest Helix version. I checked the source codes and didn't find the ZoomHandles.cs file. Only ZoomHandler.cs found. Is it same file? Also, I didn't find the code
var newRelativePosition = relativePosition * (1 + delta); 
in the file ZoomHandler.cs.


Any comment and suggestion to resolve the problem?


Thanks in advance!

rinaldin wrote at 2014-07-24 19:46:

Yes, the file is ZoomHandler.cs, it was a typing mistake. Anyway, I noticed that in the later version of Helix Toolkit that code changes and it is written in a different way. I used the version helixtoolkit_f5a96293a071.

wangzh wrote at 2014-07-25 02:42:

rinaldin wrote:
Yes, the file is ZoomHandler.cs, it was a typing mistake. Anyway, I noticed that in the later version of Helix Toolkit that code changes and it is written in a different way. I used the version helixtoolkit_f5a96293a071.
rinaldin,

Thanks for your reply. I found the latest revision changed from:
 var newRelativePosition = relativePosition * (1 + delta);
 var newRelativeTarget = relativeTarget * (1 + delta);
to
 var f = Math.Pow(2.5, delta);
 var newRelativePosition = relativePosition * f;
 var newRelativeTarget = relativeTarget * f;
The latest version still has the same issue. It is a great library. However, I am stuck in this step. Since I am new in WPF, I am wondering if you could send me correct HelixToolkit.Wpf.dll to me it will be greatly appreciated.
my email: wangzh2000@yahoo.com

wangzh wrote at 2014-07-25 15:49:

I finally figured out the problem in other way as follows:
 public MainWindow()
        {
            InitializeComponent();
            resetZoom();
         }
Then write resetZoom()
private void resetZoom()
        {
            OrthographicCamera myOCamera = new OrthographicCamera(new Point3D(0, 0, 0), new Vector3D(100000, 100000, -100000), new Vector3D(0, 0, 1), 5000);
            ViewPort.Camera = myOCamera;
            
        }
Each time, when creating a model, using ZoomExtents() at the end of method, for instance:
double z1 = 0;
double h = 500;
        private void cylinder_Click(object sender, RoutedEventArgs e)
        {
            PipeVisual3D pipe = new PipeVisual3D();
            pipe.Point1 = new Point3D(0, 0, z1);
            pipe.Point2 = new Point3D(0, 0, z1+h);
            pipe.Material = Materials.LightGray;
            pipe.Diameter = 1200;
            pipe.InnerDiameter = 1180;
            z1 += h;
            SolidModels.Children.Add(pipe);
            ViewPort.ZoomExtents();
        }
I am a green bee in WPF and C#, any education and new simple way in the issue sharing will be greatly appreciated.

This WPF library package is great. Thanks objo for this work!!!


Cheers,
0

CREATE CURVED PANELS

Anonymous 10 years ago 0
This discussion was imported from CodePlex

esi wrote at 2013-10-18 15:30:

Hi,
I would like to create a curved surface to join two Cube faces together.
is this possible with helix3dToolKit?
I tried with AddExtrudedGeometry and AddLoftedGeometry but I didn't understand the right way to use them.

Did someone used those methods?

Thank You in advance for help

Regards
0

how do i use doublekeydictionary in my unity project?

Thomas Clifton Olivent 10 years ago 0
I've downloaded the master file, but aside from that, I have no idea where to place it or what to do with it.
0

How to get a element/object and then rotate it?

Anonymous 10 years ago 0
This discussion was imported from CodePlex

musicxpg wrote at 2013-03-20 04:35:

I made a 3d model in 3dmax. There is a fan in the model. I want to rotate the fan. There are some questions:
  1. How can I get handler of the fan? I named the fan in the 3ds file. Can I get the handler?
  2. How can I rotate it? There are two examples in Helix, however, the elements were generated in the examples, other than from 3ds file.
  3. How can I change the color of the fan using Helix?
Thanks again for this amazing toolkit. And many many thanks to Objo!

Regards,
Young
0

Manipulation Events on a HelixViewport3D

Anonymous 10 years ago 0
This discussion was imported from CodePlex

JohnSourcer wrote at 2012-12-10 12:50:

Hi All,

I've created a HelixViewport3D which contains a SphereVisual3D. I'm trying to capture manipulation events on it. Does anybody know if this is supported?

HV3D.ZoomExtentsWhenLoaded = true;
HV3D.Viewport.IsManipulationEnabled = true;
HV3D.Viewport.ManipulationStarting += Viewport_ManipulationStarting;
Never fires but TouchDown events fire on HV3D. Does anyone have any guidance on this?


JohnSourcer wrote at 2012-12-10 13:32:

Apols, this has something to do with it being in a Scatterview.


nsousa wrote at 2013-04-04 18:47:

I have the same problem.

Manipulation events don't work inside a ScatterViewItem.

Anyone has a solution to this problem?

objo wrote at 2013-04-15 12:47:

Is this related to the Surface SDK? Do I need Surface hardware to reproduce this?

nsousa wrote at 2013-04-15 12:54:

Yes, it's related to the Surface SDK.

No, you don't need to have Surface hardware.
You can use the Input Simulator (available in the Surface SDK) to reproduce it.

http://msdn.microsoft.com/en-us/library/ff727911.aspx