How to detect if a sub-property is changedHow do I calculate someone's age in C#?How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?What is the difference between a field and a property?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?LINQ's Distinct() on a particular propertyHow do I generate a random int number?How to Sort a List<T> by a property in the objectSqlDataReader C#, SQL Server 2005, VS 2008What is a NullReferenceException, and how do I fix it?
Do I need to start off my book by describing the character's "normal world"?
What should we do with manuals from the 80s?
Using lazy-init pattern properties on Apex data objects in LWC
If a person claims to know anything could it be disproven by saying 'prove that we are not in a simulation'?
Why won't the Republicans use a superdelegate system like the DNC in their nomination process?
Is there a word for returning to unpreparedness?
Short comic about alien explorers visiting an abandoned world with giant statues that turn out to be alive but move very slowly
Is there any official ruling on how characters go from 0th to 1st level in a class?
Did Pope Urban II issue the papal bull "terra nullius" in 1095?
Does writing regular diary entries count as writing practice?
Are there any cons in using rounded corners for bar graphs?
Would the USA be eligible to join the European Union?
Why does auto deduce this variable as double and not float?
What is the hottest thing in the universe?
Why don't modern jet engines use forced exhaust mixing?
How to prevent criminal gangs from making/buying guns?
Why is the battery jumpered to a resistor in this schematic?
Visa on arrival to exit airport in Russia
A+ rating still unsecure by Google Chrome's opinion
Can I use my OWN published papers' images in my thesis without Copyright infringment
Unconventional examples of mathematical modelling
What is the opposite of "hunger level"?
Does the Haste spell's hasted action allow you to make multiple unarmed strikes? Or none at all?
What is the question mark?
How to detect if a sub-property is changed
How do I calculate someone's age in C#?How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?What is the difference between a field and a property?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?LINQ's Distinct() on a particular propertyHow do I generate a random int number?How to Sort a List<T> by a property in the objectSqlDataReader C#, SQL Server 2005, VS 2008What is a NullReferenceException, and how do I fix it?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to animate a ModelVisual3D but I cannot detect when the parent object's frame of reference has changed.
I have a class FrameOfReference which is a 3D coordinate frame using ZYX Euler angles to describe the orientation. This class has a TransformGroup property that reflects the frame's position that gets updated whenever X,Y,Z,A,B, or C is changed. It is very important to me that I interact with the ZYX Euler angles to create transformations, and not a TransformGroup.
I also have a class EOAT ("end of arm tool"), which has properties FrameOfReference and ModelVisual3D. I am trying to get the ModelVisual3D to update if a property of the FrameOfReference has changed.
public class FrameOfReference
private double _x, _y, _z, _a, _b, _c, _legLength;
private ModelVisual3D _model;
private Transform3DGroup _transformGroup;
public FrameOfReference()
_x = 0;
_y = 0;
_z = 0;
_a = 0;
_b = 0;
_c = 0;
public double X
get return _x;
set _x = value; UpdateTransformGroup();
public double Y
get return _y;
set
_y = value; UpdateTransformGroup();
public double Z
get return _z;
set _z = value; UpdateTransformGroup();
public double A
get return _a;
set _a = value; UpdateTransformGroup();
public double B
get return _b;
set _b = value; UpdateTransformGroup();
public double C
get return _c;
set _c = value; UpdateTransformGroup();
public void Transform3DGroup UpdateTransformGroup()
//convert ZYX Euler angles into a transformgroup
Transform3DGroup group = new Transform3DGroup();
Vector3D e = new Vector3D(C, B, A);
Quaternion q = new Quaternion(new Vector3D(0.0, 0.0, 1.0), e.Z)
* new Quaternion(new Vector3D(0.0, 1.0, 0.0), e.Y)
* new Quaternion(new Vector3D(1.0, 0.0, 0.0), e.X);
AxisAngleRotation3D r = new AxisAngleRotation3D(q.Axis, q.Angle);
group.Children.Add(new RotateTransform3D(r));
group.Children.Add(new TranslateTransform3D(X, Y, Z));
_transformGroup = group;
public Transform3DGroup TransformGroup
get
return _transformGroup;
set _transformGroup = value;
and my class that is the EOAT and contains the ModelVisual3D and FrameOfReference
class EOATModel
private FrameOfReference _frame;
private ModelVisual3D _model;
public EOATModel()
Frame = new FrameOfReference();
public EOATModel(FrameOfReference Frame)
this.Frame = Frame;
public FrameOfReference Frame
get
return _frame;
set
_frame = value;
CreateModel();
public ModelVisual3D Model
get
return _model;
set
_model = value;
public void CreateModel()
if (_model != null)
//--a bunch of code that makes the EOAT since its irrelevant--
_model.Children.Add(EOATCube);
_model.Transform = Frame.TransformGroup;
Some sample code showing how I make the _eoat.
public class Main
EOAT _eoat = new EOAT()
_eoat.Frame.X = 100;
_eoat.Frame.Y = 100;
_eoat.Frame.Z = 100;
_eoat.Frame.A = 100;
_eoat.Frame.B = 100;
_eoat.Frame.C = 100;
_eoat.Model = new ModelVisual3D();
viewPort3d.Children.Add(_eoat.Model);
_eoat.Frame.C = 45;
If I enter "_eoat.Frame.C = 45", the FrameOfReference inside _eoat does not detect that the frame has been changed and therefore does not update the model with CreateModel(). I know I could just manually call CreateModel() after I change the frame, but this won't work when it comes time to do animation storyboard stuff, since the animation simply changes a value over time and cannot call CreateModel() during the animation.
In short, how do I get EOAT to automatically call CreateModel() whenever anything inside Frame is changed. I have tried INotifyPropertyChange code, but haven't gotten any of it to work.
Sorry about all the content. I hope this question makes sense. Thank you.
c# wpf storyboard inotifypropertychanged helix-3d-toolkit
add a comment |
I want to animate a ModelVisual3D but I cannot detect when the parent object's frame of reference has changed.
I have a class FrameOfReference which is a 3D coordinate frame using ZYX Euler angles to describe the orientation. This class has a TransformGroup property that reflects the frame's position that gets updated whenever X,Y,Z,A,B, or C is changed. It is very important to me that I interact with the ZYX Euler angles to create transformations, and not a TransformGroup.
I also have a class EOAT ("end of arm tool"), which has properties FrameOfReference and ModelVisual3D. I am trying to get the ModelVisual3D to update if a property of the FrameOfReference has changed.
public class FrameOfReference
private double _x, _y, _z, _a, _b, _c, _legLength;
private ModelVisual3D _model;
private Transform3DGroup _transformGroup;
public FrameOfReference()
_x = 0;
_y = 0;
_z = 0;
_a = 0;
_b = 0;
_c = 0;
public double X
get return _x;
set _x = value; UpdateTransformGroup();
public double Y
get return _y;
set
_y = value; UpdateTransformGroup();
public double Z
get return _z;
set _z = value; UpdateTransformGroup();
public double A
get return _a;
set _a = value; UpdateTransformGroup();
public double B
get return _b;
set _b = value; UpdateTransformGroup();
public double C
get return _c;
set _c = value; UpdateTransformGroup();
public void Transform3DGroup UpdateTransformGroup()
//convert ZYX Euler angles into a transformgroup
Transform3DGroup group = new Transform3DGroup();
Vector3D e = new Vector3D(C, B, A);
Quaternion q = new Quaternion(new Vector3D(0.0, 0.0, 1.0), e.Z)
* new Quaternion(new Vector3D(0.0, 1.0, 0.0), e.Y)
* new Quaternion(new Vector3D(1.0, 0.0, 0.0), e.X);
AxisAngleRotation3D r = new AxisAngleRotation3D(q.Axis, q.Angle);
group.Children.Add(new RotateTransform3D(r));
group.Children.Add(new TranslateTransform3D(X, Y, Z));
_transformGroup = group;
public Transform3DGroup TransformGroup
get
return _transformGroup;
set _transformGroup = value;
and my class that is the EOAT and contains the ModelVisual3D and FrameOfReference
class EOATModel
private FrameOfReference _frame;
private ModelVisual3D _model;
public EOATModel()
Frame = new FrameOfReference();
public EOATModel(FrameOfReference Frame)
this.Frame = Frame;
public FrameOfReference Frame
get
return _frame;
set
_frame = value;
CreateModel();
public ModelVisual3D Model
get
return _model;
set
_model = value;
public void CreateModel()
if (_model != null)
//--a bunch of code that makes the EOAT since its irrelevant--
_model.Children.Add(EOATCube);
_model.Transform = Frame.TransformGroup;
Some sample code showing how I make the _eoat.
public class Main
EOAT _eoat = new EOAT()
_eoat.Frame.X = 100;
_eoat.Frame.Y = 100;
_eoat.Frame.Z = 100;
_eoat.Frame.A = 100;
_eoat.Frame.B = 100;
_eoat.Frame.C = 100;
_eoat.Model = new ModelVisual3D();
viewPort3d.Children.Add(_eoat.Model);
_eoat.Frame.C = 45;
If I enter "_eoat.Frame.C = 45", the FrameOfReference inside _eoat does not detect that the frame has been changed and therefore does not update the model with CreateModel(). I know I could just manually call CreateModel() after I change the frame, but this won't work when it comes time to do animation storyboard stuff, since the animation simply changes a value over time and cannot call CreateModel() during the animation.
In short, how do I get EOAT to automatically call CreateModel() whenever anything inside Frame is changed. I have tried INotifyPropertyChange code, but haven't gotten any of it to work.
Sorry about all the content. I hope this question makes sense. Thank you.
c# wpf storyboard inotifypropertychanged helix-3d-toolkit
add a comment |
I want to animate a ModelVisual3D but I cannot detect when the parent object's frame of reference has changed.
I have a class FrameOfReference which is a 3D coordinate frame using ZYX Euler angles to describe the orientation. This class has a TransformGroup property that reflects the frame's position that gets updated whenever X,Y,Z,A,B, or C is changed. It is very important to me that I interact with the ZYX Euler angles to create transformations, and not a TransformGroup.
I also have a class EOAT ("end of arm tool"), which has properties FrameOfReference and ModelVisual3D. I am trying to get the ModelVisual3D to update if a property of the FrameOfReference has changed.
public class FrameOfReference
private double _x, _y, _z, _a, _b, _c, _legLength;
private ModelVisual3D _model;
private Transform3DGroup _transformGroup;
public FrameOfReference()
_x = 0;
_y = 0;
_z = 0;
_a = 0;
_b = 0;
_c = 0;
public double X
get return _x;
set _x = value; UpdateTransformGroup();
public double Y
get return _y;
set
_y = value; UpdateTransformGroup();
public double Z
get return _z;
set _z = value; UpdateTransformGroup();
public double A
get return _a;
set _a = value; UpdateTransformGroup();
public double B
get return _b;
set _b = value; UpdateTransformGroup();
public double C
get return _c;
set _c = value; UpdateTransformGroup();
public void Transform3DGroup UpdateTransformGroup()
//convert ZYX Euler angles into a transformgroup
Transform3DGroup group = new Transform3DGroup();
Vector3D e = new Vector3D(C, B, A);
Quaternion q = new Quaternion(new Vector3D(0.0, 0.0, 1.0), e.Z)
* new Quaternion(new Vector3D(0.0, 1.0, 0.0), e.Y)
* new Quaternion(new Vector3D(1.0, 0.0, 0.0), e.X);
AxisAngleRotation3D r = new AxisAngleRotation3D(q.Axis, q.Angle);
group.Children.Add(new RotateTransform3D(r));
group.Children.Add(new TranslateTransform3D(X, Y, Z));
_transformGroup = group;
public Transform3DGroup TransformGroup
get
return _transformGroup;
set _transformGroup = value;
and my class that is the EOAT and contains the ModelVisual3D and FrameOfReference
class EOATModel
private FrameOfReference _frame;
private ModelVisual3D _model;
public EOATModel()
Frame = new FrameOfReference();
public EOATModel(FrameOfReference Frame)
this.Frame = Frame;
public FrameOfReference Frame
get
return _frame;
set
_frame = value;
CreateModel();
public ModelVisual3D Model
get
return _model;
set
_model = value;
public void CreateModel()
if (_model != null)
//--a bunch of code that makes the EOAT since its irrelevant--
_model.Children.Add(EOATCube);
_model.Transform = Frame.TransformGroup;
Some sample code showing how I make the _eoat.
public class Main
EOAT _eoat = new EOAT()
_eoat.Frame.X = 100;
_eoat.Frame.Y = 100;
_eoat.Frame.Z = 100;
_eoat.Frame.A = 100;
_eoat.Frame.B = 100;
_eoat.Frame.C = 100;
_eoat.Model = new ModelVisual3D();
viewPort3d.Children.Add(_eoat.Model);
_eoat.Frame.C = 45;
If I enter "_eoat.Frame.C = 45", the FrameOfReference inside _eoat does not detect that the frame has been changed and therefore does not update the model with CreateModel(). I know I could just manually call CreateModel() after I change the frame, but this won't work when it comes time to do animation storyboard stuff, since the animation simply changes a value over time and cannot call CreateModel() during the animation.
In short, how do I get EOAT to automatically call CreateModel() whenever anything inside Frame is changed. I have tried INotifyPropertyChange code, but haven't gotten any of it to work.
Sorry about all the content. I hope this question makes sense. Thank you.
c# wpf storyboard inotifypropertychanged helix-3d-toolkit
I want to animate a ModelVisual3D but I cannot detect when the parent object's frame of reference has changed.
I have a class FrameOfReference which is a 3D coordinate frame using ZYX Euler angles to describe the orientation. This class has a TransformGroup property that reflects the frame's position that gets updated whenever X,Y,Z,A,B, or C is changed. It is very important to me that I interact with the ZYX Euler angles to create transformations, and not a TransformGroup.
I also have a class EOAT ("end of arm tool"), which has properties FrameOfReference and ModelVisual3D. I am trying to get the ModelVisual3D to update if a property of the FrameOfReference has changed.
public class FrameOfReference
private double _x, _y, _z, _a, _b, _c, _legLength;
private ModelVisual3D _model;
private Transform3DGroup _transformGroup;
public FrameOfReference()
_x = 0;
_y = 0;
_z = 0;
_a = 0;
_b = 0;
_c = 0;
public double X
get return _x;
set _x = value; UpdateTransformGroup();
public double Y
get return _y;
set
_y = value; UpdateTransformGroup();
public double Z
get return _z;
set _z = value; UpdateTransformGroup();
public double A
get return _a;
set _a = value; UpdateTransformGroup();
public double B
get return _b;
set _b = value; UpdateTransformGroup();
public double C
get return _c;
set _c = value; UpdateTransformGroup();
public void Transform3DGroup UpdateTransformGroup()
//convert ZYX Euler angles into a transformgroup
Transform3DGroup group = new Transform3DGroup();
Vector3D e = new Vector3D(C, B, A);
Quaternion q = new Quaternion(new Vector3D(0.0, 0.0, 1.0), e.Z)
* new Quaternion(new Vector3D(0.0, 1.0, 0.0), e.Y)
* new Quaternion(new Vector3D(1.0, 0.0, 0.0), e.X);
AxisAngleRotation3D r = new AxisAngleRotation3D(q.Axis, q.Angle);
group.Children.Add(new RotateTransform3D(r));
group.Children.Add(new TranslateTransform3D(X, Y, Z));
_transformGroup = group;
public Transform3DGroup TransformGroup
get
return _transformGroup;
set _transformGroup = value;
and my class that is the EOAT and contains the ModelVisual3D and FrameOfReference
class EOATModel
private FrameOfReference _frame;
private ModelVisual3D _model;
public EOATModel()
Frame = new FrameOfReference();
public EOATModel(FrameOfReference Frame)
this.Frame = Frame;
public FrameOfReference Frame
get
return _frame;
set
_frame = value;
CreateModel();
public ModelVisual3D Model
get
return _model;
set
_model = value;
public void CreateModel()
if (_model != null)
//--a bunch of code that makes the EOAT since its irrelevant--
_model.Children.Add(EOATCube);
_model.Transform = Frame.TransformGroup;
Some sample code showing how I make the _eoat.
public class Main
EOAT _eoat = new EOAT()
_eoat.Frame.X = 100;
_eoat.Frame.Y = 100;
_eoat.Frame.Z = 100;
_eoat.Frame.A = 100;
_eoat.Frame.B = 100;
_eoat.Frame.C = 100;
_eoat.Model = new ModelVisual3D();
viewPort3d.Children.Add(_eoat.Model);
_eoat.Frame.C = 45;
If I enter "_eoat.Frame.C = 45", the FrameOfReference inside _eoat does not detect that the frame has been changed and therefore does not update the model with CreateModel(). I know I could just manually call CreateModel() after I change the frame, but this won't work when it comes time to do animation storyboard stuff, since the animation simply changes a value over time and cannot call CreateModel() during the animation.
In short, how do I get EOAT to automatically call CreateModel() whenever anything inside Frame is changed. I have tried INotifyPropertyChange code, but haven't gotten any of it to work.
Sorry about all the content. I hope this question makes sense. Thank you.
c# wpf storyboard inotifypropertychanged helix-3d-toolkit
c# wpf storyboard inotifypropertychanged helix-3d-toolkit
asked Mar 27 at 12:24
MicahstuhMicahstuh
366 bronze badges
366 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can simply add an event handler to the NotifyPropertyChanged event of FrameOfReference and call CreateModel from the event handler.
public EOATModel()
Frame = new FrameOfReference();
Frame.PropertyChanged += (o,e) => CreateModel());
That was the missing piece! Thanks Georg. Now all I have to do is figure out how to make those dependency properties so I can refer to them in the target property storyboard stuff.
– Micahstuh
Mar 27 at 16:30
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55377144%2fhow-to-detect-if-a-sub-property-is-changed%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can simply add an event handler to the NotifyPropertyChanged event of FrameOfReference and call CreateModel from the event handler.
public EOATModel()
Frame = new FrameOfReference();
Frame.PropertyChanged += (o,e) => CreateModel());
That was the missing piece! Thanks Georg. Now all I have to do is figure out how to make those dependency properties so I can refer to them in the target property storyboard stuff.
– Micahstuh
Mar 27 at 16:30
add a comment |
You can simply add an event handler to the NotifyPropertyChanged event of FrameOfReference and call CreateModel from the event handler.
public EOATModel()
Frame = new FrameOfReference();
Frame.PropertyChanged += (o,e) => CreateModel());
That was the missing piece! Thanks Georg. Now all I have to do is figure out how to make those dependency properties so I can refer to them in the target property storyboard stuff.
– Micahstuh
Mar 27 at 16:30
add a comment |
You can simply add an event handler to the NotifyPropertyChanged event of FrameOfReference and call CreateModel from the event handler.
public EOATModel()
Frame = new FrameOfReference();
Frame.PropertyChanged += (o,e) => CreateModel());
You can simply add an event handler to the NotifyPropertyChanged event of FrameOfReference and call CreateModel from the event handler.
public EOATModel()
Frame = new FrameOfReference();
Frame.PropertyChanged += (o,e) => CreateModel());
answered Mar 27 at 14:39
GeorgGeorg
4,28314 silver badges34 bronze badges
4,28314 silver badges34 bronze badges
That was the missing piece! Thanks Georg. Now all I have to do is figure out how to make those dependency properties so I can refer to them in the target property storyboard stuff.
– Micahstuh
Mar 27 at 16:30
add a comment |
That was the missing piece! Thanks Georg. Now all I have to do is figure out how to make those dependency properties so I can refer to them in the target property storyboard stuff.
– Micahstuh
Mar 27 at 16:30
That was the missing piece! Thanks Georg. Now all I have to do is figure out how to make those dependency properties so I can refer to them in the target property storyboard stuff.
– Micahstuh
Mar 27 at 16:30
That was the missing piece! Thanks Georg. Now all I have to do is figure out how to make those dependency properties so I can refer to them in the target property storyboard stuff.
– Micahstuh
Mar 27 at 16:30
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55377144%2fhow-to-detect-if-a-sub-property-is-changed%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown