Overview

An IFC representation describes the value of a property. Geometric shape is the most common property. A representation contains a set of representation items and a context.

The representation for shape will contain geometry items and placements. A context gives precision information.

Axis Placements and Geometry

The items in a shape representation are all geometric or topologic representation item subtypes.

The "xform" and "vec" functions interface axis placements, directions, and points with the ROSE transform and vector operations. For example, ifcx_xform_put() extracts coordinates and axis directions from IFC placement or transform data, normalizes everything and puts the values into an array of sixteen doubles or RoseXform. The ifcx_vec_put() puts values from a cartesian point, direction, and similar types into an array of three doubles.

Other functions work with associated presentation information.

Contexts

The IFC geometry definitions are unitless, so unit information is supplied by the IfcProject.

A context supplies a geometric uncertainty, which is is the distance below which two points should be considered the same. It is important when exchanging geometry between systems that work at different precisions. The ifcx_context_precision() function returns the uncertainty declared by a context.

ifcx_context_precision()

double ifcx_context_precision(
	IfcRepresentationContext * ctx
	);

double ifcx_context_precision(
	IfcRepresentation * rep
	);

The ifcx_context_precision() function gets the precision from an IFC representation context or the context of a representation, with appropriate behavior for omitted and derived values.

ifcx_present_color()

unsigned ifcx_present_color(
	IfcRepresentationItem * item
        );

The ifcx_present_color() function gets the color of a representation item. The color comes from associated presentation information, so you must call ifcx_present_tag() before using this function.

The color is returned as a 24-bit RGB value of the form 0x00RRGGBB. If an item does not have any color information, the function return ROSE_MESH_NULL_COLOR.

unsigned rgb = ifcx_present_color(it);
unsigned red   = (rgb & 0xff0000) >> 16;
unsigned green = (rgb & 0x00ff00) >> 8;
unsigned blue  = (rgb & 0x0000ff);

printf ("r=%x g=%x b=%x\n", red, green, blue);

ifcx_present_styled_items()

IfcxStyledItemVec * ifcx_present_styled_items(
	IfcRepresentationItem * item
	);

The ifcx_present_styled_items() function returns the IfcStyledItem instances that reference a given representation_item. Before this function can be called, you must call ifcx_present_tag().

ifcx_present_tag()

void ifcx_present_tag(
        RoseDesign * des
        );

The ifcx_present_tag() function builds indexes on an IFC data set so that ifcx_present_color() and similar functions can find presentation information related to IFC geometry.

ifcx_present_transparency()

double ifcx_present_transparency(
	IfcRepresentationItem * item
        );

The ifcx_present_transparency() function gets the transparency state of a representation item. The function returns ROSE_NULL_REAL if an item is opaque, otherwise the number indicates the transparency, with 1.0 being fully transparent.

The transparency state comes from associated presentation information, so you must call ifcx_present_tag() before using this function.

ifcx_vec_put()

int ifcx_vec_put(double xyz[],       IfcPoint * pt);
int ifcx_vec_put(RosePoint& xyz,     IfcPoint * pt);

int ifcx_vec_put(double xyz[],       IfcCartesianPoint * cpt);
int ifcx_vec_put(RosePoint& xyz,     IfcCartesianPoint * cpt);

int ifcx_vec_put(double ijk[],       IfcDirection * dir);
int ifcx_vec_put(RoseDirection& ijk, IfcDirection * dir);

int ifcx_vec_put(double xyz[],       IfcVertex * v);
int ifcx_vec_put(RosePoint& xyz,     IfcVertex * v);



int ifcx_vec2d_put(double xy[],         IfcPoint * pt);
int ifcx_vec2d_put(RosePoint2D& xy,     IfcPoint * pt);

int ifcx_vec2d_put(double xy[],         IfcCartesianPoint * pt);
int ifcx_vec2d_put(RosePoint2D& xy,     IfcCartesianPoint * pt);

int ifcx_vec2d_put(double ij[],         IfcDirection * dir);
int ifcx_vec2d_put(RoseDirection2D& ij, IfcDirection * dir);

