SQL Server - how to get meter of STDistance() or STLength()? - sql-server

How to get meter of STDistance() or STLength()?
I use
linestring(x y z, x y z, x y z, ...).STLength() //
point(x y).STDistance(point(x y))
but object has 0 of SRID...can I get meter length?

Related

How to know all the 6 hexagon vertices given two vertices only?

I am trying to let the program draw a hexagon, The program should let the user enter the coordinates of two points only, I will assume those points are the terminals of a side, then I need to calculate the coordinates of other four points, but how?
P.S: I use the library graphics.h that contains draw polygon which requires 2 arrays of x and y coordinates for all points
Given two points (x1, y1), (x2, y2), the next point on the hexagon can be computed with the formulas
dx = x2 - x1
dy = y2 - y1
x3 = x2 + ((√3)/2) dx - (1/2) dy
y3 = y2 + (1/2) dx + ((√3)/2) dy
These are derived from general rotation formulas; note that cos 60° = (√3)/2 and sin 60° = 1/2.

How does half of the dimension give the number of layers of NxN matrix?

Assume a matrix of dimension N*N
It seems that to figure out the layers it is composed of the number of them is N/2 but although I can verify it, somehow I can not conceptually connect how does the half of the N gives this layer number.
Example:
4x4 => 4/2 = 2 layers
x x x x
x x x x
x x x x
x x x x
layers:
x x x x
x x x x
x x x x
x x x x
Can someone help me unblock on this?
For even N
Focus on a middle row of the matrix. The layers in the following example (N=6) are denoted with x, y, and z for clarity.
x x x x x x
x y y y y x
x y z z y x <- For example, this row
x y z z y x
x y y y y x
x x x x x x
Because you're in the middle, you will go through every layer. In fact, you'll "enter" every layer once and "exit" that layer later. Each time you enter or exit a layer, there is one element of the matrix. For instance, in the above example, going from left to right we have:
x: enter layer x
y: enter layer y
z: enter layer z
z: exit layer z
y: exit layer y
x: exit layer x
As you can see, we traversed N elements on the row, and each layer needs to be entered and exited, so we deduce that there are N/2 layers.
For odd N
If N is odd, the reasoning is mostly the same, except that the innermost layer (which is just one element) is "entered" and "exited" at the same time. The number of layers is (N+1)/2. We can derive this by temporarily ignoring the innermost layer. The number of elements in the row (ignoring the innermost layer) is N-1, we divide by 2 to get the number of layers (ignoring the innermost layer), and we add 1 (to account for the innermost layer). Then (N-1)/2 + 1 = (N+1)/2.

Is there a name for this type of jagged array?

I'm working with a jagged array representing a hexagon:
x x x
x x x x
x x x x x
x x x x
x x x
or:
xxx
xxxx
xxxxx
xxxx
xxx
I was wondering if this has a name that would help for looking up relevant algorithms etc.

Supress/remove repeated values in Jdeveloper/ADF Table column

I need to supress the repeated values in a table so it will look like:
x y z
- - u
- b z
- - u
y y z
- - u
instead:
x y z
x y u
x b z
x b u
y y z
y y u
In Oracle OBI I can do that editing column properties of a table:
But I can't find this option in column/table properties from Jdeveloper, there is a way to do this?
You can't do this in a table.
You can use a pivot table to do this.
Or you can use an af:iterator to create this type of UI.

tsql conditional maths equation

I need to perform some summations during a select query however depending on 2 values i will need to perform a different equation. hopefully an example will demonstrate
basically i need to perform the following summations
if x > y then (x - y + z) or
if x < y then (x - x + z) basically i am setting this to 0.
So far i thought that i could use 2 tables to dump the x > y values and the x < y values and then perform the relevant equations.
any ideas
You can use a case expression.
select case
when x > y then x - y + z
when x < y then x - x + z
else 0 -- x = y
end
from YourTable

Resources