(*
   $Id$
   ISO TC184/SC4/WG12 N4120 - ISO/TS 10303-1724 Physical unit 2d design view - EXPRESS MIM
   Supersedes ISO TC184/SC4/WG12 N3547
*)


SCHEMA Physical_unit_2d_design_view_mim;
	USE FROM Part_template_shape_with_parameters_mim;  -- ISO/TS 10303-1720	
	USE FROM Physical_unit_2d_shape_mim;	-- ISO/TS 10303-1726
	USE FROM Physical_unit_design_view_mim;	-- ISO/TS 10303-1728
	
REFERENCE FROM support_resource_schema   -- ISO 10303-41
  (bag_to_set); 
	
	
ENTITY component_2d_location
  SUBTYPE OF (context_dependent_shape_representation, shape_representation_relationship, representation_relationship_with_transformation, definitional_representation_relationship);
  DERIVE
    SELF\context_dependent_shape_representation.representation_relation : component_2d_location := SELF;   -- NEW
  WHERE
    WR1: SELF\representation_relationship.name = 'component 2d location';
END_ENTITY;

FUNCTION cto2d_determinant_test (cto2d: cartesian_transformation_operator_2d;
                             expected_value: REAL; delta: REAL ) : BOOLEAN;

LOCAL
  det : REAL := 0.0;
  DRs : LIST [4:4] OF REAL := [];
END_LOCAL;
     DRs[1] := cto2d.u[1].direction_ratios[1];
     DRs[2] := cto2d.u[1].direction_ratios[2];
     DRs[3] := cto2d.u[2].direction_ratios[1];
     DRs[4] := cto2d.u[2].direction_ratios[2];
     det  :=  (DRs[1] * DRs[4]) - (DRs[2] * DRs[3]);
IF (Abs(expected_value - det) < Abs(delta) ) THEN
    RETURN (TRUE);
ELSE
    RETURN (FALSE);
END_IF;
END_FUNCTION;
	
END_SCHEMA;


