Help with defining a consition within a circular boundary


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with defining a consition within a circular boundary
# 1  
Old 11-05-2015
Help with defining a consition within a circular boundary

Hi Help,

I am trying to create something like ---

Suppose, I have grid origin at
Code:
X=600000.0 & Y=90000.0.

For any values of X, Y values lying within a circular periphery defined by circle of radius
Code:
R=500m;X=599500.0 & 600500.0 ;Y=90500.0 & 89500.0

should have a
Code:
default=0

or else it should have a
Code:
default=1

.

Is it possible doing this using awk or shell. If yes, please suggest me a way or else please redirect me to any thread if already been discussed.

I have tried to find a lot on this but not find anything which helps.

Thanks,
# 2  
Old 11-05-2015
Any attempt from your side?
This User Gave Thanks to RudiC For This Post:
# 3  
Old 11-05-2015
No Sir, Unfortunately I do not have any clue how this could be done.
# 4  
Old 11-05-2015
Pity! How about
Code:
awk -vX0=600000.0 -vY0=90000.0 -vR=500 '{print "X:", $1, ", Y:", $2, ", default:", sqrt(($1-X0)*($1-X0) + ($2-Y0)*($2-Y0)) <= R}' file
X: 598800.0 , Y: 90000.0 , default: 0
X: 599500.0 , Y: 90000.0 , default: 1
X: 600500.0 , Y: 90000.0 , default: 1
X: 598800.0 , Y: 90000.0 , default: 0
X: 600000.0 , Y: 89500.0 , default: 1

given X and Y coordinates are in file like
Code:
598800.0        90000.0
599500.0        90000.0
600500.0        90000.0
598800.0        90000.0
600000.0        89500.0

This User Gave Thanks to RudiC For This Post:
# 5  
Old 11-05-2015
Many thanks. You thought it so simple.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Warning: extended partition does not start at a cylinder boundary.

Can you please help me to remove this error. Disk /dev/sda: 64.4 GB, 64424509440 bytes 255 heads, 63 sectors/track, 7832 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk... (4 Replies)
Discussion started by: karthik9358
4 Replies

2. Shell Programming and Scripting

Word boundary with awk in ksh

Hi All, I am searching for IP address pattern in some files which I want to replace with some characters. However when I replace the IP numbers, it also replaces other characters beyond the IP address like below- 125.29.234.18.23456->SSS.SS.SSS.SS.SSSSS In the above example it should not... (7 Replies)
Discussion started by: sanzee007
7 Replies

3. Shell Programming and Scripting

DNS circular verify script

I have modified a script to do a circular DNS look up. The theory is this for a given subnet build a range if IP's do a reverse look up on those IP's take the output of the reverse look up then and do a forward look up If the returns match up give a good status If not return a fail... (1 Reply)
Discussion started by: snoman1
1 Replies

4. Solaris

Partition 0 not aligned on cylinder boundary: "

hi Guys .. user want mirror disk c3t9d0 (running ) to c2t9d0 (fresh hdd). when i tried to bash : prtvtoc /dev/rdsk/c3t9d0s2 | fmthard -s- /dev/rdsk/c2t9d0s2 it showing following error Partition 0 not aligned on cylinder boundary: " 0 4 222 ..... unable to mirror .... plz... (1 Reply)
Discussion started by: coolboys
1 Replies

5. UNIX for Dummies Questions & Answers

Filewatch job in autosys in circular way

I have box created with filewatch job as the first job follwed by 2 other jobs . For the time period of 8:00 am to 8:00 pm,we can get files anytime , with out any restriction on the number of times we get the file. So for this I need to make this box work in circular fashion i.e. once the box... (5 Replies)
Discussion started by: nishantrk
5 Replies

6. Programming

c++ code to check whether a list is circular or not

hi all, i need c++ code to check whether a list is circular or not... please help (8 Replies)
Discussion started by: vidyaj
8 Replies

7. Programming

Aligning for boundary conditions

Hi, I have tcp/ip client server programs which will communicate through reqest,reply c-structures. As the sizeof(struct) may give different value between client and server programs, how do i align properly for boundary conditions. Could anybody please give some suggestion. Thanks in... (3 Replies)
Discussion started by: axes
3 Replies

8. Shell Programming and Scripting

monitoring a circular file

I have an event log which is a circular file. I would like to be able to see real-time updates of that event log. Kind of the equivalent of a 'tail -f'. But obviously 'tail -f' won't work if my circular file has already cycled over. Any ideas as to how I can do this? Let me know if I am clear.... (10 Replies)
Discussion started by: sdilucca
10 Replies

9. HP-UX

Password cannot be circular shift of logonid

Hi , I am getting the below error if i am trying to set the passwd of a user: New password: Password cannot be circular shift of logonid. is there a way thru which i can set the passwd of the user same as the username. Thanks & regards, Sagar. (2 Replies)
Discussion started by: sag71155
2 Replies

10. Shell Programming and Scripting

Circular reference

I might know the answer to this, but I just want to see if any of you know any work arounds before I go and re-write the whole thing. I have a script as follow: $ cat testing #! /usr/bin/ksh f () { echo "Type \"y\" \c" read value if ; then ... (1 Reply)
Discussion started by: fidodido
1 Replies
Login or Register to Ask a Question