The ifcx_vec_put() function extracts IFC coordinate or direction data into a RosePoint, RoseDirection, or array of doubles for transform and vector math. The function returns nonzero if the assignment succeeded or zero if there was a problem. The ifcx_vec2d_put() versions extract a 2D result.

With a cartesian point, the coordinates list is extracted. If the point or coordinates list are null, or if the list does not contain enough coordinates, zero will be substituted for the missing values. The assignment will always succeed unless it is passed a null destination array. The version that takes an IfcPoint expects the value to be a cartesian point.

RosePoint dst_pt;
IfcCartesianPoint * pt = get_some_point();

ifcx_vec_put(dst_pt, pt);

With a direction, the ratios list is extracted. If the direction or list are null, or if the list does not contain enough ratios, zero will be substituted for the missing values. The assignment will always succeed unless it is passed a null destination array. Use rose_vec_is_zero() to test for missing direction data.

RoseDirection dst_dir;
IfcDirection * dir = get_some_dir();

ifcx_vec_put(dst_dir, dir);
if (rose_vec_is_zero(dst_dir))
        printf ("MISSING DIRECTION DATA!!\n");

rose_vec_normalize(dst_dir);  // if you want normalized data

With a vertex, the function will cast it to a IfcVertexPoint and set the array from the cartesian point referenced as the vertex_geometry. The function will set the array to all zeros and return zero if the vertex is not a IfcVertexPoint, or of the vertex_geometry is missing or not a cartesian point.

RosePoint dst_pt;
IfcVertex * vtx = get_some_topology();

if (!ifcx_vec_put(dst_pt, vtx))
        printf ("BAD VERTEX DATA!!\n");

ifcx_xform_compose()

void ifcx_xform_compose(
	RoseXform& result,
	const RoseXform& xform,
	IfcCartesianTransformationOperator * op
	);

void ifcx_xform_compose(
	RoseXform& xform,
	IfcCartesianTransformationOperator * op
	);

void ifcx_xform_compose(
	RoseXform& result,
	const RoseXform& xform,
	IfcAxis2Placement * ap
	);

void ifcx_xform_compose(
	RoseXform& xform,
	IfcAxis2Placement * ap
	);

The ifcx_xform_compose() function calls rose_xform_compose() to transform a matrix with a matrix built from an IFC object. The result is calculated by matrix multiplication orig_xform * ifx_obj_xform.

ifcx_xform_put()

int ifcx_xform_put(double xf[16], IfcAxis2Placement3D * ap);
int ifcx_xform_put(RoseXform& xf, IfcAxis2Placement3D * ap);

int ifcx_xform_put(double xf[16], IfcAxis2Placement * ap);
int ifcx_xform_put(RoseXform& xf, IfcAxis2Placement * ap);

int ifcx_xform_put(double xf[16], IfcAxis1Placement * ap);
int ifcx_xform_put(RoseXform& xf, IfcAxis1Placement * ap);

int ifcx_xform_put(double xf[16], IfcCartesianTransformationOperator * cto);
int ifcx_xform_put(RoseXform& xf, IfcCartesianTransformationOperator * cto);

int ifcx_xform_put(double xf[16], IfcObjectPlacement * place);
int ifcx_xform_put(RoseXform& xf, IfcObjectPlacement * place);


int ifcx_xform2d_put(double xf[9],    IfcAxis2Placement2D * ap);
int ifcx_xform2d_put(RoseXform2D& xf, IfcAxis2Placement2D * ap);

The ifcx_xform_put() function extracts IFC axis placements or transforms into a RoseXform or array of sixteen doubles for transform and vector math. The function returns nonzero if the assignment succeeded or zero if there was a problem. The ifcx_xform2d_put() versions extract a 2D result.

The result for an axis placement will be a normalized, right-handed, orthogonal matrix with all defaults handled properly as with rose_xform_put_dirs().

The result for a cartesian transformation operator will be normalized during construction but may then have a scaling factor applied. It is also possible for a CTO to encode a left-handed coordinate system. This function extracts data from the IFC instance and calls rose_xform_put_cto().

The result for an IfcObjectPlacement will compose any transforms necessary for "relative to" placements.