Measuring distance between two objects using CATIA VBA - vba

I have a part which has two exremums on one direction. These extremums can be surface, point or line depending on part shape.
I want to measure the distance between those two extremums on the direction which they are defined by.
I couldn't find anyway to measure distance.

i solved the broblem by creating a formula which is
distance(sadasd\Sketchplane,BOUNDARY BOX\extz-2)

Related

How does SQL STBuffer measure distance around polygons?

How does the STBuffer function measure distances around a polygon?
I am looking at the expression:
select SP_GEOMETRY.STBuffer(100)
and wondering how the 100-meter buffer is calculated around the geometry of polygons.
e.g., is it from the centre of the polygon? or does the buffer start from the edges of the polygon?
I am struggling to find helpful documentation on this so if you have any links let me know!
Thanks heaps
I am wondering because the function is trying to pick up boundaries which are within 100m from each other, but when running the function, not all the properties within 100m are being selected.

Checking if a Coordinate is Within a Range - BigQuery GIS

I'm looking at the freely available Solar potential dataset on Google BigQuery that may be found here: https://bigquery.cloud.google.com/table/bigquery-public-data:sunroof_solar.solar_potential_by_censustract?pli=1&tab=schema
Each record on the table has the following border definitions:
lat_max - maximum latitude for that region
lat_min - minimum latitude for that region
lng_max - maximum longitude for that region
lng_min - minimum longitude for that region
Now I have a coordinate (lat/lng pair) and I would like to query to see whether or not that coordinate is within the above range. How do I do that with BQ Standard SQL?
I've seen the Geo Functions here: https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions
But I'm still not sure how to write this query.
Thanks!
Assuming the points are just latitude and longitude as numbers, why can't you just do a standard numerical comparison?
Note: The first link doesn't work without a google account, so I can't see the data.
But if you want to become spatial, I'd suggest you're going to need to take the border coordinates that you have and turn them into a polygon using one of: ST_MAKEPOLYGON, ST_GEOGFROMGEOJSON, or ST_GEOGFROMTEXT. Then create a point using the coords you wish to test ST_MAKEPOINT.
Now you have two geographies you can compare them both using ST_INTERSECTION or ST_DISJOINT depending on what outcome you want.
If you want to get fancy and see how far aware from the border you are (which I guess means more efficient?) you can use ST_DISTANCE.
Agree with Jonathan, just checking if each of the lat/lon value is within the bounds is simplest way to achieve it (unless there are any issues around antimeridian, but most likely you can just ignore them).
If you do want to use Geography objects for that, you can construct Geography objects for these rectangles, using
ST_MakePolygon(ST_MakeLine(
[ST_GeogPoint(lon_min, lat_min), ST_GeogPoint(lon_max, lat_min),
ST_GeogPoint(lon_max, lat_max), ST_GeogPoint(lon_min, lat_max),
ST_GeogPoint(lon_min, lat_min)]))
And then check if the point is within particular rectangle using
ST_Intersects(ST_GeogPoint(lon, lat), <polygon-above>)
But it will likely be slower and would not provide any benefit for this particular case.

would like to restrict oracle spatial shapes to simple polygons

I'm rather new to oracle spatial. I'd like to restrict shapes to simple polygons. multiple polygons are ok. donuts are not. crossed edges are not. and all shapes must be separated by a tolerance.
SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT seems like a good place to start... but would appreciate any further insight on how to determine that I do not have donuts.
any insight appreciated.
found what I needed here:
https://spatialdbadvisor.com/oracle_spatial_tips_tricks/89/sdo_utilgetnumrings-an-alternative
with additional information from the documentation:
https://docs.oracle.com/cd/B28359_01/appdev.111/b28400/sdo_objrelschema.htm#SPATL020

Determining which polygon contains the majority of a line - Oracle Spatial

I have an oracle database (11g spatial) that includes a series of area polygons and water mains. I'm trying to attribute each of these mains to the area in which it is contained and for the most part this is straightforward enough (using the SDO_CONTAINS function) but I'm not sure how to deal with mains that straddle multiple polygons due to errors in digitisation.
In cases like this what I'd ideally like to do is attribute a main to an area polygon if the majority of it's length (>50%) is contained within onit. I know that I can use the SDO_RELATE function to determine every polygon that any given main interacts with, but I don't know how to then go about determining how much of it's length is contained within each area.
The principle is like this:
Correlate mains and areas. Assuming you have many mains and many areas, the most efficient approach is to use SDO_JOIN
For each couple (main/area) returned, compute their intersection (SDO_GEM.SDO_INTERSECTION) and measure the length of that intersection (SDO_GEOM.SDO_LENGTH).
From those results, retain the area for each main where the length is the maximum
If you want a full SQL example, allow me a bit of time to write that using sample data.

Testing how close together two letters can be (2D)

I'm working on a small design project, part of which involved writing out text in a given font such that the letters of a word are just touching each other on their right and left sides.
I've thought of implementing this as follows - create GlyphVectors of two letters, create Shape objects using vector.getOutline(), then create Area objects and intersect them.
The only thing I'm missing with this method is the ability to shift the second letter to the right until the intersect is empty.
Is there a way to do this, or do I need to use a different approach?
TIA
eta: ok, I've figured out I can use AffineTransform. Now, is there a way to tell the size (surface area) of the Area created by the intersection of two letters?
How precise do you want this to be? Pixel precision is much easier to attain than vector precision. Have you considered linearisation (usually done through
public PathIterator getPathIterator(AffineTransform at, double flatness)
) of outlines and then doing search in opposite directions among all points? This seems to be the most obvious solution even though it is not vector-precise.