Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Graphisoft Community (INT)
- :
- Developer Hub
- :
- Archicad C++ API
- :
- Hotlink Mirror on its axis

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Pin this post for me
- Bookmark
- Subscribe to Topic
- Mute
- Printer Friendly Page

Archicad C++ API

About Archicad add-on development using the C++ API.

SOLVED!

Hotlink Mirror on its axis

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

2024-05-20 08:23 PM - edited 2024-05-20 08:35 PM

2024-05-20
08:23 PM

Hi,

Can you please help me, I'm really struggling on how can I mirror the hotlink via API.

I think this should be done by setting the hotlink element's transmat. However, I really cannot understand how to apply reflection/mirror.

I did some research and found this reference.

Based on the documentation,

x' = tmx[0] * x + tmx[1] * y + tmx[2] * z + tmx[3]

y' = tmx[4] * x + tmx[5] * y + tmx[6] * z + tmx[7]

z' = tmx[8] * x + tmx[9] * y + tmx[10] * z + tmx[11]

I tried to play around with the angle and mirror settings, but I got lost in betwee.

For example,

I placed the hotlink in **45Deg not mirrored**,

Then I placed the hotlink in **45Deg mirrored**,

If you will notice, **tmx[0]** and **tmx[4]** were negated.

I really don't know how to know which tmx index to negate.

I would appreciate it if you could guide me on this. (Helpful reference would be very much appreciated as well)

Note:

I did check the examples in the APIv27 Kit but i don't think there is a mirror example there (only angle rotation)

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

Solution

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

2024-05-25 09:46 AM

2024-05-25
09:46 AM

Also, when working with matrices, keep in mind that the order of operations matters, e.g. flipping and then rotating is not the same and rotating and then flipping. Reflect that in your code, so when applying transformations B and C to matrix A:

A . B . C is not the same as C . B . A

Ralph Wessel BArch

Software Engineer Speckle Systems

Software Engineer Speckle Systems

3 REPLIES 3

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

2024-05-21 03:14 PM

2024-05-21
03:14 PM

A matrix is transformed by multiplying it by a transformation matrix - don't think of this as just multiplying individual values. So a 4x4 matrix for a 45° rotation (A) looks like:

0.70710678118654757, -0.70710678118654746, 0, 0,

0.70710678118654746, 0.70710678118654757, 0, 0,

0, 0, 1, 0,

0, 0, 0, 1

The transformation matrix to flip across the y axis (B) looks like:

-1, 0, 0, 0,

0, 1 0, 0,

0, 0, 1, 0,

0, 0, 0, 1

A . B looks like:

-0.70710678118654757, -0.70710678118654746, 0, 0,

-0.70710678118654746, 0.70710678118654757, 0, 0,

0, 0, 1, 0,

0, 0, 0, 1

If you imagine the operations applied to a shape, mirroring also affects rotations. If you looked at a top spinning clockwise in a mirror it would appear to be spinning anti-clockwise, i.e. the mirror reverses the rotation direction. That's why you see multiple values change.

Ralph Wessel BArch

Software Engineer Speckle Systems

Software Engineer Speckle Systems

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

2024-05-25 12:26 AM

2024-05-25
12:26 AM

Thanks for the feedback.

I was able to get the equivalent transmat values based on your response by applying a combination of reflection and rotation (performed 2x2 matrix multiplication)

Solution

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

2024-05-25 09:46 AM

2024-05-25
09:46 AM

Also, when working with matrices, keep in mind that the order of operations matters, e.g. flipping and then rotating is not the same and rotating and then flipping. Reflect that in your code, so when applying transformations B and C to matrix A:

A . B . C is not the same as C . B . A

Ralph Wessel BArch

Software Engineer Speckle Systems

Software Engineer Speckle Systems