Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HasReflection property in the Transform class?

2 REPLIES 2
Reply
Message 1 of 3
MattKincaid
468 Views, 2 Replies

HasReflection property in the Transform class?

The Transform class has a property called HasReflection and another property called Determinant.  I'm trying to better understand the relationship between the 2.

 

From observation, I've noticed that when the determinant is negative, HasReflection evaluates to True.  When the determinant is positive, HasReflection evaluates to false.

 

So 2 questions I guess.  One, is the relationship described above guaranteed to be valid under all conditions?  Two, how is the API actually determining the value of HasReflection?  Is it derived by the other info already exposed in the Transform class?  Is it a flag set by Revit whenever a reflection is applied to something?  Something else?

 

In researching, I did stumble onto the post linked below, which seems a bit related.  Any hints would be much appreciated!

 

https://forums.autodesk.com/t5/revit-api-forum/transform-matrix/m-p/6014293

2 REPLIES 2
Message 2 of 3
aignatovich
in reply to: MattKincaid

Hi!

 

It is true, at least until all 3 basis vectors are orthogonal, you can also test it by checking Transform.IsConfromal property value.

 

Any valid transformation (e.g. matrix determinant is not equal to zero) can be described as a combination of translation, rotation, scaling and reflection matrices. Only reflection matrices change the handedness of a coordinate system. You can also check it: t.BasisX.CrossProduct(t.BasisY) should return t.BasisZ value. If it is so, your transform does not have reflection and determinant is positive.

 

If you change the direction of one of transform basis or swap 2 vectors (for example BasisX and BasisY) the transform will determine reflection, its determinant will become negative and BasisX x BasisY will be -1*BasisZ

Message 3 of 3
MattKincaid
in reply to: MattKincaid

Thanks for the explanation aignatovich.  Quite helpful.  My lingering questions are related specifically to the implementation details of the HasReflection property and how the Revit API makes that decision.  Think I may have just found the answer though.

 

The api documentation states, "Reflection transformation changes the handedness of a coordinate system."

 

So that seems to be the answer.  HasReflection seems to just be an evaluation of whether or not the associated Transform matrix results in a change to the handedness of the coordinate system.  But if anyone knows otherwise, please correct me.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Rail Community