Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@MiguelG97
Copy link
Member

Description

As outlined by author in the issue #1667, the current implementation retrieves IfcAlignment components with coordinates in local space only. According to the IFC documentation, each IfcAlignment has a placement relative to a coordinate system, which was previously not included in the alignment object results and was requested by the user in the issue report.

IfcCartesianPoint representing the project origin, which needs to be used as the reference coordinate system for the IfcAlignment object
image

Proposal

This PR adds a FlattenedWorldTransformMatrix field to the alignment object that includes the world coordinate position and rotation information.
image

Note that the existing FlatCoordinationMatrix field do not contain world transformation data. It's purpose should be documented and discussed in a separate issue.

image

Example

Users can access and reconstruct the world transformation matrix as follows:

const worldMatrix = new THREE.Matrix4();
const alignments_webifc = ifcApi.GetAllAlignments(modelId);
const alignment = alignments_webifc[0];
worldMatrix.fromArray(alignment.FlattenedWorldTransformMatrix);

Then the coordinates can be computed in world space as follows:

alignment.horizontal.forEach(
      ({ points }: { points: { x: number; y: number; z: number }[] }) => {
      
      points.forEach((pt) => {
          const localPt = new THREE.Vector3(pt.x, pt.y, pt.z);
          const worldPt = localPt.applyMatrix4(worldMatrix);
        });
      });

Full example:

const alignments_webifc = ifcApi.GetAllAlignments(modelId);
for (const alignment of alignments_webifc) {
    const worldMatrix = new THREE.Matrix4();
    worldMatrix.fromArray(alignment.FlattenedWorldTransformMatrix);

    alignment.horizontal.forEach(
      ({ points }: { points: { x: number; y: number; z: number }[] }) => {
        const worldCoordinates: THREE.Vector3[] = [];
        const localCoordinates: THREE.Vector3[] = [];
        points.forEach((pt) => {
          const localPt = new THREE.Vector3(pt.x, pt.y, pt.z);
          localCoordinates.push(localPt);

          const worldPt = localPt.clone().applyMatrix4(worldMatrix);
          worldCoordinates.push(worldPt);
        });
        console.log(localCoordinates);
        console.log(worldCoordinates);
      }
    );
  }

Local Coordinates Before PR:
image

World Coordinates After PR:
image

@beachtom beachtom merged commit 5f5428d into ThatOpen:main Dec 21, 2025
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.