Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tessellation-with-pixel-texture - IfcPixelTexture pixel binary data alpha position #14

Closed
Andrej730 opened this issue Dec 25, 2023 · 1 comment

Comments

@Andrej730
Copy link
Contributor

@aothms

In IfcPixelTexture example opacity seems to be positioned at the highest byte - e.g. first pixel is 0FF000000 (FF alpha, white color with 100% alpha) but from IfcPixelTexture specs it seems that opacity should be at the lowest byte (e.g. 0x0000FF80 - 80 alpha, blue color with 50% alpha).

image

aothms added a commit that referenced this issue Dec 26, 2023
@aothms
Copy link
Contributor

aothms commented Dec 26, 2023

You're right as always andrej, not sure how this went unnoticed for over 10y, that surely shows something.

import ifcopenshell
pix = f.by_type('IfcPixelTexture')[0][8]
a = numpy.array(list(map(functools.partial(int, base=2), pix))).reshape((256, 256))[::-1,::1]
plt.imshow(a); plt.show()

a = numpy.array(list(map(lambda s: tuple(map(functools.partial(int, base=2), (s[8:16], s[16:24], s[24:32], s[0:8]))), pix))).reshape((256, 256, 4))[::-1,::1]
plt.imshow(a); plt.show()

afbeelding

afbeelding

Since I had the code here to do the byte swivelling, I just commited the fix (and fixed a serialization issue in ifcopenshell in the meantime).

@aothms aothms closed this as completed Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants