I've been building a parser for STEP-formatted data (specifically the ISO 10303-21 standard), but I've run into a roadblock revolving around a single character - '$'.
A quick Google search reveals that in STEP, this character denotes an 'unset' value, I interpreted this as an uninitialized value, however I don't know exactly what I should do with it.
For example, take the following definitions:
#111=AXIS2_PLACEMENT_3D('Circle Axis2P3D',#109,#110,$) ;
#109=CARTESIAN_POINT('Axis2P3D Location',(104.14,0.,0.)) ;
#110=DIRECTION('Axis2P3D Direction',(1.,-0.,0.)) ;
To me I cannot see how this would even work, as the reference direction is uninitialized, and therefore an x-axis cannot be derived, meaning that anything using this Axis2Placement would also have undefined data.
Normally when I reach this point, I would just define some sort of default data for the given data-type (Vertices (0,0,0), Directions(1,0,0), etc.), however this doesn't seem to work, because there's the chance that my default direction would cause conflicts with the supplied data.
I have Googled what to do in this scenario, only to come up with nothing.
I also have a PDF for a very similar STEP format (ISO-10303-42), but it too doesn't mention any sort of default data, or provide any more insight in to how this works.
So, to explicitly state my question: what do I do with uninitialized data in STEP (ISO 10303-21) data?
You need to be able to represent 'unset' as a distinct value. It doesn't mean the same thing as an uninitialized value or a default value. For example you might represent AXIS2_PLACEMENT_3D as an object with data members that are pointers to point to CARTESIAN_POINT and DIRECTION, and the $ means that that pointer will be null in your representation.
Dealing with null values will depend on the context. It may be some kind of error if the data is really necessary. Or it may be that the data isn't necessary, such as if you don't need the axis to be oriented, and a point and direction are sufficient to represent the data.
In this case: #111 is local coordinate system with following 4 attributes:
character name;
pointer to origin (#109);
pointer to axis (#110);
pointer to second axis (reference direction).
If #111 is a coordinate system of circle (I guess it with 'name' value), axis is normal of circle plane, while reference direction points to start of circle (position of zero t parameter of circle). Since a circle is closed curve, you can locate this zero t position in arbitrary place, it has no influence on circle geometric shape, reference direction in this case is not mandatory, and is omitted. And it is your choice how you handle this situation.
When $ sign is used , the value is not required. Specifically, if there are a series of optional values and you want to specify a value for, let's say, 3rd optional argument and you don't want to specify values for the 1st and 2nd optional arguments, you can use $ sign for those two.
Take a look here for a better description.
Related
What I'm trying to do:
I am using MRTK2.5.1 / Hololens2 and the OnlineMaps asset in Unity. I want to use my hand (by either touching map, or pointer from distance) to scroll the map. i.e. tap/grip the map, then drag hand around x/z plane.
What I've done previously:
With holotoolkit/hololens1, this was easily done with a listener for manipulation events.
The OnManipulationChanged event provided me with a CumulativeDelta value of how the hand position had changed since the start of the manipulation.
What I've tried in MRTK2.5:
I started off with ManipulationHandler, which gives me the pointer in eventdata. The pointer->controller has a velocity value, but that's always 0,0,0. I couldn't see anything else obvious relating to velocity or delta position of the thing (hand) triggering the manipulation.
The PointerHandler script has an OnPointerDragged event, but again has no property that looks like a velocity or delta position of hand.
Do i need to be using Gestures?
Not looking for code, just a brief explanation of the correct approach to get the hand velocity or deviation of hand, once the hand has tapped/clicked on the map.
Actually, ManipulationHandler component is deprecated and ObjectManipulator component is a replacement for manipulation behavior. So it is recommended you start with the Object Manipulator component to makes your map movable.
For your question about how to scroll the map around x/z plane, Constraint is aimed at limiting manipulation in some way. Once constraint enabled on your ObjectManipulator component, transform changes will be processed by constraints registered to the selected constraint manager. In your case, MoveAxisConstraint can meet your need, you can add MoveAxisConstraint to game object from Constraint Manager component and set the Constraint On Movement property of Move Axis Constraint component to Y Axis. For more information about MoveAxisConstraint please refer to: https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/README_ConstraintManager.html#moveaxisconstraint
Recently I have had joyous success when providing my own replacement 'Write () procedure for a custom record type, such as...
type Pixel_Format is
record
-- blah blah
end record;
procedure Pixel_Format_Write (
Stream : not null access Root_Stream_Type'Class;
Item : in Pixel_Format);
for Pixel_Format'Write use Pixel_Format_Write;
I was using this to convert certain record members from little-endian to big-endian when writing to a network stream. Worked beautifully.
By the same thinking I wondered if it is possible to replace the 'Round () function of decimal fixed point types, so I attempted a quick and dirty test...
-- This is a "Decimal Fixed Point" type
type Money_Dec_Type is delta 0.001 digits 14;
-- ...
function Money_CustomRound(X : in Money_Dec_Type)
return Money_Dec_Type'Base;
for Money_Dec_Type'Round use Money_CustomRound; -- COMPILER COMPLAINS HERE
-- ...
function Money_CustomRound(X : in Money_Dec_Type)
return Money_Dec_Type'Base is
begin
return 0.001;
end Money_CustomRound;
Alas, GNAT finds this offensive:
attribute "Round" cannot be set with definition clause
Question:
Am I attempting the impossible? Or is there a way to change the default 'Round attribute, in the same way that changing 'Write is possible?
Context to the question:
I have a set of about 15 different ways of rounding currency values that change from one project to the next (sometimes within the same project!). Examples include:
Round halves away from zero (Ada's default it seems)
Round halves towards zero
Statistical (a re-entrant type that requires global housekeeping)
Round towards evens OR odds
Rounds towards +INF / -INF
...
It would be a powerful tool to be able to have this kind of functionality become transparent to the programmer by using certain rounding methods defined at the generic package level.
The angel on my other shoulder suggests I'm asking for something completely insane.
I wonder this because the documentation (ALRM and "Barnes 2012") both give a function specification for the default procedure. Why would they do that if one couldn't replace it with another of one's own design?
No, you cannot redefine the Round attribute. Attributes can only be queried (see RM K.2). Only aspects can be (re)defined using an aspect specification (see RM K.1; some exceptions apply). The RM gives specifications of the functions behind the attributes to clarify the signatures to the reader.
The Point H/V properties from a given Path in a PDF seem capped at value of 32768 pre-scaling from a matrix transform. I'm trying to read the Point information for certain PDF's where it seems to be limiting the Point data incorrectly. When I try transforming the point using transform matrix for the associated element, the matrix appears to be applied to the capped value rather than the true underlying value. A given point as a reported by the library might have an H or V value greater than 32768 where the scaling value might be something like 0.006.
Is there a way to access a Point with a H or V value greater than 32768 before it is scaled? Or even getting the correct scaled value would be okay.
I've seeing this behavior in version 15.0.4PlusP4k and other 15.0.4.x versions.
Yes, there is are two interfaces to access the points in a path. PDEPathGetData returns a list of ASFixed values, and hence is limited to the ASFixed range (as you found). PDEPathGetDataEx (PDEPath path, ASReal *Data, int DataLen) will return the same array of Points, but they will not be limited to the ASFixed range.
Also, I should point out that Datalogics Support is always available to answer these types of questions from customers. Both on-line, and by Phone.
I am trying to make basic constructions like "get intersection of a line and circle", "connect two points", "create a circle" with CGAL. However, the choice of kernel seems to be a problem. When I use exact 2D circular kernel, I get Circular_arc_point_2 from intersections, and then I can't use this data type to create lines, circles; and converting to Point_2 seems to introduce error and then stores the approximate value as an exact number. Additionally this problem seems to be independent of the choice of kernel.
What is a proper way of those constructions? Exact and approximate number are all fine as long as the data type is consistent in these constructions.
In the worst case, if this is unresolvable, is there any other free library with this functionality?
The predefined Exact_circular_kernel_2 only uses rational number as its field type. To cover every constructible point, you should define a circular kernel that uses a FieldWithSqrt. With existing types and traits it is simple:
using L = CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt;
using A = CGAL::Algebraic_kernel_for_circles_2_2<L::FT>;
using K = CGAL::Circular_kernel_2<L, A>;
Then you can convert a Circular_arc_point_2 p to Point_2 with the exact coordinates:
K::Point_2 q(p.x(), p.y());
Circular_arc_point_2 is a point which coordinates are algebraic numbers of degree 2 (only way to represent exactly the intersection of 2 circles). You can convert the point into regular floating point coordinate Point_2 by using for example Point_2(to_double(cp.x()), to_double(cp.y())) but then you'll be loosing the exactness.
I am receiving as input a "map" represented by strings, where certain nodes of the map have significance (s). For example:
---s--
--s---
s---s-
s---s-
-----s
My question is, what reasonable options are there for representing this input as an object.
The only option that really comes to mind is:
(1) Each position translated to node with up,down,left,right pointers. The whole object contains a pointer to top right node.
This seems like just a graph representation specific to this problem.
Thanks for the help.
Additionally, if there are common terms for this type of input, please let me know
Well, it depends a lot on what you need to delegate to those objects. OOP is basically about asking objects to perform things in order to solve a given problem, so it is hard to tell without knowing what you need to accomplish.
The solution you mention can be a valid one, as can also be having a matrix (in this case of 6x5) where you store in each matrix cell an object representing the node (just as an example, I used both approaches once to model the Conway's game of life). If you could give some more information on what you need to do with the object representation of your map then a better design can be discussed.
HTH