A QisMLib extension to compute 2D affine and bi-linear transformations on CAD data
QisMCorrX ExtensionQisMCorrX C++ API (qismcorrx.h)QisMCorrXFlagsShear_edge Mirror QisMCorrXNotifyVersion Control (QisMCorrXNotify)On_corrected_polygonOn_corrected_polygonsQisMCorrOptsVersion Control (QisMCorrOpts)Set_polygon_buffer_cntGet_polygon_buffer_cntSet_num_threadsGet_num_threadsSet_keep_source_polygonsGet_keep_source_polygonsCopyResetQisMCorrXObjVersion Control (QisMCorrXObj)Get_error_msg (QisMCorrXObj)Get_error_condition (QisMCorrXObj)Get_error_context (QisMCorrXObj)Get_corrected_extentsGet_corrected_polysCorrect_polygonsGet_correction_domainsQisMCorrXObjV2Correct_pointsRasterize_corrected_windowQisMCorrXObjV3File_dbFile_db_constQisMCorrXObjV4CorrectCorrect_dbuCorrect_inCorrect_in_dbuCorrect_toCorrect_to_dbuCorrect_in_bstoreQisMAffineXVersion Control (QisMAffineX)ResetTranslateRotateScaleFlip_XFlip_YFlip_XYShearTransformTransform_dbuTransform_inTransform_in_dbuTransform_toTransform_to_dbuTransform_in_bstoreCopyExploder_cbQisMCorrXVersion Control (QisMCorrX)Get_error_msg (QisMCorrX)Get_error_condition (QisMCorrX)Get_error_context (QisMCorrX)Create_objectDestroy_objectCreate_correction_objectDestroy_correction_objectCorrection_scaleCorrection_rotationCorrection_shearCorrection_mirrorQisMCorrXV2Create_affine_xformDestroy_affine_xformQisMCorrX Commandscorrx.create_affineaffine.setaffine.transformaffine.transform_bstorecorrx.destroy_affinecorrx.create_optscorrx.destroy_optscorrx.create_corrx_objcorrx.destroy_corrx_objcorrxobj.correct_viewcorrxobj.correct_polyscorrxobj.delete_storecorrxobj.print_corrected_extentscorrxobj.correct_window_extentscorrxobj.correctcorrxobj.correct_bstorecorrxobj.rasterize_windowcorrx.mirror_viewcorrx.shear_viewcorrx.rotate_viewcorrx.scale_viewcorrx.generate_ptsQisMCorrX Licensing (API)QisMCorrX Licensing (Script)QisMCorrX Version Historyqismcorrx dll/so v1.4 04-2023qismcorrx dll/so v1.3 02-2020qismcorrx dll/so v1.2 12-2019qismcorrx dll/so v1.1 10-2019qismcorrx dll/so v1.0 01-2019
A collection of enumerated constants
struct QisMCorrXFlags { ... };Flags indicating the choice of edge of the home view to be displaced while shearing
xxxxxxxxxxenum Shear_edge { SEF_UPPER = 0 //displace max-x ,SEF_LOWER = 1 //displace min-x ,SEF_LEFT = 2 //displace max-y ,SEF_RIGHT = 3 //displace min-y};Flags indicating the choice of axis for mirroring
xxxxxxxxxxenum Mirror { MF_ABOUT_X=0 //x' = x, y' = -y ,MF_ABOUT_Y=1 //x' = -x, y' = y ,MF_ABOUT_XY=2 //x' = -x, y' = -y};Callback class to be implemented by the client module that wishes to recieve the corrected polygons and any other notifications from QisMCorrXObj
xxxxxxxxxxclass QisMCorrXNotify { ... };The client module MUST implement these methods appropriately. It allows for backwards compatible operation as this class evolves in the future
xxxxxxxxxxvirtual const char* QisMCorrXNotify_name(const int version) const = 0;/* Sample implementation { switch(version) { case 0: return "<implementation_name>"; case 1: return "QisMCorrXNotify"; } return "";} */virtual void* QisMCorrXNotify_cast(const int version) = 0;/* Sample implementation { switch(version) { case 0: return this; case 1: return dynamic_cast<QisMCorrXNotify*>(this); } return 0;} */virtual const void* QisMCorrXNotify_cast(const int version) const = 0;/* Sample implementation { switch(version) { case 0: return this; case 1: return dynamic_cast<const QisMCorrXNotify*>(this); } return 0;} */virtual int QisMCorrXNotify_latest_version() const = 0;/* Sample implementation { return 1;} */Notification that a corrected polygon is available for use. This occurs when QisMCorrOpts::Set_num_threads() == 1 or QisMCorrOpts::Get_polygon_buffer_cnt() is very small (<32).
xy : List of x,y co-ordinates of the vertices of the polygon (int[nv*2]). The co-ordinates are in database-units (dbu). e.g for a um file with nm resolution (grid = 0.001 um), 1 dbu = 0.001 um. i.e dbu = user-unit/grid
nv : No. vertices. Since the polygon is closed, last vertex = first vertex. Therefore, for a rectangle, nv = 5
l,d : layer and datatype number
grid : grid value as defined in the source file
Return 0 to continue, non-zero to terminate the execution
This callback may be invoked simultaneously by multiple threads. It is the responsibility of the client implementation to protect shared data
xxxxxxxxxxvirtual int On_corrected_polygon( const int* xy, const int nv, const unsigned short l, const unsigned short d, const double grid ) { return 0; }Notification that a set of corrected polygons is available for use. This occurs when QisMCorrOpts::Set_num_threads() > 1 and QisMCorrOpts::Get_polygon_buffer_cnt() > 32
polys : Handle to a container of polygons (see qismbstore.h for details)
grid : grid value as defined in the source file
Return 0 to continue, non-zero to terminate the execution
This callback may be invoked simultaneously by multiple threads. It is the responsibility of the client implementation to protect shared data
xxxxxxxxxxvirtual int On_corrected_polygons( const NsQisMLib::QisMBStore* polys, const double grid ) { return 0; }Represents various settings (settings) to flavor the operation of polygon correction
xxxxxxxxxxclass QisMCorrOpts { ... };Cast this class pointer to any other version (base/derived). The version number is embedded in the class name in form of a suffix V
. Get the latest version number supported by this implementation
xxxxxxxxxxvirtual const char* QisMCorrOpts_name(const int version) const = 0;virtual void* QisMCorrOpts_cast(const int version) = 0;virtual const void* QisMCorrOpts_cast(const int version) const = 0;virtual int QisMCorrOpts_latest_version() const = 0;Set/get the number of polygons to buffer to control the memory usage and to apply corrections using multiple threads.
Does not apply if this->Get_num_threads() == 1
(this->Get_num_threads() == 1) or (count < 32) implies no buffering. In that case, corrected polygons will be received via QisMCorrXNotify::On_corrected_polygon otherwise, the entire buffered set is received via QisMCorrXNotify::On_corrected_polygons
Default : 64K
xxxxxxxxxxvirtual void Set_polygon_buffer_cnt(const int count) = 0;virtual int Get_polygon_buffer_cnt() const = 0;Set/get the number of threads to be used to apply corrections
(this->Get_num_threads() == 1) or (count < 32) implies no buffering. In that case, corrected polygons will be received via QisMCorrXNotify::On_corrected_polygon otherwise, the entire buffered set is received via QisMCorrXNotify::On_corrected_polygons
Default : 0 ( no. threads = no. cpu cores)
xxxxxxxxxxvirtual void Set_num_threads(const int thrnum) = 0;virtual int Get_num_threads() const = 0;If set (layer_offset >= 0), recieve the source polygons (un-corrected) in ADDITION to the corrected polygons. The layer number of the source polygons will be offseted by layer_offset. Datatype number will remain same.
Default : -1 (ONLY recieve corrected polygons)
xxxxxxxxxxvirtual void Set_keep_source_polygons(const short layer_offset) = 0;virtual short Get_keep_source_polygons() const = 0;Copy settings from another object
xxxxxxxxxxvirtual void Copy(const QisMCorrOpts* obj) = 0;Reset settings to defaults
xxxxxxxxxxvirtual void Reset() = 0;Represents the object that performs corrections on a set of polygons for a pre-defined set of correction paramters
xxxxxxxxxxclass QisMCorrXObj { ... };Cast this class pointer to any other version (base/derived). The version number is embedded in the class name in form of a suffix V
. Get the latest version number supported by this implementation
xxxxxxxxxxvirtual const char* QisMCorrXObj_name(const int version) const = 0;virtual void* QisMCorrXObj_cast(const int version) = 0;virtual const void* QisMCorrXObj_cast(const int version) const = 0;virtual int QisMCorrXObj_latest_version() const = 0;Get information about the error corresponding to a failed operation (as represented by an integer 'code')
Get_error_msg() returns a detailed human-readable string
Get_error_condition() returns a unique (string) error code
Get_error_context() returns some internal diagnostic information that could be useful in identifying the source of the error
xxxxxxxxxxvirtual const char* Get_error_msg(const int code) const = 0;virtual const char* Get_error_condition(const int code) const = 0;virtual const char* Get_error_context(const int code) const = 0;Get the extents of the entire corrected space
xxxxxxxxxxvirtual void Get_corrected_extents(NsQisMLib::QisMWindow& extents) const = 0;Get corrected polygons from a view (layers, window)
layers is a string of layers or layer:datatypes separated by comma. "" or "ALL" or (null) implies all layers
minx, miny, maxx, maxy are the co-ordinates of the window in file-units in the same space as the input/source data
opts : Options to control this operation. (null) implies default settings
client : Callback handler to recieve the corrected polygons. Cannot be (null). Polygons may be returned via QisMCorrXNotify::On_corrected_polygon or QisMCorrXNotify::On_corrected_polygons depending on the number of threads and polygon buffer size used.
Returns 0 on success. If non-zero, use Get_error_msg() or Get_error_condition() for error information
xxxxxxxxxxvirtual int Get_corrected_polys( const char* layers, const double minx, const double miny, const double maxx, const double maxy, const QisMCorrOpts* opts, QisMCorrXNotify* client ) = 0; Apply corrections to the specified set of 'polygons'. They are assumed to have the same units and grid as the database associated with this object.
opts : Options to control this operation. (null) implies default settings
client : Callback handler to recieve the corrected polygons. Cannot be (null). Polygons may be returned via QisMCorrXNotify::On_corrected_polygon or QisMCorrXNotify::On_corrected_polygons depending on the number of threads and polygon buffer size used.
Returns 0 on success. If non-zero, use Get_error_msg() or Get_error_condition() for error information
xxxxxxxxxxvirtual int Correct_polygons( const NsQisMLib::QisMBStore* polygons, const QisMCorrOpts* opts, QisMCorrXNotify* client ) = 0;Get the entire set of correction domains (orthogonal rectangles that form the basis of corrections) as polygons
client : Callback handler to recieve the domains as polygons. Cannot be (null). Polygons are returned via QisMCorrXNotify::On_corrected_polygon only
o_layer, o_dttp : layer and datatype number for the domains in source data space (orthogonal rectangles)
c_layer, c_dttp : layer and datatype number for the corresponding domains in the corrected space (convex quardilaterals)
xxxxxxxxxxvirtual void Get_correction_domains( QisMCorrXNotify* client, const unsigned short o_layer = 0, const unsigned short o_dttp = 0, const unsigned short c_layer = 1, const unsigned short c_dttp = 0 ) const = 0;Extension version 2 for QisMCorrXObj
xxxxxxxxxxclass QisMCorrXObjV2: public QisMCorrXObj { ... };Compu>e corrections for a set of points
xy is an array of x,y co-ordinates for the reference points
np is the number of points (x,y pairs)
xy_out_buffer is a pre-allocated buffer of the same size as xy to be used to store the corrected counterparts of xy
returns true on success. false if either of the inputs are invalid
if a point (p) lies outside the already defined domain-space, no correction will be applied (i.e xy_out_buffer(p,p+1) = xy(p,p+1))
xxxxxxxxxxvirtual bool Correct_points( const int* xy, const int np, int* const xy_out_buffer ) = 0;Apply corrections to a window and generate a raster image from it
Requires the QisMRaster extension (qismraster.h, qismraster64.dll/so)
image is the handle to the output raster image
qismraster is the handle to the QisMRaster extension API
rasterizer is the object already created to generate the raster image
llx..ury are the extents of the window in the un-corrected data space to be corrected and rasterized
params are various rasterization settings
layers is a comma-separated list of layers to be used. empty/NULL implies all layers
returns 0 on success. otherwise, call Get_error_msg with the return code to get more information about the error
The extents of the rasterized data will be the min-max box of the correction applied to the un-corrected window
xxxxxxxxxxvirtual int Rasterize_corrected_window( const NsQisMRaster::QisMRasterImage*& image, NsQisMRaster::QisMRaster* qismraster, NsQisMRaster::QisMRasterizer* rasterizer, const double llx, const double lly, const double urx, const double ury, const NsQisMRaster::QisMRasterParams* params, const char* layers ) = 0;Extension version 3 for QisMCorrXObj
xxxxxxxxxxclass QisMCorrXObjV3: public QisMCorrXObjV2 { ... };Returns the file database associated with this object
xxxxxxxxxxvirtual NsQisMLib::QisMFile* File_db() = 0;virtual const NsQisMLib::QisMFile* File_db_const() const = 0;Extension version 4 for QisMCorrXObj
xxxxxxxxxxclass QisMCorrXObjV4: public QisMCorrXObjV3 { ... };Apply corrections to the specified co-ordinates
.._dbu(..) work in db-units. The rest work in user-units. user-unit = db-unit * grid
..in..(..) modify the vertices in the supplied buffer while ..to..(..) requires the user to provide a separate buffer (of the same size) to populate with the transformed results
Correct_in_bstore(..) modifies the original polygon set
xxxxxxxxxxvirtual void Correct(const double xi, const double yi, double& xo, double& yo) const = 0;virtual void Correct_dbu(const int xi, const int yi, int& xo, int& yo) const = 0;virtual void Correct_in(double* xy, const int n_xy) const = 0;virtual void Correct_in_dbu(int* xy, const int n_xy) const = 0;virtual void Correct_to(const double* xyi, const int n_xy, double* xyo) const = 0;virtual void Correct_to_dbu(const int* xyi, const int n_xy, int* xyo) const = 0;virtual void Correct_in_bstore(NsQisMLib::QisMBStore* bstore) const = 0;Represents the object that is used to setup and compute affine transformations on points and vertices
xxxxxxxxxxclass QisMAffineX { ... };Cast this class pointer to any other version (base/derived). The version number is embedded in the class name in form of a suffix V
. Get the latest version number supported by this implementation
xxxxxxxxxxvirtual const char* QisMAffineX_name(const int version) const = 0;virtual void* QisMAffineX_cast(const int version) = 0;virtual const void* QisMAffineX_cast(const int version) const = 0;virtual int QisMAffineX_latest_version() const = 0;Reset the transformation matrix to unity
xxxxxxxxxx[ 1 0 0 ]TM = [ 0 1 0 ][ 0 0 1 ]
xxxxxxxxxxvirtual void Reset() = 0;Add translation along X (
tx) and Y (ty)
xxxxxxxxxx[ 1 0 tx ]TM = [ 0 1 ty ] * TM[ 0 0 1 ]
xxxxxxxxxxvirtual void Translate(const double tx, const double ty) = 0;Add rotation (in
degrees) around the origin
xxxxxxxxxx[ c -s 0 ]TM = [ s c 0 ] * TM[ 0 0 1 ]c = cos(degrees_to_rad), s = sin(degrees_to_rad)
xxxxxxxxxxvirtual void Rotate(const double degrees) = 0;Add scaling along X (
sx) and Y (sy) (> 0.0)
xxxxxxxxxx[ x 0 0 ]TM = [ 0 y 0 ] * TM[ 0 0 1 ]
xxxxxxxxxxvirtual void Scale(const double sx, const double sy) = 0;Add reflection along X (about Y)
xxxxxxxxxx[ -1 0 0 ]TM = [ 0 1 0 ] * TM[ 0 0 1 ]
xxxxxxxxxxvirtual void Flip_X() = 0;Add reflection along Y (about X)
xxxxxxxxxx[ 1 0 0 ]TM = [ 0 -1 0 ] * TM[ 0 0 1 ]
xxxxxxxxxxvirtual void Flip_Y() = 0;Add reflection about X and Y
xxxxxxxxxx[ -1 0 0 ]TM = [ 0 -1 0 ] * TM[ 0 0 1 ]
xxxxxxxxxxvirtual void Flip_XY() = 0;Add shearing along X (
shx) and Y (shy)
xxxxxxxxxx[ 1 x 0 ]TM = [ y 1 0 ] * TM[ 0 0 1 ]
xxxxxxxxxxvirtual void Shear(const double shx, const double shy) = 0;Apply tansformation to the specified co-ordinates
.._dbu(..) work in db-units. The rest work in user-units. user-unit = db-unit * grid
..in..(..) modify the vertices in the supplied buffer while ..to..(..) requires the user to provide a separate buffer (of the same size) to populate with the transformed results
Transform_in_bstore(..) modifies the original polygon set
xxxxxxxxxxvirtual void Transform(const double xi, const double yi, double& xo, double& yo) const = 0;virtual void Transform_dbu(const int xi, const int yi, int& xo, int& yo, const double grid) const = 0;virtual void Transform_in(double* xy, const int n_xy) const = 0;virtual void Transform_in_dbu(int* xy, const int n_xy, const double grid_) const = 0;virtual void Transform_to(const double* xyi, const int n_xy, double* xyo) const = 0;virtual void Transform_to_dbu(const int* xyi, const int n_xy, int* xyo, const double grid) const = 0;virtual void Transform_in_bstore(NsQisMLib::QisMBStore* bstore, const double grid) const = 0;Make a copy from another object
xxxxxxxxxxvirtual bool Copy(const QisMAffineX* handle) = 0;Create a target for the exploder that will apply these transformations to boundaries, paths and texts before passing them over to the
nextstage
xxxxxxxxxxvirtual NsQisMLib::QisMNotify* Exploder_cb(NsQisMLib::QisMNotify* next) = 0;Represents the manager/gateway for the QisMCorrX extension for QisMLib
xxxxxxxxxxclass QisMCorrX: public NsQisMLib::QisMExtensionAPI { ... };Cast this class pointer to any other version (base/derived). The version number is embedded in the class name in form of a suffix V
. Get the latest version number supported by this implementation
xxxxxxxxxxvirtual const char* QisMCorrX_name(const int version) const = 0;virtual void* QisMCorrX_cast(const int version) = 0;virtual const void* QisMCorrX_cast(const int version) const = 0;virtual int QisMCorrX_latest_version() const = 0;Get information about the error corresponding to a failed operation (as represented by an integer 'code')
Get_error_msg() returns a detailed human-readable string
Get_error_condition() returns a unique (string) error code
Get_error_context() returns some internal diagnostic information that could be useful in identifying the source of the error
xxxxxxxxxxvirtual const char* Get_error_msg(const int code) const = 0;virtual const char* Get_error_condition(const int code) const = 0;virtual const char* Get_error_context(const int code) const = 0;Create/destroy a data object for the specified class_name.
Acceptable 'class_name' values are:
QisMCorrOpts
The returned handle MUST be typecasted to the specified class before use
(null) handle implies error. Use Get_error_msg(), Get_error_condition() if an error occurs.
throws std::bad_alloc if the object allocation fails
Every object created by this method MUST be destroyed by the client to avoid resource leaks
This operation is NOT multi-thread safe
xxxxxxxxxxvirtual void* Create_object(const char* class_name) const = 0;virtual void Destroy_object(const char* class_name, void* obj) const = 0;Create an instance of the correction object
filedb is a (QisMFile) database already loaded into QisMLib (see QisMLib::Load_file in qismlib.h and qismfile.h for details)
cell is the view cell where the corrections will be applied. If "" or (null), the default cell (QisMFile::Get_default_top_cell()) will be used
correction_xy is an array of xy co-ordinates of the measured points with correction. It consists of groups of 4 values (in file-units) x,y,dx,dy where x,y are the co-ordinates of the reference point and dx,dy is the measured displacement. correction_xy = double[npts * 4]
npts is the no. measured points. If npts == 0, the four corners of the home view are used without displacements (corrected polygons = source polygons)
errcode : buffer to get the error code in cast this operation fails ( return is (null))
argc, argt, argv : reserved
Returns a non-null handle to the correction object on success. If null, use the error code and Get_error_msg(), Get_error_condition() for information about the error
Each object created by this method MUST be explicitly destroyed by Destroy_correction_object() to avoid resource leaks
Each Create_correction_object() requires 1 license of QISMCODE_CORRX that is released by Destroy_correction_object(). Absense of a license causes this method to fail.
This operation is NOT multi-thread safe
xxxxxxxxxxvirtual QisMCorrXObj* Create_correction_object( NsQisMLib::QisMFile* filedb, const char* cell, const double* correction_xy, const int npts, int* errcode, const int argc = 0, const char* const* argt = 0, void* const* argv = 0 ) = 0;virtual void Destroy_correction_object(QisMCorrXObj* handle) = 0;Convenience function to compute correction parameters for scaling a view of a file along X and Y
filedb is a (QisMFile) database already loaded into QisMLib (see QisMLib::Load_file in qismlib.h and qismfile.h for details)
cell is the view cell where the corrections will be applied. If "" or (null), the default cell (QisMFile::Get_default_top_cell()) will be used
scale_x, scale_y : Scaling parameters (> 0.0)
ecode : error code (if return is (null)). Call Get_error_msg(), Get_error_condition() to get error information
Returns an array of correction parameters for FOUR points (16 values) in the form x1,y1,dx1,dy1...x4,y4,dx4,dy4
This operation is NOT multi-thread safe
xxxxxxxxxxvirtual const double* Correction_scale( NsQisMLib::QisMFile* filedb, const char* cell, const double scale_x, const double scale_y, int& ecode ) = 0;Convenience function to compute correction parameters for rotating a view of a file
filedb is a (QisMFile) database already loaded into QisMLib (see QisMLib::Load_file in qismlib.h and qismfile.h for details)
cell is the view cell where the corrections will be applied. If "" or (null), the default cell (QisMFile::Get_default_top_cell()) will be used
deg_angle : Angle in degrees
ecode : error code (if return is (null)). Call Get_error_msg(), Get_error_condition() to get error information
Returns an array of correction parameters for FOUR points (16 values) in the form x1,y1,dx1,dy1...x4,y4,dx4,dy4
This operation is NOT multi-thread safe
xxxxxxxxxxvirtual const double* Correction_rotation( NsQisMLib::QisMFile* filedb, const char* cell, const double deg_angle, int& ecode ) = 0;Convenience function to compute correction parameters to shear a view of a file along X or Y
filedb is a (QisMFile) database already loaded into QisMLib (see QisMLib::Load_file in qismlib.h and qismfile.h for details)
cell is the view cell where the corrections will be applied. If "" or (null), the default cell (QisMFile::Get_default_top_cell()) will be used
edge : Edge of the view cell to be displaced (upper, lower, right or left)
amount : Shear amount (along the specified edge of the view cell)
ecode : error code (if return is (null)). Call Get_error_msg(), Get_error_condition() to get error information
Returns an array of correction parameters for FOUR points (16 values) in the form x1,y1,dx1,dy1...x4,y4,dx4,dy4
This operation is NOT multi-thread safe
xxxxxxxxxxvirtual const double* Correction_shear( NsQisMLib::QisMFile* filedb, const char* cell, const QisMCorrXFlags::Shear_edge edge, const double amount, int& ecode ) = 0;Convenience function to compute correction parameters to mirror a view of a file about X or Y or both
filedb is a (QisMFile) database already loaded into QisMLib (see QisMLib::Load_file in qismlib.h and qismfile.h for details)
cell is the view cell where the corrections will be applied. If "" or (null), the default cell (QisMFile::Get_default_top_cell()) will be used
axis : about/accross X, Y or both
ecode : error code (if return is (null)). Call Get_error_msg(), Get_error_condition() to get error information
Returns an array of correction parameters for FOUR points (16 values) in the form x1,y1,dx1,dy1...x4,y4,dx4,dy4
This operation is NOT multi-thread safe
xxxxxxxxxxvirtual const double* Correction_mirror( NsQisMLib::QisMFile* filedb, const char* cell, const QisMCorrXFlags::Mirror axis, int& ecode ) = 0;Extension version 2 for QisMCorrXV2
xxxxxxxxxxclass QisMCorrXV2: public QisMCorrX { ... };Create a new affine transformation object
argc, argt, argv are optional parameters reserved for future use
On success, returns a handle to the newly created object. Returns NULL on failure (call Get_error_.. for error information)
Every object created this way must be destroyed eventually using Destroy_affine_xform to avoid resource leaks
xxxxxxxxxxvirtual QisMAffineX* Create_affine_xform( const int argc = 0, const char* const* argt = 0, void* const* argv = 0 ) = 0;virtual void Destroy_affine_xform(QisMAffineX* obj) = 0;QisMScript Commands to compute 2D affine and bi-linear transformations on CAD data
See qismcorrx.h for the corresponding C++ api
Some commands require a license
Create a new affine transformation object
xxxxxxxxxxcorrx.create_affine&affine={id}{translate={dx},{dy}}*{scale={sx},{sy}}*{rotate={deg}}*{shear={shx},{shy}}*{flip=X|Y|XY}*{clear}*
&affine={id} specifies a name to be associated with the newly created object
translate=... if specified adds translation along X and Y in user-units
scale=... if specified adds scaling along X and Y
rotate=... if specified adds rotation in degrees
shear=... if specified adds shearing along X and Y
flip=... if specified adds reflection along X or Y or X and Y axes
clear resets the transformation matrix
The transformations can be specified in any order and any number of times for a cumulative effect
Every object created by this command MUST be destroyed using corrx.destroy_affine
Add transformations to the affine object
xxxxxxxxxxaffine.set$affine={id}{translate={dx},{dy}}*{scale={sx},{sy}}*{rotate={deg}}*{shear={shx},{shy}}*{flip=X|Y|XY}*{clear}*
$affine={id} specifies the name associated with an existing affine object
translate=... if specified adds translation along X and Y in user-units
scale=... if specified adds scaling along X and Y
rotate=... if specified adds rotation in degrees
shear=... if specified adds shearing along X and Y
flip=... if specified adds reflection along X or Y or X and Y axes
clear resets the transformation matrix
The transformations can be specified in any order and any number of times for a cumulative effect
Apply affine transformation to a set of points
xxxxxxxxxxaffine.transform$affine={id}xy={x},{y}[,{x},{y}]*[&var={name}]
$affine={id} specifies the name associated with an existing affine object
xy=... is the set of points to be transformed
&var={name} if specified creates a string variable called {name} that stores the transformed values in the format {x0},{y0}...{xn},{yn}
Apply affine transformation to a set of boundaries
xxxxxxxxxxaffine.transform_bstore$affine={id}$bin={id}[grid={value}]
$affine={id} specifies the name associated with an existing affine object
$bin={id} specifies the name associated with the boundary set to be transformed
[grid={value}] specifies the data grid in user-units (default: 1.0)
This command changes the boundary set to the transformed self
Destroy an affine object
xxxxxxxxxxcorrx.destroy_affine$affine={id}
$affine={id} specifies the name associated with an existing affine object to be destroyed
Create a settings object for use with corrx.create_corrx_obj
xxxxxxxxxxcorrx.create_opts&opts={opts_id}[thrnum={n_threads}][bufcount={poly_buffer_cnt}][source={layer_offset}]
&opts={opts_id} specifies a name to be associated with the newly created object
thrnum=... if specified is the no. threads to be used for certain operations (default: no. cpu(s))
bufcount=... if specified is the est. buffer size to hold polygons during certain operations (default: 65536)
source=... if specified allocates storage for source polygons at the specified layer += {layer_offset} for certain operations
Every object created by this command MUST be destroyed using corrx.destroy_opts
Destroy a settings object
xxxxxxxxxxcorrx.destroy_opts$opts={opts_id}
$opts={opts_id} specifies the name associated with an existing settings object
Create a new instance of the correction object
xxxxxxxxxxcorrx.create_corrx_obj&corrx={corrx_id}$filedb={filedb_id}[cell={cellname}]corrections={x},{y},{dx},{dy}{,{x},{y},{dx},{dy}}*
&corrx={corrx_id} specifies a name to be associated with the newly created object
$filedb={filedb_id} provides the name associated with the file database that serves as the data source
cell={cellname} if specified, sets the view cell for the source data. Default: default top cell of the file db
corrections={x},{y},{dx},{dy}{,{x},{y},{dx},{dy}}* is a list of points where the correction has been measured
Each point {x},{y} is associated with the correction offsets {dx},{dy} such that corrected_x = x + dx and so on
No. values in the list = 4 x no. points. All values in user-units
Every object created this way MUST be explicitly destroyed
Requires ONE license of QisMCorrX per call that is held until the object is destroyed
Destroy an existing correction object
xxxxxxxxxxcorrx.destroy_corrx_obj$corrx={corrx_id}
$corrx={corrx_id} provides the name associated with the object to be destroyed
Fetch and correct boundaries from a view of the database
xxxxxxxxxxcorrxobj.correct_view$corrx={corrx_id}window={lx},{ly},{ux},{uy}&bin={bin_id}[$opts={opts_id}][layers={layer_string}][domains={layer}]
$corrx={corrx_id} provides the name associated with the correction object to be used
window={lx},{ly},{ux},{uy} are the extents of the window to be queried
&bin={bin_id} specifies a name to be associated with a new container to hold the corrected boundaries
$opts={opts_id} if specified, provides the name of a settings object for optional control
layers={layer_string} if specified, provides a list of layers of interest. Default: "ALL"
domains={layer} if specified, adds diagnostic data to the container at {layer}:0
The container of boundaries created by this command MUST be explicitly destroyed
Correct a set of polygons
xxxxxxxxxxcorrxobj.correct_polys$corrx={corrx_id}$in={input_bin_id}&out={output_bin_id}[$opts={opts_id}][domains={layer}]
$corrx={corrx_id} provides the name associated with the correction object to be used
$in={input_bin_id} specifies a name associated with a container of boundaries to be corrected
&out={output_bin_id} specifies a name to be associated with a new container to hold the corrected boundaries
$opts={opts_id} if specified, provides the name of a settings object for optional control
domains={layer} if specified, adds diagnostic data to the container at {layer}:0
The container of boundaries created by this command MUST be explicitly destroyed
Destroy a container of corrected boundaries
xxxxxxxxxxcorrxobj.delete_store$bin={bin_id}
$bin={bin_id} is the name associated by the container to be destroyed that was created using appropriate commands of this module
Print the corrected extents of the entire space associated with this correction object
xxxxxxxxxxcorrxobj.print_corrected_extents$corrx={corrx_id}[&var={var_id}]
$corrx={corrx_id} provides the name associated with the correction object to be used
[&var={var_id}] if specified provides the name of a string variable to store the extents in the format {minx},{miny},{maxx},{maxy} user-units
Correct a window (manhattan rectangle)
xxxxxxxxxxcorrxobj.correct_window_extents$corrx={corrx_id}window={lx},{ly},{ux},{uy}[&var={var_id}]
$corrx={corrx_id} provides the name associated with the correction object to be used
window={lx},{ly},{ux},{uy} provides the extents to be corrected
First, the four corners of the input window are corrected and then a bounding box is computed around them
[&var={var_id}] if specified provides the name of a string variable to store the extents in the format {minx},{miny},{maxx},{maxy}
Correct a list of points
xxxxxxxxxxcorrxobj.correct$corrx={id}xy={x},{y}[,{x},{y}]*[&var={name}]
$corrx={corrx_id} provides the name associated with the correction object to be used
xy={x},{y}[,{x},{y}]* is a list of points (xy-pairs) to be corrected
[&var={name}] if specified, is the name of a string variable to store the corrected points in the format {x1},{y1},...{xn},{yn}
The no. points don't change
Correct a container of boundaries
xxxxxxxxxxcorrxobj.correct_bstore$corrx={id}$bin={id}
$corrx={corrx_id} provides the name associated with the correction object to be used
$bin={id} is the name associated with the container to correct
Unlike corrxobj.correct_polys, the container itself if modified to reflect the corrected polygons
Therefore no new allocation is required
Various attibutes of the container such as the no. polygons, no. vertices per polygon and layer/datatype associations don't change
Correct and rasterize a view of the database
xxxxxxxxxxcorrxobj.rasterize_window$corrx={corrx_id}$rstr={rstr_id}window={lx},{ly},{ux},{uy}$params={rstr_params_id}[layers={layer_string}]
$corrx={corrx_id} provides the name associated with the correction object to be used
$rstr={rstr_id} provides the name associated with the rasterizer to be used
window={lx},{ly},{ux},{uy} is the window (in user-units) of the database to be rasterized
$params={rstr_params_id} is name of the raster settings object
layers={layer_string} if specified, is the layers of interest
The final image extents will be computed based on corrxobj.correct_window_extents
Compute reflection as a set of correction points
xxxxxxxxxxcorrx.mirror_viewabout={X | Y | XY}$filedb={filedb_id}[cell={cellname}][&var={var_id}]
about={X | Y | XY} specifies the reflection mode. X implies flip Y, Y implies flip X
$filedb={filedb_id} provides the name of the database serving as the source
cell={cellname} if specified, set the view cell. Default: default top cell name
&var={var_id} if specified, is the name of the string variable to store the correction points in the format {x1},{y1},{dx1},{dy1},...{xn},{yn},{dxn},{dyn} (n points, four values per point). All values in user-units
The correction points returned by this command can be used to create a correction object
Compute shear as a set of correction points
xxxxxxxxxxcorrx.shear_viewedge={RIGHT | LEFT | TOP | BOTTOM}amount={x}$filedb={filedb_id}[cell={cellname}][&var={var_id}]
edge={RIGHT | LEFT | TOP | BOTTOM} specifies the edge to be sheared
amount={x} specifies the amount of shear in user-units
$filedb={filedb_id} provides the name of the database serving as the source
cell={cellname} if specified, set the view cell. Default: default top cell name
&var={var_id} if specified, is the name of the string variable to store the correction points in the format {x1},{y1},{dx1},{dy1},...{xn},{yn},{dxn},{dyn} (n points, four values per point). All values in user-units
The correction points returned by this command can be used to create a correction object
Compute rotation as a set of correction points
xxxxxxxxxxcorrx.rotate_viewangle={degrees}$filedb={filedb_id}[cell={cellname}][&var={var_id}]
angle={degrees} provides the rotation
$filedb={filedb_id} provides the name of the database serving as the source
cell={cellname} if specified, set the view cell. Default: default top cell name
&var={var_id} if specified, is the name of the string variable to store the correction points in the format {x1},{y1},{dx1},{dy1},...{xn},{yn},{dxn},{dyn} (n points, four values per point). All values in user-units
The correction points returned by this command can be used to create a correction object
Compute scaling as a set of correction points
xxxxxxxxxxcorrx.scale_viewscale={x}[,{y}]$filedb={filedb_id}[cell={cellname}][&var={var_id}]
scale={x}[,{y}] provides the scaling amount in X, Y
$filedb={filedb_id} provides the name of the database serving as the source
cell={cellname} if specified, set the view cell. Default: default top cell name
&var={var_id} if specified, is the name of the string variable to store the correction points in the format {x1},{y1},{dx1},{dy1},...{xn},{yn},{dxn},{dyn} (n points, four values per point). All values in user-units
The correction points returned by this command can be used to create a correction object
Generate a set of pseudo-random correction points based on a given set of constraints
xxxxxxxxxxcorrx.generate_ptsroi={minx},{miny},{maxx},{maxy}domains={nx},{ny}delta={dx},{dy}[&var={id}]
roi={minx},{miny},{maxx},{maxy} is the bounding box of the data space
domains={nx},{ny} partitions the data space into equal sized units (domains) along X and Y
delta={dx},{dy} provides the max. distortion along X and Y at any point in the data space. Computed pseudo-random distortion at any domain corner {cx},{cy} will be -{dx} <= {cx} <= {dx} along X and -{dy} <= {cy} <= {dy} along Y
&var={var_id} if specified, is the name of the string variable to store the correction points in the format {x1},{y1},{dx1},{dy1},...{xn},{yn},{dxn},{dyn} (n points, four values per point). All values in user-units
The correction points returned by this command can be used to create a correction object
Product name :
QisMCorrXLicense code :11093
The following operations require ONE license of QisMCorrX that is held until the corresponding END function is called
Product name :
QisMCorrXLicense code :11093
The following commands require ONE license of QisMCorrX per call that is held until the corresponding END command
Bug fix - QisMCorrXObj::Get_corrected_extents
New API QisMAffineX to apply affine transformations
New script command corrxobj.correct_window_extents
Support for scripting with QisMScript
QisMCorrXObj extended to V3 to retrieve the underlying QisMFile db
New feature (QisMCorrXObjV2) with the ability to compute corrections for arbitrary list of points and use an existing rasterizer (QisMRasterizer) (using the QisMRaster extension) to generate raster image from the corrected polygons
First cut
Last Updated -- Sun Apr 6 23:34:18 UTC 2025